Info

This question is closed. Reopen it to edit or answer.

output middle variable in ode45 to the main function

1 view (last 30 days)
Here are the problems I encountered:
1. ode45 can only relate one variable to time t, in this case it's T(including Tcr Tmu Tfat Tvsk Tsk Tbl)
2. BF, CO and HR are used to be sub-sub-sub function of obtaining the coupled differential equations,
For example,
in my main function, [t,T] = ode45(@(t,T) Tcoupled(H,T,MuVO2,VO2,Mtot), tspan, T0);
in Tcoupled function: coupled = [tcr; tmu; tfat; tvsk; tsk; tbl;] will be returned as the 6 differential equations' matrix take tbl as an example: it's one of the differential equations returned from function HBSL in hsbl = feval(@HSBL,T,Mtot,MuVO2,VO2);
in HSBL function: BF=feval(@getBF,VO2,T,MuVO2); (have to mention CO and HR are in subfunction of BF)
Now, I have successfully moved BF,CO and into the subfunction Tcoupled , however, the purpose of Tcouple function is just return the differential equations into the input of ode45. BF,CO and HR have to be inside so that their value change over time. But in this case, i don't know how to output them to the main function.

Answers (0)

Community Treasure Hunt

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

Start Hunting!