Using ode45 variables in non-differential equations
古いコメントを表示
I'm looking to take the variables that I am using in my differential equations and apply a conversion to get the value for other variables that are functions of these variables.
That was very poorly worded so here is just an example of my code:
function dy = odeequation(t,y) dy = zeros(6,1);
z = y*(1-0.876*exp(-0.014*t));
dy(1) = some function;
...
dy(6) = some other function;
Before I did not have the dz term because this is my conversion. I want to plot z against time. How can I do that?
Thanks!
回答 (1 件)
Torsten
2016 年 3 月 1 日
Calculate z from the results you obtained for y after your call to the ODE-integrator:
[T,Y]=ode45(...);
for k=1:6
Z(:,k)=Y(:,k).*(1-0.876*exp(-0.014*T));
end
Best wishes
Torsten.
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!