The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 ODE in Matlab
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Easwaran

Netherlands
Posts

Posted - 08/16/2004 :  4:14:18 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Can somebody help me.

With Regards,
V. Easwar
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000