help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help ode45 is not working


From: Andy Buckle
Subject: Re: help ode45 is not working
Date: Tue, 29 Nov 2011 10:48:10 +0000

On 29 November 2011 10:24, Maddi <address@hidden> wrote:
> Hello everybody,
>
> I am using Octave for a few months already. I reinstalled it one week ago,
> so I guess I've got the latest version.
>
> Unfortunately the ode45 doesn't work: I tried a simple example, which I
> found in some PDF tutorial:
>
> I stored a file @FUN.m in cd containing:
> function address@hidden(t,y)
> dy=(y+3*t)/t^2;
>
> Then I perform:
> [t,y]=ode45(@FUN,[1,4],-2);
>
> ...and I get:
> error: creating function handle "@FUN"
> error: evaluating argument list element number 1
> error: creating function handle "@FUN"
> error: evaluating argument list element number 1
>
> If the "[t,y]=ode45(@FUN,[1,4],-2);" is in another m-file that is performed,
> I get:
> error: creating function handle "@FUN"
> error: evaluating argument list element number 1
> error: creating function handle "@FUN"
> error: evaluating argument list element number 1
> error: called from:
> error:   C:\[...]\test.m at line 1, column 5
>
> line 1 column 5: ]
>
> If the function and the file is called FUN (without the @) I get performing
> [t,y]=ode45(FUN,[1,4],-2); :
> error: evaluating argument list element number 1
> error: evaluating argument list element number 1
>
> Performing [t,y]=ode45(FUN,[1,4],-2); from test.m:
> error: 'y' undefined near line 2 column 5
> error: called from:
> error:   C:\[...]\FUN.m at line 2, column 3
> error: evaluating argument list element number 1
> error: evaluating argument list element number 1
> error: C:\[...]\test.m at line 1, column 5
>
> So the mentioned signs are "=" and "y" in the function-file and "]" in
> test.m again.
>
> I use Octave-3.2.4 (forge) on windows 7, the installed odepkg is
> odepkg-0.6.10

With function handles, you don't need a separate m-file. Just do the
following at the prompt.

FUN=@(t,y) (y+3*t)/t^2
[t,y]=ode45(FUN,[1,4],-2)

-- 
/* andy buckle */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]