符号运算

Matlab符号计算建立在Maple基础之上,通过matlab符号数学工具箱来实现的。

  • Symbolic Numbers

 sym(1/3)    --> 1/3

不同于浮点数,符号数值是精确表示的,而浮点数只是一种小数近似值。基于符号数的运算结果是精确的。

sin(sym(pi))  -->0

sin(pi)    -->1.2246e-16

  • Symbolic Variable

You can use two ways to create symbolic variables, syms and sym. The syms syntax is a shorthand for sym.

syms x  //create a symbolic variable x,value x is assigned to variable x.

y=sym('y')   //create a symbolic variable y,value y is assigned to variable y.

A=sym('b',[1 6])  //create many variables    A=[b1 b2 b3 b4 b5 b6]

  • Symbolic Expressions
syms x y z x;

f=a*x^2+b*x+c;

或者

f=sym('a*x^2+b*x+c')
  • Symbolic Functions

Create a symbolic function f with variables x and y by using syms. Creating f automatically creates x and y.

  •  Symbolic Matrix

syms x y
m1=[1,2+x,1;2+x,1,3+y;1,3+y,0]

或者

m2=sym('[1,2+x,1;2+x,1,3+y;1,3+y,0]')

符号识别函数

class()  返回对象的数据类型

isa()  判断输入参数是否为给定的类型

whos  列出当前工作区的变量及其详细信息

findsym()  查找符号表达式或者符号矩阵中所包含的符号变量

符号计算

pretty()  将符号表达式显示为数学表达式形式

collect()  符号表达式合并

expand()  符号表达式展开

factor()  符号表达式因式分解

subs()  符号替换

compose()  复合函数

finverse()  求反函数

limit()  符号表达式求极限

symsum()  符号表达式级数求和

diff  微分

int  积分

taylor()  泰勒展开

solve  解方程

simplify  化简

dsolve()  求解符号微分方程

符号绘图

  • fplot to create 2-D plots of symbolic expressions, equations, or functions in Cartesian coordinates.

  • fplot3 to create 3-D parametric plots.

  • ezpolar to create plots in polar coordinates.

  • fsurf to create surface plots.

  • fcontour to create contour plots.

  • fmesh to create mesh plots.

使用fimplicit对隐式方程进行绘图

 符号分析可视化

 funtool

taylortool 泰勒逼近分析界面

原文地址:https://www.cnblogs.com/larry-xia/p/9905562.html