help-octave
[Top][All Lists]
Advanced

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

Re: lsode: passing function body as a string is obsolete. Please use ano


From: Martin Helm
Subject: Re: lsode: passing function body as a string is obsolete. Please use anonym, ous functions.
Date: Mon, 13 Dec 2010 14:13:13 +0100
User-agent: KMail/1.13.5 (Linux/2.6.34.7-0.5-desktop; KDE/4.5.4; x86_64; ; )

Am Montag, 13. Dezember 2010, 13:03:30 schrieb Richard O. Legendi:
> Hi all,
> 
> I haven't used Octave so far, but I find it pretty useful, thanks for
> this great application!
> 
> I'm having some minor problems using it. I'm trying to connect it with
> Java with JavaOctave (which is working perfectly), but there's an
> example on the following page:
> 
>       http://kenai.com/projects/javaoctave/pages/Home
> 
> When I tried to run it in Octave it generates a warning:
> 
> octave:2> result = lsode("sqrt(1-t**2)", 0, [0 1])(2);
> warning: lsode: passing function body as a string is obsolete. Please
> use anonymous functions.
> warning: lsode: ignoring imaginary part returned from user-supplied
> function octave:3> result
> result =  0.78540
> 
> I wanted to eliminate it, but I keep getting a very different result:
> 
> octave:4> result = lsode(@(t) sqrt(1-t**2), 0, [0 1])(2);
> octave:5> result
> result =  0.84147
> octave:6>
> 
> Any suggestions how to remove that warning? Any help would be greatly
> appreciated!
> 
> Best regards,
> Richard

Your anonymous function does not have the form which is required by lsode! It 
has to be a function of two variables (even if the first one is not used in 
your example)

You need to use it this way

result = lsode(@(x, t) sqrt(1-t**2), 0, t)(1000);
result =  0.78540





reply via email to

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