필터 지우기
필터 지우기

ODE function return additional time dependent values

조회 수: 5 (최근 30일)
구구
구구 2023년 8월 28일
답변: Ayush Anand 2023년 9월 6일
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
Torsten
Torsten 2023년 8월 28일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Ayush Anand
Ayush Anand 2023년 9월 6일
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by