正在加载图片...
>>g=3x2+5*x-4 create another function 3*x^2+5 >>h=subs(, 2,'x)%substitute '2 in g >>issr(h)% show that the result is a symbolic expression 最后一个例子表明subs如何进行替换,并力图简化表达式。因为替换结果是一个符号常 数, MATLLAB可以将其简化为一个符号值。注意,因为subs是一个符号函数,所以它返回 个符号表达式。尽管看似数字,实质上是一个符号常数。为了得到数字,我们需要使用函数 numeric或eva来转换字符串。 > numeric(h)% convert a symbolic expression to a number >>isst(ans)% show that the result is a numeric value ans- 22.4微分和积分 微分和积分是微积分学研究和应用的核心,并广泛地用在许多工程学科。 MATLAB符号 工具能帮助解决许多这类问题。 微分 符号表达式的微分以四种形式利用函数di >>f=a*x3+x2-b*x-c% define a symbolic expression a*x^3+x^2-b*x-Cans= alpha*x^2+b*x+c >> g=' 3*x^2+5*x-4 ' % create another function g= 3*x^2+5*x-4 >> h=subs(g,' 2 ',' x ') % substitute ' 2 ' for ' x ' in g h= 18 >> isstr(h) % show that the result is a symbolic expression ans= 1 最后一个例子表明subs如何进行替换,并力图简化表达式。因为替换结果是一个符号常 数,MATLLAB可以将其简化为一个符号值。注意,因为subs是一个符号函数,所以它返回一 个符号表达式。尽管看似数字,实质上是一个符号常数。为了得到数字,我们需要使用函数 numeric或eval来转换字符串。 >> numeric(h) % convert a symbolic expression to a number ans= 18 >> isstr(ans) % show that the result is a numeric value ans= 0 22.4 微分和积分 微分和积分是微积分学研究和应用的核心,并广泛地用在许多工程学科。MATLAB符号 工具能帮助解决许多这类问题。 微分 符号表达式的微分以四种形式利用函数diff: >> f= ' a*x^3+x^2-b*x-c ' % define a symbolic expression f= a*x^3+x^2-b*x-c
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有