I am doing a project for my electrical engineering course. We have never used matlab; we are supposed to copy this code into matlab word for word, which i did, however i keep receiving the three errors shown below. Could anyone tell me why this is? the code typed into the matlab info is underneath this message and the m file is underneath the error messages.
Thanks!
in matlab window:
>> tspan=[0 2]; >> y0=[4,-5]; >> [t,y]=ode45('order2',tspan,y0); Error using feval Undefined function 'order2' for input arguments of type 'double'.
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, … ************************************ after the line where i had my error i was supposed to type:>>plot(t,y(:1)) this would be the end of the code ********************************* This is my m file
function dydt = order2(t,y) dydt = zero(size(y)); a=1.0; b=-2.0; r=0.0; dydt(1)=y(2); dydt(2)=r-a*y(2)-b*y(1);
Best Answer