help-octave
[Top][All Lists]

## Re: Cannot plot in gnuplot what works in Octave

 From: Geordie McBain Subject: Re: Cannot plot in gnuplot what works in Octave Date: Wed, 24 Aug 2005 10:27:45 +1000

```Hello.  Use the old Fortran style double-star for exponentiation in
gnuplot:

gnuplot> f(x) = (1-h/((x-th)**2+1))
gnuplot> h= 0.1
gnuplot> th = 9
gnuplot> plot f(x)
gnuplot>

On Tue, 2005-08-23 at 17:07 -0700, Henry F. Mollet wrote:
> I'm trying to plot f(x) = (1-h/((x-th)^2+1)) directly in gnuplot but get a
> warning that "non-integer passed to boolean operator".
> It works in Octave.
> Henry
>
> octave:1> x=0:35;
> octave:2> y = (1-0.1./((x-9).^2+1));
> octave:3> plot (x,y)
> octave:4> quit
>
> gnuplot> f(x) = (1-h/((x-th)^2+1)) % this must be element by element
> operation in gnuplot, as I cannot enter the ./ and .^ operators in gnuplot
> gnuplot> h= 0.1
> gnuplot> th = 9
> gnuplot> plot f(x)
>          non-integer passed to boolean operator
> gnuplot> plot [x=0:35] f(x)
>          non-integer passed to boolean operator
>
> % Below works just fine:
> gnuplot> f(x) = Loo*(1-exp(-k*(x-to)))
> gnuplot> Loo=500
> gnuplot> k = 0.05
> gnuplot> to = -5
> gnuplot> plot f(x)
> gnuplot> plot [x=0:35] f(x)
>
> % Trying graw in Octave does not work either:
> octave:1> x=0:35;
> octave:2> y = (1-0.1./((x-9).^2+1));
> octave:3> plot (x,y)
> octave:4> graw "f(x) = (1-0.1./((x-9).^2+1))\n"
> octave:5>
> gnuplot> f(x) = (1-0.1./((x-9).^2+1))
>                       ^
>          line 0: ')' expected
> octave:5> graw "f(x) = (1-0.1/((x-9)^2+1))\n"
> octave:6> graw "plot f(x)\n"
> octave:7>          line 0: non-integer passed to boolean operator
>
>
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>
>

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```