Matlab ode45 referencing past value

  • Topic: MATLAB 
  • Thread starter Thread starter yoshig
  • Start date Start date
  • Tags Tags
    Matlab Ode45 Value
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 3K views
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
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.