I am new to matlab, and am trying to implement RungaKutta Method to solve Third Order simultaneous differential equations using ODE45. The below code has been written taking assistance through online available articles and papers. I am getting the following errors. Can someone please take a look?
The set of equations I am trying to solve are:
File: freeconvect.m
function Y=freeconvect(eta,X,Pr,Le)
% X=(F0; F1; F2; Theta0; Theta1; Phi0; Phi1)
Nb=0;
Nt=0;
dF0deta=X(2);
df1deta=X(3);
dF2deta=((X(2))^2)-(X(1)*X(3));%-3*X(1)*X(3)+2*(X(2))^2-X(4);
dTheta0deta=X(5);
%dTheta1deta=((-1)*Pr)*((X(1)*X(5))+(Nb*X(7)*X(5))+(Nt*(X(7))^2));%-3*Pr*X(1)*X(5);
dPhi0deta=X(7);
dPhi1deta=(-1)*((Le*X(1)*X(5))+((Nt/Nb)*((-1)*Pr)*((X(1)*X(5))+(Nb*X(7)*X(5))+(Nt* (X(7))^2))));%-3*Pr*X(1)*X(5);
Y=[dF0deta; dF1deta; dF2deta; dTheta0deta; dPhi0deta; dPhi1deta];
File: Untitled3.m
% ODE45 Solver for freeconvect.m
Pr=10;
Le=10;
etaspan=[0 10] ;
Xinit=[0;1;1;1;1;1;1];
[Eta,X]=ode45(@freeconvect,etaspan,Xinit,Pr,Le);
plot(Eta,X);
ERROR-------------------------------------------------------
>> Untitled3
Attempted to access X(7); index out of bounds because numel(X)=6.
Error in freeconvect (line 10)
dPhi0deta=X(7);
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in Untitled3 (line 10)
[Eta,X]=ode45(@freeconvect,etaspan,Xinit,Pr,Le);