matlab code solves the system of differential equations but it plots the initial values,not the answer.help!!please!!

hi everyone!i have this code and it runs but there is a problem,it keeps the initial values instead of solving the differential equations can you help? :)
function my_ode
[T,F]=ode15s(@diff2,[0 5],[10 20 0 333]);
plot(T,F(:,1),'-',T,F(:,2),'.',T,F(:,3),'*',T,F(:,4),'^')
end
function df=diff2(t,f)
Tc=60+5*(60-25);
nw=20;
k0=5e10;
x=15000;
c=-9020;
pa=14.384;
pw=55.382;
pb=13.668;
cpa=125;
cpw=75;
cpb=250;
a=-55570;
b=-349700;
df=zeros(4,1);
df(1)=-k0*exp(c/f(4))*f(1);
df(2)=0;
df(3)=-df(1);
df(4)=(x*(Tc-f(4))-df(1)*a-df(3)*b-(df(1)*cpa+df(3)*cpb+df(2)*cpw)*f(4))/(f(1)*cpa+f(3)*cpb+f(2)*cpw);
end

1 Commento

Maroubi - please clarify what the problem is. In your question title you state ...it plots the initial values,not the answer and in your question body you state ...it keeps the initial values instead of solving the differential equations. Have you stepped through the code to verify that T and F are correct? It does seem that (over time) the problem converges to a solution.

Accedi per commentare.

Risposte (0)

Tag

Richiesto:

il 30 Ott 2015

Commentato:

il 31 Ott 2015

Community Treasure Hunt

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

Start Hunting!

Translated by