Thread Subject: problem with ode

Subject: problem with ode

From: Minh Vo

Date: 22 May, 2009 03:17:01

Message: 1 of 3

I'm using matlab 7.4.0 (R2007a)
i want to solve a system of differential equations
i read in Help and do like it
i only copy from Help.

it consist of:
"function dy = rigid(t,y)
dy = zeros(3,1); % a column vector
dy(1) = y(2) * y(3);
dy(2) = -y(1) * y(3);
dy(3) = -0.51 * y(1) * y(2);"

to make m-file
after that, i type

"options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
[T,Y] = ode45(@rigid,[0 12],[0 1 1],options);"

in command window
but it doesn't run
and appear a warning

"??? Error using ==> feval
Undefined function or method 'rigid' for input arguments of type 'double'.

Error in ==> funfun\private\odearguments at 110
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 don't know why these codes come from Help. i think it must be run easily.
can you explain this problem?????
i hope to receive your reply as soon as possible
thank you so much.

Subject: problem with ode

From: Bruno Luong

Date: 22 May, 2009 07:28:02

Message: 2 of 3

"Minh Vo" <vdmminh@gmail.com> wrote in message <gv55fd$rs4$1@fred.mathworks.com>...
> I'm using matlab 7.4.0 (R2007a)
> i want to solve a system of differential equations
> i read in Help and do like it
> i only copy from Help.
>
> it consist of:
> "function dy = rigid(t,y)
> dy = zeros(3,1); % a column vector
> dy(1) = y(2) * y(3);
> dy(2) = -y(1) * y(3);
> dy(3) = -0.51 * y(1) * y(2);"
>
> to make m-file
> after that, i type
>
> "options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
> [T,Y] = ode45(@rigid,[0 12],[0 1 1],options);"
>
> in command window
> but it doesn't run
> and appear a warning
>
> "??? Error using ==> feval
> Undefined function or method 'rigid' for input arguments of type 'double'.

Where do you save rigid? It must be accessible anywhere. What happens if you type

> rigid(0,0)

Bruno

Subject: problem with ode

From: Nguyen The Hoach

Date: 27 May, 2009 14:56:01

Message: 3 of 3

I also think, Minh Vo has save "rigid.m" that the current directory doesn't include it. Let check it again.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com