This is the script:
syms h x V g t realx0=[120000;0;10000;g0];ode1=V*sin(g);ode2=V*cos(g);ode3=-rho(h)*V^2/(2*B)+9.81*sin(g);ode4=-rho(h)*V*0.28/(2*B)+9.81*cos(g)/V-V*cos(g)/R;odes=[ode1;ode2;ode3;ode4];ODERES = matlabFunction(odes, 'Vars',{t,[h x V g]});[t,y]=ode45(@(t,y)ODERES(t,y),[0 100],x0);
And I have these errors:
Index exceeds matrix dimensions.Error insymengine>@(t,in2)[in2(:,3).*sin(in2(:,4)),in2(:,3).*cos(in2(:,4)),sin(in2(:,4)).*(9.81e2./1.0e2)-in2(:,3).^2.*exp(in2(:,1).*(-1.881080068002754e-7)).*1.646505376344086e-3,in2(:,3).*cos(in2(:,4)).*(-1.567889620570712e-7)-in2(:,3).*exp(in2(:,1).*(-1.881080068002754e-7)).*4.610215053763441e-4+(cos(in2(:,4)).*(9.81e2./1.0e2))./in2(:,3)]Error in @(t,y)ODESYS(t,y)Error in odearguments (line 90)f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Thank you for helping
Best Answer