ODE function return additional time dependent values

3 Ansichten (letzte 30 Tage)
구구
구구 am 28 Aug. 2023
Beantwortet: Ayush Anand am 6 Sep. 2023
The equation I'm integrating is M x'' = F, which is the basic rigid body equation of motion and also performs transient heat conduction analysis.
Adding temperature to the ODE variables would add too many degrees of freedom, so I want to analyze that part separately.
However, in order to perform the transient heat conduction analysis, I need the previous time step and the temperature at that time, is there any way to get these values as additional output variables from the ODE function at specific time step?
  1 Kommentar
Torsten
Torsten am 28 Aug. 2023
Adding temperature to the ODE variables would add too many degrees of freedom, so I want to analyze that part separately.
If you can start the thermal model from the solution of the rigid body model, you can also solve both of them combined.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ayush Anand
Ayush Anand am 6 Sep. 2023
Hi,
I understand you are integrating the rigid body equation of motion and perform transient heat conduction analysis alongside and want to know if there is a way to get previous timestep and temperature as additional output variables from the ODE function.
This can be implemented using the “OutputFcn” option in the ODE solvers such as “ode45”. This would involve defining a custom function and storing previous timestep and previous temperature values in an array every timestep. This custom function can then be passed as the “OutputFcnargument with the solver.
For more information on ODE solvers, please refer to the following resources:
  1. https://in.mathworks.com/matlabcentral/answers/312549-get-variable-out-of-ode-45 (This answer explains how to extract extra parameters from the ode45 differential equation solver)
  2. https://in.mathworks.com/matlabcentral/answers/97074-how-do-i-solve-an-ode-with-time-dependent-parameters-in-matlab (How to solve an ode with time-dependent parameters in MATLAB)
I hope this helps!

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by