Matlab : ezplot 和 fplot

来源:互联网 发布:危机公关 知乎 编辑:程序博客网 时间:2024/05/22 07:40

简介编辑

ezplot功能简介:
在matlab的命令窗口中键入help ezplot命令或者doc ezplot即可获得本函数的帮助信息。EZPLOT即:Easy to use function plotter。它是一个易用的一元函数绘图函数 。特别是在绘制含有符号变量的函数的图像时,ezplot要比plot更方便。因为plot绘制图形时要指定自变量的范围,而ezplot无需数据准备[1]  ,直接绘出图形。
ezplot的调用格式:
help ezplot
ezplot Easy to use function plotter
1、 ezplot(FUN)
plots the function FUN(X) over the default domain
-2*PI < X < 2*PI, where FUN(X) is an explicitly defined function of X.
2、ezplot(FUN2) plots the implicitly defined function FUN2(X,Y) = 0 over
the default domain -2*PI < X < 2*PI and -2*PI < Y < 2*PI.
3、ezplot(FUN,[A,B]) plots FUN(X) over A < X < B.
ezplot(FUN2,[A,B]) plots FUN2(X,Y) = 0 over A < X < B and A < Y < B.
4、ezplot(FUN2,[XMIN,XMAX,YMIN,YMAX]) plots FUN2(X,Y) = 0 over
XMIN < X < XMAX and YMIN < Y < YMAX.
5、ezplot(FUNX,FUNY) plots the parametrically defined planar curve FUNX(T)
and FUNY(T) over the default domain 0 < T < 2*PI.
6、ezplot(FUNX,FUNY,[TMIN,TMAX]) plots FUNX(T) and FUNY(T) over
TMIN < T < TMAX.
7、ezplot(FUN,[A,B],FIG), ezplot(FUN2,[XMIN,XMAX,YMIN,YMAX],FIG), or
ezplot(FUNX,FUNY,[TMIN,TMAX],FIG) plots the function over the
specified domain in the figure window FIG.
8、ezplot(AX,...) plots into AX instead of GCA or FIG.
9、H = ezplot(...) returns handles to the plotted objects in H.

应用示例编辑

例一:
ezplot画正弦曲线ezplot画正弦曲线
这个例子通过绘制正弦图形来对ezplot和plot进行比较。使用plot绘制正弦图形的命令语句:
x=[-pi:0.01:pi];
y=sin(x);
plot(x,y)
使用fplot(针对建立的数值函数):
y=inline('sin(x)');
fplot(y,[-pi,pi])
使用ezplot(针对符号函数):
syms x;
y=sin(x);
ezplot(y)
例二:
绘制y=x^2;的图形,其中x为符号变量。
ezplot画y=x^2的图形ezplot画y=x^2的图形
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])
参考资料
0 0
原创粉丝点击