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

Respuestas (1)

Torsten
Torsten el 11 de Jul. de 2017

0 votos

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.

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Jul. de 2017

Respondida:

el 11 de Jul. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by