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일

0 개 추천

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에 대해 자세히 알아보기

질문:

2017년 7월 11일

답변:

2017년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by