Originally Posted by

**duma** I am using matlab for a Differential Equations course and keep getting this error when i try to plot this ode45 function:

??? Input argument "x" is undefined.

Error in ==> F at 3

xp(1)=x(2)

here is the code:

**function xp=F(t,x)**

xp=zeros(2,1);

xp(1)=x(2)

xp(2)=-4*x(2)-5*x(1)+10*cos(0*t)

[t,x]=ode45('F',[30,80],[0,0])

[t,x(:,1)]

plot(t,x(:,1))

I really dont know why matlab keeps telling me 'x' is undefined. Any help would be appreciated!

(Matlab is funny about case sensitivity in the case of functions in .m files)

Code:

function xp=ff(t,x)
xp=zeros(2,1);
xp(1)=x(2)
xp(2)=-4*x(2)-5*x(1)+10*cos(0*t)

Code:

[t,x]=ode45('f',[30,80],[0,0])
[t',x(:,1)]
plot(t',x(:,1))