11.1.1 符号表示式
在MATLAB中是将一符号表示式储存唯一字串
(character string),即是以二个单引号之内的表示式来定义其为
一符号式,例如
'tan(y/x)',
'x^3
- 2*x^2 + 3',
'1/(cos(angle)+2)'
的三个式子。
在一符号表示式中,需要定义所谓的独立变数。如果未曾事先指定何者为独立变数,MATLAB会自行决定。
而它所决定变数的原则如下:它会挑选一个除了i和j之外而在字母上最接近x的小写字元;如果在式子中并无
上述字元,则x会被视为预设的独立变数。函数symvar(s)
可以用已决定何者为独立变数。请看以下的例子:
expression S symvar(S)
'tan(y/x)' x
'x^3-2*x^2+3' x
'1/(cos(angle)+2)' x
'3*a*b-6'
b
MATLAB提供了一个函数ezplot
可以画单变数的符号式,其预设的独立变数的范围是。它的语法为
ezplot(S),
S代表符号变数;另一各相关语法
ezplot(S,[xmin,xmax]),则是设定独立变数的范围xmin到xmax。



上一页 下一页 讲义大纲