- #1
8614smith
- 54
- 0
Homework Statement
use ode45 to solve dy/dx=sin(x)
Homework Equations
The Attempt at a Solution
here is my function file:
function xx=f(t,y)
xx=sin(x);
i have saved it as xx.m so that's not the problem,
in the command window i enter:
>> [t,y]=ode45('xx',[0:0.001:0.5],[0 1]);
? Undefined function or variable 'x'.
Error in ==> xx at 2
xx=sin(x);
Error in ==> odearguments at 109
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
i thought x is defined as the initial values of 0 and 1, what am i doing wrong??