ezplot用于繪制符號函數(shù)圖形,在matlab的命令窗口中鍵入help ezplot命令或者doc ezplot即可獲得本函數(shù)的幫助信息。

中文名

繪制符號函數(shù)圖形

外文名

ezplot

類別

計算機編程

屬于

MATLAB編程

功能簡介

ezplot即:Easy to use function plotter。它是一個易用的一元函數(shù)繪圖函數(shù)。特別是在繪制含有符號變量的函數(shù)的圖像時,ezplot要比plot更方便。因為plot繪制圖形時要指定自變量的范圍,而ezplot無需數(shù)據(jù)準(zhǔn)備,直接繪出圖形。

調(diào)用格式

ezplot(fun)

ezplot(fun,[xmin,xmax])

ezplot(fun2)

ezplot(fun2,[xymin,xymax])

ezplot(fun2,[xmin,xmax,ymin,ymax])

ezplot(funx,funy)

ezplot(funx,funy,[tmin,tmax])

ezplot(...,figure_handle)

ezplot(axes_handle,...)

h = ezplot(...)

函數(shù)說明

1、ezplot(fun)

在默認(rèn)區(qū)間-2π< x < 2π 繪制函數(shù)fun(x)的圖像,其中fun(x)是x的一個顯函數(shù)。fun可以是一個函數(shù)句柄或者字符。

2、plot(fun,[xmin,xmax])

在區(qū)間 xmin < x< xmax 繪制函數(shù)fun(x)。

3、

對于一個隱函數(shù)fun2(x,y):

ezplot(fun2)

在默認(rèn)區(qū)間-2π < x<2π, -2π < y< 2π 繪制fun2(x,y)=0。

4、ezplot(fun2,[xymin,xymax])

在xymin < x < xymax和xymin < y < xymax 范圍內(nèi)繪制fun2(x,y)=0圖像。

5、ezplot(fun2,[xmin,xmax,ymin,ymax])

在xmin < x < xmax和ymin < y < ymax 范圍內(nèi)繪制fun2(x,y)=0圖像。

6、ezplot(funx,funy)

在默認(rèn)區(qū)間0 < t < 2π 繪制參數(shù)定義的平面曲線funx(t)和funy(t).

7、ezplot(funx,funy,[tmin,tmax])

在默認(rèn)區(qū)間tmin < t < tmax繪制參數(shù)定義的平面曲線funx(t)和funy(t).

8、ezplot(...,figure_handle)

在句柄圖像定義的圖像窗口繪制特定區(qū)間的給定函數(shù)圖像。

9、ezplot(axes_handle,...)

用坐標(biāo)軸句柄繪制而不是當(dāng)前坐標(biāo)軸句柄(gca)繪制函數(shù)圖像。

10、h = ezplot(...)

返回所有繪制圖像的句柄。

應(yīng)用示例

ezplot畫正弦曲線

例一:

這個例子通過繪制正弦圖形來對ezplot和plot進行比較。使用plot繪制正弦圖形的命令語句:

x=[-pi:0.01:pi];

y=sin(x);

plot(x,y)

使用fplot(針對建立的數(shù)值函數(shù)):

y=inline('sin(x)');

fplot(y,[-pi,pi])

使用ezplot(針對符號函數(shù)):

syms x;

y=sin(x);

ezplot(y)

例二:

ezplot畫y=x^2的圖形

繪制y=x^2;的圖形,其中x為符號變量。 syms x;

y=x^2;

ezplot(y)

例三:

繪制x^2=y^4圖像并且x=[-2π, 2π],y=[-2π, 2π],

代碼為 ezplot('x^2=y^4',[-2*pi,2*pi,-2*pi,2*pi])

例四:

繪制由符號函數(shù)聲明的參數(shù)方程x=1+cos(t),y=-2+2sin(t)所確定的橢圓:

syms t;

x=1+cos(t);

y=2*sin(t)-2;

ezplot(x,y);