Matlab ode45 referencing past value

  • Context: MATLAB 
  • Thread starter Thread starter yoshig
  • Start date Start date
  • Tags Tags
    Matlab Ode45 Value
Click For Summary
SUMMARY

The discussion focuses on using MATLAB's ode45 function to reference past values in a differential equation. The user, rsc42, successfully implemented a solution by defining Y(3) as the difference between current and past values of Y(1) and Y(2) at specific time steps. The equation used is Y(3) = Y(ceil(t),1) - Y(ceil(t-30),1) + Y(ceil(t),2) - Y(ceil(t-30),2), which effectively captures the desired past value reference. This approach allows for the integration of historical data into the ode45 calculations.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of numerical methods for solving differential equations
  • Knowledge of the ode45 function and its parameters
  • Basic concepts of time series data manipulation
NEXT STEPS
  • Explore advanced features of MATLAB's ode45 for more complex differential equations
  • Learn about time series analysis techniques in MATLAB
  • Investigate the use of MATLAB's ceil function for rounding operations
  • Study the implications of step size in numerical simulations
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those working with numerical simulations, engineers modeling dynamic systems, and researchers needing to incorporate historical data into their differential equations.

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 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K