ode 45 not enough input argument
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Torsten
on 30 Oct 2015
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 Comments
Torsten
on 30 Oct 2015
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.
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations 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!