Main Content

ezplot

(Not recommended) Plot symbolic expression, equation, or function

ezplot is not recommended. Use fplot instead. For implicit plots, use fimplicit.

Description

ezplot(f) plots a symbolic expression, equation, or function f. By default, ezplot plots a univariate expression or function over the range [–2π 2π] or over a subinterval of this range. If f is an equation or function of two variables, the default range for both variables is [–2π 2π] or over a subinterval of this range.

ezplot(f,[min,max]) plots f over the specified range. If f is a univariate expression or function, then [min,max] specifies the range for that variable. This is the range along the abscissa (horizontal axis). If f is an equation or function of two variables, then [min,max] specifies the range for both variables, that is the ranges along both the abscissa and the ordinate.

ezplot(f,[xmin,xmax,ymin,ymax]) plots f over the specified ranges along the abscissa and the ordinate.

ezplot(x,y) plots the parametrically defined planar curve x = x(t) and y = y(t) over the default range 0 <= t <= 2π or over a subinterval of this range.

ezplot(x,y,[tmin,tmax]) plots x = x(t) and y = y(t) over the specified range tmin <= t <= tmax.

ezplot(f,[min,max],fig) plots f over the specified range in the figure with the figure number or figure handle fig. The title of each plot window contains the word Figure and the number, for example, Figure 1, Figure 2, and so on. If fig is already open, ezplot overwrites the content of that figure with the new plot.

ezplot(f,[xmin,xmax,ymin,ymax],fig) plots f over the specified ranges along the abscissa and the ordinate in fig.

ezplot(x,y,[tmin,tmax],fig) plots x = x(t) and y = y(t) over the specified range in fig.

h = ezplot(___) returns the plot handle as either a chart line or contour object.

Examples

Plot Over Particular Range

Plot the expression erf(x)*sin(x) over the range [–ππ]:

syms x
ezplot(erf(x), [-pi, pi])

Plot Over Default Range

Plot this equation over the default range.

syms x y
ezplot(x^2 == y^4)

Plot Symbolic Function

Create this symbolic function f(x, y):

syms x y
f(x, y) = sin(x + y)*sin(x*y);

Plot this function over the default range:

ezplot(f)

Plot Parametric Curve

Plot this parametric curve:

syms t
x = t*sin(5*t);
y = t*cos(5*t);
ezplot(x, y)

Input Arguments

collapse all

Symbolic expression, equation, or function.

Numbers specifying the plotting range, specified as a vector of length 2. For a univariate expression or function, the plotting range applies to that variable. For an equation or function of two variables, the plotting range applies to both variables. In this case, the range is the same for the abscissa and the ordinate.

Numbers specifying the plotting range, specified as a numeric or symbolic vector along the abscissa (first two numbers) and the ordinate (last two numbers).

Figure specified as a figure handle or figure window where you want to display a plot. For figure handle, the current figure handle returned by gcf. For figure number, if no plot windows are open, then 1. If one plot window is open, then the number in the title of that window. If more than one plot window is open, then the highest number in the titles of open windows.

Parametric curve specified as symbolic expressions or functions x = x(t) and y = y(t).

Plotting range for a parametric curve specified as a numeric or symbolic vector.

Output Arguments

collapse all

Chart line or contour line object, returned as a scalar. For details, see Line Properties and Contour Properties.

Tips

  • If you do not specify a plot range, ezplot uses the interval [–2π 2π] as a starting point. Then it can choose to display a part of the plot over a subinterval of [–2π 2π] where the plot has significant variation. Also, when selecting the plotting range, ezplot omits extreme values associated with singularities.

  • ezplot open a plot window and displays a plot there. If any plot windows are already open, ezplot does not create a new window. Instead, it displays the new plot in the currently active window. (Typically, it is the window with the highest number.) To display the new plot in a new plot window or in an existing window other than that with highest number, use fig.

  • If f is an equation or function of two variables, then the alphabetically first variable defines the abscissa (horizontal axis) and the other variable defines the ordinate (vertical axis). Thus, ezplot(x^2 == a^2,[-3,3,-2,2]) creates the plot of the equation x2 = a2 with –3 <= a <= 3 along the horizontal axis, and –2 <= x <= 2 along the vertical axis.

Version History

Introduced before R2006a