Fplot Range
Produces a plot that is equivalent to the one above, but also includes a legend displaying the name of the plotted function. Fplot (fn, limits) fplot (, tol) fplot (, n) fplot (, fmt) x, y = fplot Plot a function fn within the range. xmin xmax ymin ymax zmin zmax — Also set the z-axis limits to range from zmin to zmax. xmin xmax ymin ymax zmin zmax cmin cmax — Also set the color limits. Cmin is the data value that corresponds to the first color in the colormap.
Next: Two-dimensional Geometric Shapes, Previous: Axis Configuration, Up: Two-Dimensional Plots [Contents][Index]
15.2.1.2 Two-dimensional Function Plotting
Octave can plot a function from a function handle, inline function, orstring defining the function without the user needing to explicitlycreate the data to be plotted. The function fplot
also generatestwo-dimensional plots with linear axes using a function name and limitsfor the range of the x-coordinate instead of the x and y data. Forexample,
produces a plot that is equivalent to the one above, but also includes alegend displaying the name of the plotted function.
Plot a function fn within the range defined by limits.
fn is a function handle, inline function, or string containing thename of the function to evaluate.
The limits of the plot are of the form [xlo, xhi]
or[xlo, xhi, ylo, yhi]
.
The next three arguments are all optional and any number of them may begiven in any order.
tol is the relative tolerance to use for the plot and defaultsto 2e-3 (.2%).
n is the minimum number of points to use. When n is specified,the maximum stepsize will be (xhi - xlo) / n
. Morethan n points may still be used in order to meet the relativetolerance requirement.
The fmt argument specifies the linestyle to be used by the plotcommand.
If the first argument hax is an axes handle, then plot into this axes,rather than the current axes returned by gca
.
With no output arguments the results are immediately plotted. With twooutput arguments the 2-D plot data is returned. The data can subsequentlybe plotted manually with plot (x, y)
.
Example:
Programming Notes:
fplot
works best with continuous functions. Functions withdiscontinuities are unlikely to plot well. This restriction may be removedin the future.
fplot
performance is better when the function accepts and returns avector argument. Consider this when writing user-defined functions and useelement-by-element operators such as .*
, ./
, etc. See thefunction vectorize
for potentially converting inline or anonymousfunctions to vectorized versions.
See also:ezplot, plot, vectorize.
Other functions that can create two-dimensional plots directly from afunction include ezplot
, ezcontour
, ezcontourf
andezpolar
.
Plot the 2-D curve defined by the function f.
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*pi
with 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
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.
If the first argument hax is an axes handle, then plot into this axes,rather than the current axes returned by gca
.
The optional return value h is a vector of graphics handles tothe created line objects.
See also:plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc.
Fplot Range
Plot the contour lines of a function.
f is a string, inline function, or function handle with two argumentsdefining the function. By default the plot is over the meshed domain-2*pi <= x y <= 2*pi
with 60 points in each dimension.
If dom is a two element vector, it represents the minimum and maximumvalues of both x and y. If dom 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 each dimension.
If the first argument hax is an axes handle, then plot into this axes,rather than the current axes returned by gca
.
The optional return value h is a graphics handle to the created plot.
Example:
See also:contour, ezcontourf, ezplot, ezmeshc, ezsurfc.
Plot the filled contour lines of a function.
f is a string, inline function, or function handle with two argumentsdefining the function. By default the plot is over the meshed domain-2*pi <= x y <= 2*pi
with 60 points in each dimension.
If dom is a two element vector, it represents the minimum and maximumvalues of both x and y. If dom 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 each dimension.
If the first argument hax is an axes handle, then plot into this axes,rather than the current axes returned by gca
.
The optional return value h is a graphics handle to the created plot.
Example:
See also:contourf, ezcontour, ezplot, ezmeshc, ezsurfc.
Plot a 2-D function in polar coordinates.
The function f is a string, inline function, or function handle witha single argument. The expected form of the function isrho = f(theta)
.By default the plot is over the domain 0 <= theta <= 2*pi
with 500 points.
If dom is a two element vector, it represents the minimum and maximumvalues of theta.
n is a scalar defining the number of points to use in plottingthe function.
If the first argument hax is an axes handle, then plot into this axes,rather than the current axes returned by gca
.
The optional return value h is a graphics handle to the created plot.
Example:
See also:polar, ezplot.
Next: Two-dimensional Geometric Shapes, Previous: Axis Configuration, Up: Two-Dimensional Plots [Contents][Index]
Next: Multiple Plot Windows, Previous: Plot Annotations, Up: High-Level Plotting [Contents][Index]
15.2.4 Multiple Plots on One Page
Plot Ranger By Land Pride Price
Octave can display more than one plot in a single figure. The simplestway to do this is to use the subplot
function to divide the plotarea into a series of subplot windows that are indexed by an integer.For example,
creates a figure with two separate axes, one displaying a sine wave and theother a cosine wave. The first call to subplot divides the figure into twoplotting areas (two rows and one column) and makes the first plot area active.The grid of plot areas created by subplot
is numbered in row-major order(left to right, top to bottom). After plotting a sine wave, the next call tosubplot activates the second subplot area, but does not re-partition thefigure.
Set up a plot grid with rows by cols subwindows and set thecurrent axes for plotting (gca
) to the location given by index.
If only one numeric argument is supplied, then it must be a three digitvalue specifying the number of rows in digit 1, the number of columns indigit 2, and the plot index in digit 3.
The plot index runs row-wise; First, all columns in a row are numberedand then the next row is filled.
For example, a plot with 2x3 grid will have plot indices running as follows:
index may also be a vector. In this case, the new axes will enclosethe grid locations specified. The first demo illustrates this:
The index of the subplot to make active may also be specified by its axeshandle, hax, returned from a previous subplot
command.
If the option 'align'
is given then the plot boxes of the subwindowswill align, but this may leave no room for axes tick marks or labels.
If the option 'replace'
is given then the subplot axes will bereset, rather than just switching the current axes for plotting to therequested subplot.
The 'position'
property can be used to exactly position the subplotaxes within the current figure. The option pos is a 4-element vector[x, y, width, height] that determines the location and size of the axes.The values in pos are normalized in the range [0,1].
Any property/value pairs are passed directly to the underlying axes object.
Matlab Fplot Range
If the output hax is requested, subplot returns the axes handle forthe subplot. This is useful for modifying the properties of a subplotusing set
.
Plot Range In Mathematica
See also:axes, plot, gca, set.
Fplot With A Range
Next: Multiple Plot Windows, Previous: Plot Annotations, Up: High-Level Plotting [Contents][Index]