资源描述
,Click to edit the title text format,Click to edit the outline text format,Second Outline Level,Third Outline Level,Fourth Outline Level,Fifth Outline Level,Sixth Outline Level,Seventh Outline Level,Eighth Outline Level,Ninth Outline Level,Click to edit the title text format,Click to edit the outline text format,Second Outline Level,Third Outline Level,Fourth Outline Level,Fifth Outline Level,Sixth Outline Level,Seventh Outline Level,Eighth Outline Level,Ninth Outline Level,Click to edit the title text format,Click to edit the outline text format,Second Outline Level,Third Outline Level,Fourth Outline Level,Fifth Outline Level,Sixth Outline Level,Seventh Outline Level,Eighth Outline Level,Ninth Outline Level,Click to edit the title text format,Click to edit the outline text format,Second Outline Level,Third Outline Level,Fourth Outline Level,Fifth Outline Level,Sixth Outline Level,Seventh Outline Level,Eighth Outline Level,Ninth Outline Level,*,单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,*,单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,*,*,第,5,章,MATLAB,符号运算,编者,Outline,5.1,符号对象的创建与使用,5.2,符号表达式操作,5.3,符号表达式的替换,5.1,符号对象的创建与使用,1.,符号常量的创建,符号常量是不含变量的符号表达式,用户可以使用,sym,函数创建符号常量,调用格式如下:,S=sym(A,flag),2.,符号变量与符号表达式的创建,在,MATLAB,中,创建符号变量和符号表达式主要通过,sym,和,syms,两个函数,它们的调用格式为:,A=sym(a,m n)%,当,m=n,时可简写为,A=sym(a,n),argv=sym(argv,flagv),syms arg1 arg2.Flagv,3.,符号矩阵的创建,在,MATLAB,中,符号矩阵的元素可以是符号常量、符号变量和符号表达式,它也可以通过逐个元素输入法创建,但必须事先声明符号变量,另外,我们也可以使用,sym,函数来创建或将数值矩阵转化为符号矩阵,。,4.,符号对象与其他对象的转换,符号对象与数值对象、字符串和多项式等之间都能进行相互转换,如图所示,。,图,符号对象与其他对象的转换,5.2,符号表达式操作,1.,查找符号表达式的符号变量,为符号操作和计算的需要,,MATLAB,为用户提供了函数,findsym,和,symvar,,,可以实现对表达式中所有符号变量或指定数目的符号变量的自动认定,其调用格式为:,F=symvar(s),F=symvar(s,n),2.,符号表达式的同类项合并,在,MATLAB,中,提供了,collect,函数来对符号表达式的同类项进行合并,其调用格式为:,R=collect(S)R=collect(S,v),3.,符号表达式的展开,在,MATLAB,中,提供了函数,expand,来将符号表达式展开,其调用格式为:,R=expand(S),5.3,符号表达式的替换,1.,替换重复字符串,在,MATLAB,中,,subexpr,函数的功能是将符号表达式中重复出现的字符串用变量替换,其调用格式为:,Y,SIGMA=subexpr(X,SIGMA)Y,SIGMA=subexpr(X,SIGMA),2.,替换特定符号变量,在,MATLAB,中,,subs,函数的功能是使用指定符号替换符号表达式中的某一个特定符号,该函数的调用格式为:,R=subs(S)%,格式,1R=subs(S,new)%,格式,2R=subs(S,old,new)%,格式,3,谢谢大家!,
展开阅读全文