From: Mike Kendrick on
Hi!
I'm trying to solve this http://tiny.pl/htmkm differential equation with ode23 function but I keep having this error message:

"
??? Undefined function or method 'odearguments' for
input arguments of type 'function_handle'.

Error in ==> ode23 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0,
odeArgs, odeFcn, ...

Error in ==> script at 4
[t,y]=ode23(@eq11,tspan,y0);
"
My source files are:

%script.m
a3=4; a2=6; a1=1.5; a0=1; w0=1; u=1; y0=0;
to=0; tk=100; tspan=[to tk];
[t,y]=ode23(@eq1,tspan,y0);

%eq1.m
function yprime = eq1(t,y)
global a0 a1 a2 a3 u w0
y(1)=y;
yprime(1)=y(2);
yprime(2)=y(3);
yprime(3)=y(4);
yprime(4)=u-a3*y(4)-a2*y(3)-a1*y(2)-a0*y(1).^w0;
end

%%
I really don't know what's going on, any help would be appreciated.
From: Steven Lord on

"Mike Kendrick" <wysek_m(a)o2.pl> wrote in message
news:hs8p0m$2vb$1(a)fred.mathworks.com...
> Hi!
> I'm trying to solve this http://tiny.pl/htmkm differential equation with
> ode23 function but I keep having this error message:
>
> "
> ??? Undefined function or method 'odearguments' for
> input arguments of type 'function_handle'.
>
> Error in ==> ode23 at 172
> [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0,
> odeArgs, odeFcn, ...

Type the following commands:

which -all odearguments
which -all ode23

If the first one does not indicate that odearguments is found, then
something's wrong with your installation or with your path. Make sure the
toolbox/matlab/funfun subdirectory underneath your MATLABROOT is on the path
(the toolbox/matlab/funfun/private directory should NOT be on the path.)
If the second one does not first list ode23 in toolbox/matlab/funfun then
you're calling the wrong file -- ode23 MUST be in toolbox/matlab/funfun in
order to call the private helper function odearguments.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Mike Kendrick on
Hi!

Thank you for your response.
I truly had a problem with Matlab toolbox, but after reinstalling it, I'm having even more errors. I'm running hole procedure from metoda.m
My errors are:

??? Attempted to access y(2); index out of bounds
because numel(y)=1.

Error in ==> rown1 at 4
yprime(1)=y(2);

Error in ==> odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets
args{1} to yp0.

Error in ==> ode23 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0,
f0, odeArgs, odeFcn, ...

Error in ==> metoda at 5
[T,Y]=ode23(yhandle,tspan,y0);

%rown1.
function yprime = rown1(t,y)
global a0 a1 a2 a3 u w0
yprime(1)=y(2);
yprime(2)=y(3);
yprime(3)=y(4);
yprime(4)=u-a3*y(4)-a2*y(3)-a1*y(2)-a0*y(1).^w0;
end

%metoda.m
a3=4;a2=6;a1=1.5;a0=1;w0=1;u=1;y0=0;
to=0;tk=100;tspan=[to tk];
yhandle=(a)rown1;
[T,Y]=ode23(yhandle,tspan,y0);
From: Steven Lord on

"Mike Kendrick" <wysek_m(a)o2.pl> wrote in message
news:hs9o1e$6tf$1(a)fred.mathworks.com...
> Hi!
>
> Thank you for your response.
> I truly had a problem with Matlab toolbox, but after reinstalling it, I'm
> having even more errors. I'm running hole procedure from metoda.m
> My errors are:
>
> ??? Attempted to access y(2); index out of bounds
> because numel(y)=1.

*snip*

> %rown1.
> function yprime = rown1(t,y)
> global a0 a1 a2 a3 u w0
> yprime(1)=y(2);

You're trying to get the second element of y in this code. However, in your
original call to ODE23 ...

*snip*

> %metoda.m
> a3=4;a2=6;a1=1.5;a0=1;w0=1;u=1;y0=0;
> to=0;tk=100;tspan=[to tk];
> yhandle=(a)rown1;
> [T,Y]=ode23(yhandle,tspan,y0);

How many elements does y0 have? ODE23 will call your function with a vector
the same size as y0 each time it needs to evaluate your function. Does your
y0 have a second element?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ