help-octave
[Top][All Lists]

## Re: Newbie: Plotting questions

 From: jeff millar Subject: Re: Newbie: Plotting questions Date: Fri, 5 Jul 2002 14:55:31 -0400

```----- Original Message -----
Sent: Friday, July 05, 2002 11:51 AM
Subject: Newbie: Plotting questions

>
> Hi,
>
> I have just started with Octave and was wondering if someone could give me
a
> hand getting going.
>
> 1. I like to write my commands in a script file and then run it.  For
> example, I create a file named "2dplot.O" and then type "octave 2dplot.O"
in
> a shell.  Is this fairly standard or is there a more efficient way of
doing
> it?  Also, what file extension do people use for these input files?

I started doing about the same thing, create a bunch of functions,
including some that plot and load them into octave with the
source command (because my local directory isn't on the
octave path>

> clear; source "scriptfile.m"

>
> 2. I like to look at 2d and 3d plots of functions that I am working with.
I
> have this simple file to view a 2d plot.
>
> function y = f(x)
>         y = x.^2;
> endfunction
>
> x = (1:10)
> y = f(x)
>
> plot(x,y)
> gset term postscript
> gset output "2dplot.ps"
> replot
>
> Does anyone have a few simple examples of better ways to do this? It's
> annoying that x=(1:10) has intervals of 1.  I can think of a few ways that
> would allow me to decrease that interval but why re-invent the wheel if
you
> don't have to.

x = 1: 0.1: 10; will step in increments of 0.1.

I switched over to  stephan Muller's plotting package...very nice
www.epstk.de

>
> 3.  Ideally, I would like to be able to just say something like z = f(x,y)
> where f(x,y) = x^2 * y^3 and then view a plot of that function over
certain
> domains.  Does anyone have a few examples of how I might do this?
>
> 4. I would also like to be able to have the GNUplot pause on the screen
and
> only write to file after I have viewed it.

plot (x,y);
pause;
..
..
replot;

>

-------------------------------------------------------------
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
-------------------------------------------------------------

```