Error in Ode15s
Show older comments
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
Answers (1)
Torsten
on 11 Jul 2017
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.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!