this is my fynction.it says Error using my_ode (line 18) Not enough input arguments. can you help?
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(1)=-f(6)*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))/(na*cpa+nb*cpb+nw*cpw);
f(5)=(na/pa)+(nb/pb)+(nw/pw);
f(6)=k0*exp(c/f(4));
end
function my_ode()
[T,F]=ode45(@diff2,[0 100],[10 20 0 333 1.056 8.6e-2])
plot(T,F(:,1),'-',T,F(:,2),'-',T,F(:,3),'-',T,F(:,4),'-',T,F(:,5),'-',T,F(:,6),'-')
end

 채택된 답변

Torsten
Torsten 2015년 10월 30일

0 개 추천

function my_ode
[T,F]=ode15s(@diff2,[0 100],[10 20 0 333]);
plot(T,F(:,1),'-',T,F(:,2),'-',T,F(:,3),'-',T,F(:,4),'-')
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))/(na*cpa+nb*cpb+nw*cpw);
Best wishes
Torsten.

댓글 수: 5

maroubi maria
maroubi maria 2015년 10월 30일
you are the best!!!!!
maroubi maria
maroubi maria 2015년 10월 30일
thank you a lot
maroubi maria
maroubi maria 2015년 10월 30일
we still have a problem because it is plotting the df(1),df(2),df(3) ntc and not the f(1),f(2),f(3) ntc that we need. did we write wrong the equations or the code is wrong? thank you
Torsten
Torsten 2015년 10월 30일
As written, MATLAB plots f(1),...,f(4) over T.
You can easily check this:
The first plot should start at 10, the second at 20, the third at 0 and the fourth at 333.
Best wishes
Torsten.
maroubi maria
maroubi maria 2015년 10월 30일
actually the problem is that it keeps the initial values

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

태그

질문:

2015년 10월 30일

댓글:

2015년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by