MATLAB Matlab ode45 referencing past value

AI Thread Summary
The discussion focuses on using Matlab's ode45 to reference past values in a simulation. The user initially seeks a method to include a parameter that calculates the difference between the current and past values of y(3) over a 30-day period. They later clarify their solution, which involves using the equation Y(3) = Y(ceil(t),1) - Y(ceil(t-30),1) + Y(ceil(t),2) - Y(ceil(t-30),2), effectively subtracting past values of y1 and y2. The solution is tailored to the user's specific time step increments of 1. This approach successfully integrates past values into the ode45 calculations.
yoshig
Messages
2
Reaction score
0
I am using ode45, but have a value that is based upon its own past values. I want to be able to include a parameter that equals (y(3) at time t) - (y(3) at time (t- 30days)). Is there a way to include this using ode45?
Thank you in advance!
 
Physics news on Phys.org
Could you post some equations to clarify?
 
Thanks rsc42,

I have actually figured out what I was looking for. I used Y(3) = Y(ceil(t),1) - Y(ceil(t-30),1)+Y(ceil(t),2)-Y(ceil(t-30),2)). This is because my steps are in increments of 1, and I wanted to subtract past values of y1 and y2.
 

Similar threads

Replies
5
Views
2K
Replies
9
Views
3K
Replies
1
Views
2K
Replies
4
Views
8K
Replies
2
Views
2K
Back
Top