Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab ode45 referencing past value

  1. Jun 1, 2012 #1
    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!
  2. jcsd
  3. Jun 5, 2012 #2
    Could you post some equations to clarify?
  4. Jun 5, 2012 #3
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook