MATLAB: Ode 45 not enough input argument

ode45

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

Best Answer

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.
Related Question