失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > matlab符号函数绘图法_matlab中怎么创建符号函数?

matlab符号函数绘图法_matlab中怎么创建符号函数?

时间:2020-08-12 17:14:34

相关推荐

matlab符号函数绘图法_matlab中怎么创建符号函数?

匿名用户

1级

-10-29 回答

MATLAB中,syms函数用于创建符号对象。

语法格式:

syms arg1 arg2 ...

arg1 = sym('arg1');

arg2 = sym('arg2'); ...

的简便写法

syms arg1 arg2 ... real

arg1 = sym('arg1','real');

arg2 = sym('arg2','real'); ...

的简便写法

syms arg1 arg2 ... clear

arg1 = sym('arg1','clear');

arg2 = sym('arg2','clear'); ...

的简便写法

syms arg1 arg2 ... positive

arg1 = sym('arg1','positive');

arg2 = sym('arg2','positive'); ...

的简便写法

syms的功能和sym函数相同,但syms可以同时创建多个符号对象,因此在创建多个符号变量时语法上要比使用sym简单。

相关函数:sym、symvar、findsym、subs

程序示例

>> syms x y z

>> e = sym('e');

>> z = e ^ x * sin(y) + e ^ y * sin(x)

z = e^x*sin(y) + e^y*sin(x)

>> diff(z, 'x')

ans = e^y*cos(x) + e^x*log(e)*sin(y)

>> diff(z, 'y')

ans = e^x*cos(y) + e^y*log(e)*sin(x)

>> y = sin(x)

y = sin(x)

>> int(y)

ans = -cos(x)

在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.

示例:

绘制y=x^2;的图形,其中x为符号变量。

syms x;

y=x^2;

ezplot(y)

如果觉得《matlab符号函数绘图法_matlab中怎么创建符号函数?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。