Matlab基础操作笔记[2]-sym()、vpa()、int()
sym()
创建符号变量、表达式、功能、矩阵
sym()讲 符号变量、表达式、功能、矩阵 以数学形式创建变量。
示例如下:(截取自Create symbolic variables, expressions, functions, matrices – MATLAB sym – MathWorks 中国)
创建符号变量

创建符号矢量

创建符号矩阵

创建符号多维阵列

创建符号数字
将数字值转换为符号数字或表示式。用于次表达,而不是整个表达,以获得更好的准确性。在整个表达式上使用是不准确的,因为 MATLAB 首先将表达方式转换为浮动点数字,从而失去准确性。 不能总是恢复这种丢失的准确性。

剩下几种情况省略。
vpa()
可变精度算术(任意精度算术)Variable-precision arithmetic (arbitrary-precision arithmetic) – MATLAB vpa – MathWorks 中国
vpa()可以把sym类的标识转化位浮点数。
示例:

int()
用于积分
用法,参考自:Definite and indefinite integrals – MATLAB int – MathWorks 中国
F = int( computes the indefinite integral of expr)expr. int uses the default integration variable determined by symvar(expr,1). If expr is a constant, then the default integration variable is x.
参数只有函数expr的积分,默认积x
F = int( computes the indefinite integral of expr,var)expr with respect to the symbolic scalar variable var.
函数expr积var
F = int( computes the definite integral of expr,a,b)expr from a to b. int uses the default integration variable determined by symvar(expr,1). If expr is a constant, then the default integration variable is x.
int(expr,[a b]) is equivalent to int(expr,a,b).
从a到b积expr,默认积x
F = int( computes the definite integral of expr,var,a,b)expr with respect to the symbolic scalar variable var from a to b.
int(expr,var,[a b]) is equivalent to int(expr,var,a,b).
函数expr从a到b积var
示例:
