Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Easwaran
Posted - 08/16/2004 : 4:14:18 PM I wrote a small program in Matlab to solve an ODE. It is almost same as vdpode of matlab except that the differential equations is changed. The code i wrote is,
tspan = [0, pi]; y0 = [0;pi/4];
% Solve the problem using ode45 ode45(@f,tspan,y0); % ------------------------------------------------------------ function dydt = f(t,y) dydt = [sin(y(1))];
I get a error indicating that, "Solving F requires an initial condition vector of length 1."
I dont understand why. Since this is a first order equation, one initial condition would suffice. That is why, i have written y0 = [0,pi/4]; But i dont understand what is this error and how can it be rectified.