function x=Tprevh2o(t)
x=y1(t,1);
end
function dy=derivate2(t,y2,Tprevh2o)
dy=[U(y2(2))*Atot*(Tofh(y2(2))-y2(1))/m_w/Cp_w+mpunto_w/m_w*( Tprevh2o(t)- y2(1)); U(y2(2))*Atot*(y2(1)-Tofh(y2(2)))/mpcm];
end
tspan = [0:1:1000];
y0 = [293.15 Hpcm0];
[t,y2]=ode15s(@derivate2,tspan,y0);
Y1 is a known column vector, for which at each time correspond a value. I want the Ode to read that function as function of time in derivate2, how could i do? Thanks in advance

回答(1 个)

Torsten
Torsten 2017-7-11
Take a look at the examples
-PASS EXTRA PARAMETERS TO ODE FUNCTIONS (you didn't do that correcty in your code above)
and
-ODE WITH TIME-DEPENDENT TERMS
under
https://de.mathworks.com/help/matlab/ref/ode45.html
This should solve your problem.
Best wishes
Torsten.

类别

在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by