Fplot (@cos, 0, 2.pi) fplot ('cos(x), sin(x)', 0, 2.pi) would define the equation the graph uses but they must be continuous. These are all very simple expamples so you should read the Octave Manual. Unfortunately the Octave documentation for doing obvious things can be ridiculously lousy with no working examples. Drawing a simple line on top of a plot is one. As already mentioned, it's is very silly to plot straight lines in octave. It's a waste of memory and processing. Instead use the line function, to draw on top of your plot.

Plot the 2-D curve defined by the function f.

Fplot octave

Plot Octave

The function f may be a string, inline function, or function handleand can have either one or two variables. If f has one variable, thenthe function is plotted over the domain -2*pi < x < 2*piwith 500 points.

If f2v is a function of two variables then the implicit functionf(x,y) = 0 is calculated over the meshed domain-2*pi <= x y <= 2*pi with 60 points in each dimension.

For example:

If two functions are passed as inputs then the parametric function

Fplot Octave

is plotted over the domain -2*pi <= t <= 2*pi with 500 points.

If dom is a two element vector, it represents the minimum and maximumvalues of both x and y, or t for a parametric plot. Ifdom is a four element vector, then the minimum and maximum values are[xmin xmax ymin ymax].

n is a scalar defining the number of points to use in plottingthe function.

Plot Octave Options

If the first argument hax is an axes handle, then plot into this axis,rather than the current axes returned by gca.

The optional return value h is a vector of graphics handles tothe created line objects.

How To Plot Octave

See also: plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc.