正在加载图片...
另一个通用函数可让用户用其它的符号变量、表达式和算子创建新的表达式。 symp取由 逗号隔开的、多至16个参量。各个参量可为符号表达式、数值或算子(+、'-∵*、/、 (或)),然后 symon可将参量联接起来,返回最后所得的表达式 >>f=cos(x)' %create an expression >>g=sin(2*x)% create another expression sin(2*x) >> symp(f,/,g,'',3)%combine them ans- cos(x)/sin(2*x)+3 所有这些运算也同样用数组参量进行 高级运算 MATLAB具有对符号表达式执行更高级运算的功能。函数 compose把fx)和g(x)复合成 fgxy)。函数 inverse求表达式的函数逆,而函数 symsum求表达式的符号和 给定表达式 g=sin(x) h= k=sin(v) >>f1/(1+x2):% create the four expression >>h='1/(1+u^2)'; >>k sin(v)': compose(f, g)% find for f(g(x)) 1/(1+sin(x)2) compose(g, f)% find an expression for g(f(x))另一个通用函数可让用户用其它的符号变量、表达式和算子创建新的表达式。symop取由 逗号隔开的、多至16个参量。各个参量可为符号表达式、数值或算子(' + '、' - '、'*'、' / '、' ^ '、' ( '或' ) '),然后symop可将参量联接起来,返回最后所得的表达式. >> f= ' cos(x) ' % create an expression f= cos(x) >> g= ' sin(2*x) ' % create another expression g= sin(2*x) >> symop(f,'/ ',g,'+',3) % combine them ans= cos(x)/sin(2*x)+3 所有这些运算也同样用数组参量进行。 高级运算 MATLAB具有对符号表达式执行更高级运算的功能。函数compose把f(x)和g(x)复合成 f(g(x))。函数finverse求表达式的函数逆,而函数symsum求表达式的符号和。 给定表达式 f x g x h u = + = = + 1 1 1 1 2 2 sin( ) k = sin(v) >> f= ' 1/(1+x^2) ' ; % create the four expression >> g= ' sin(x) ' ; >> h= ' 1/(1+u^2) ' ; >> k=' sin(v) ' ; >> compose(f,g) % find an expression for f(g(x)) ans= 1/(1+sin(x)^2) >> compose(g,f) % find an expression for g(f(x)) ans=
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有