Hi iam trying to solve 7 1st order differential equation and i get an error message as follow
My M-File:
function dFdW=hw3(W,F)%F(1)=FA,F(2)=FB,F(3)=FC,F(4)=4D, F(5)=FE, F(6)=FF, F(7)=F(G)
global k1 k2 k3 P IdFdW=[(-k1*(F(1)*P/F(7))^0.54)/(1+310*(F(3)*P/F(7)))-k3*(F(1)*P/F(7))^0.54;-3.5*k1*(F(1)*P/F(7))^0.54/(1+310*(F(3)*P/F(7)))-k2*(F(3)*P/F(7))/(1+310*(F(3)*P/F(7)))^2-5.5*k3*(F(1)*P/F(7))^0.54;k1*(F(1)*P/F(7))^0.54/(1+310*(F(3)*P/F(7)))-k2*(F(3)*P/F(7))/(1+310*(F(3)*P/F(7)))^2; 4*k1*(F(1)*P/F(7))^0.54/(1+310*(F(3)*P/F(7)))+k2*(F(3)*P/F(7))/(1+310*(F(3)*P/F(7)))^2+5*k3*(F(1)*P/F(7))^0.54;4*k2*(F(3)*P/F(7))/(1+310*(F(3)*P/F(7)))^2+2*k3*(F(1)*P/F(7))^0.54;2*k3*(F(1)*P/F(7))^0.54;F(1)+F(2)+F(3)+F(4)+F(5)+F(6)+ I];
Call Function
>> global k1 k2 k3 P I>> k1=0.9*10^-6*exp(16.64-11197.98/653)k1 = 5.4125e-007>> k2=0.29*10^-5*exp(27.70-11197.98/653);>> k3=0.15*10^-6*exp(16.64-11197.98/653);>> PT=1.9;>> I=2.15764*10^-5I = 2.1576e-005>> Wspan=[0:2:150];>> F0=[0.000000472222 0.000000571942 0 0 0 0 0.000027768];>> [W,F]=ode45('hw3',Wspan,F0)*??? Error using ==> odearguments at 116HW3 returns a vector of length 1, but the length of initial conditions vector is 7. The vector returned by HW3 and the initial conditions vector must have the samenumber of elements.Error in ==> ode45 at 173[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, .
I have no clue what this error means, i am new user please help.
Thanks
Best Answer