MATLAB: Trying solve 7 1st order differnetial equation -Please help

??? error using ==> odearguments at 116

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 I
dFdW=[(-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^-5
I =
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 116
HW3 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 same
number 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

You declare P as global but you do not assign any value to it. The result in such a case is that P will exist but will be an empty array. Doing calculations with empty arrays generally results in empty arrays. P is involved in all of your array entries except the last, so the end result of your calculation is a single value (a scalar) where 7 values are expected.