a5/3-(v*z)/3-(u*sin(3)*z^2)/3 (4) result 2=solve(Eq,z) result 2 -(v-(v^2+4*a5*u*sin(3)-12*u*w*sin(3))^(1/2))/(2*u*sin(3)) -(v+(v^2+4*a5*u*sin(3)-12*u*w*sin(3))^(1/2))/(2*u*sin(3)) 【例2.1-3】 (1) syms a b xX Y k=sym(3'); z=sym('c*sgrt(d)+y*sin(t)'); EXPR=a*z*X+(b*x2+k)*Y; (2) symvar (EXPR) ans [x,¥,a,b,c,d,t,x,y] (3) symvar (EXPR,10) ans x,y,t,d,c,b,a,X,Y] (4) symvar (EXPR,1) ans (5) symvar(EXPR,3) ans x,y,t] (6) E3=sym('a*sqrt(theta)') ??Error using ==sym.sym>sym.sym/scalarsym at 382 Error:argument must be of 'Type:Arithmetical'[sqrt] Error in ==sym.sym>sym.sym/char2sym at 337 Scell scalarsym(x); Error in ==sym.sym>sym.sym/symchar at 182 Scell char2sym(x); Error in ==sym.sym>sym.sym at 120 S cel12sym(S,symchar(x,a,nargin)); E4=sym('a*sqrt(theta123)') E4= a*theta123^(1/2) E5=sym('a*sqrt(theta*t)') E5= a*(t*theta)(1/2) 2
2 a5/3 - (v*z)/3 - (u*sin(3)*z^2)/3 (4) result_2=solve(Eq,z) result_2 = -(v - (v^2 + 4*a5*u*sin(3) - 12*u*w*sin(3))^(1/2))/(2*u*sin(3)) -(v + (v^2 + 4*a5*u*sin(3) - 12*u*w*sin(3))^(1/2))/(2*u*sin(3)) 【例 2.1-3】 (1) syms a b x X Y k=sym('3'); z=sym('c*sqrt(d)+y*sin(t)'); EXPR=a*z*X+(b*x^2+k)*Y; (2) symvar(EXPR) ans = [ X, Y, a, b, c, d, t, x, y] (3) symvar(EXPR,10) ans = [ x, y, t, d, c, b, a, X, Y] (4) symvar(EXPR,1) ans = x (5) symvar(EXPR,3) ans = [ x, y, t] (6) E3=sym('a*sqrt(theta)') ??? Error using ==> sym.sym>sym.sym/scalarsym at 382 Error: argument must be of 'Type::Arithmetical' [sqrt] Error in ==> sym.sym>sym.sym/char2sym at 337 Scell = scalarsym(x); Error in ==> sym.sym>sym.sym/symchar at 182 Scell = char2sym(x); Error in ==> sym.sym>sym.sym at 120 S = cell2sym(S,symchar(x,a,nargin)); E4=sym('a*sqrt(theta123)') E4 = a*theta123^(1/2) E5=sym('a*sqrt(theta*t)') E5 = a*(t*theta)^(1/2)
【例2.1-4】 syms a b t u v x y A=[a+b*x,sin(t)+u;x*exp(-t),log(y)+v] symvar(A,1) A= a b*x,u+sin(t)] x/exp(t),v log(y)] ans 2.1.2 符号计算中的算符 2.1.3 符号计算中的函数指令 2.1.4 符号对象的识别 【例2.1-5】。 (1) clear a=1;b=2;c=3;d=4: Mn=[a,b;c,d] Mc='[a,bic,d] Ms=sym(Mc) Mn 2 3 Mc [a,b;c,d] Ms [a,b] [c,d] (2) SizeMn=size (Mn) sizeMc=size (Mc) SizeMs=size(Ms) SizeMn 2 2 SizeMc 1 9 SizeMs 2 (3) CMn=class (Mn) CMc=class (Mc) CMs=class (Ms) CMn double CMc char CMs sym (4) isa (Mn,'double') isa (Mc,'char')
3 【例 2.1-4】 syms a b t u v x y A=[a+b*x,sin(t)+u;x*exp(-t),log(y)+v] symvar(A,1) A = [ a + b*x, u + sin(t)] [ x/exp(t), v + log(y)] ans = x 2.1.2 符号计算中的算符 2.1.3 符号计算中的函数指令 2.1.4 符号对象的识别 【例 2.1-5】。 (1) clear a=1;b=2;c=3;d=4; Mn=[a,b;c,d] Mc='[a,b;c,d]' Ms=sym(Mc) Mn = 1 2 3 4 Mc = [a,b;c,d] Ms = [ a, b] [ c, d] (2) SizeMn=size(Mn) SizeMc=size(Mc) SizeMs=size(Ms) SizeMn = 2 2 SizeMc = 1 9 SizeMs = 2 2 (3) CMn=class(Mn) CMc=class(Mc) CMs=class(Ms) CMn = double CMc = char CMs = sym (4) isa(Mn,'double') isa(Mc,'char')
isa (Ms,'sym') ans 1 ans 1 ans 1 (5) whos Mn Me Ms Name size Bytes Class Attributes Mc 1x9 18 char Mn 2X2 32 double Ms 2x2 60 sym 2.1.5 符号运算机理和变量假设 1 符号运算的工作机理 2 对符号变量的限定性假设 3 清除变量和撤销假设 【例2.1-6】 (1) syms x clear f=x^3+4.75*×+2.5: rf=solve(f,x) rf -1/2 1/4-(79^(1/2)*1)/4 (79^(1/2)*1)/4+1/4 evalin(symengine,'getprop(x)') ans c (2) syms x real rfr=solve(f,x) rfr -1/2 evalin(symengine,'getprop(x)') s R (3) clear x syms x g=x2+x+5: rg=solve(g,x) Warning:Explicit solution could not be found. In solve at 98 rg empty sym
4 isa(Ms,'sym') ans = 1 ans = 1 ans = 1 (5) whos Mn Mc Ms Name Size Bytes Class Attributes Mc 1x9 18 char Mn 2x2 32 double Ms 2x2 60 sym 2.1.5 符号运算机理和变量假设 1 符号运算的工作机理 2 对符号变量的限定性假设 3 清除变量和撤销假设 【例 2.1-6】 (1) syms x clear f=x^3+4.75*x+2.5; rf=solve(f,x) rf = -1/2 1/4 - (79^(1/2)*i)/4 (79^(1/2)*i)/4 + 1/4 evalin(symengine,'getprop(x)') ans = C_ (2) syms x real rfr=solve(f,x) rfr = -1/2 evalin(symengine,'getprop(x)') ans = R_ (3) clear x syms x g=x^2+x+5; rg=solve(g,x) Warning: Explicit solution could not be found. > In solve at 98 rg = [ empty sym ]
(4) syms x clear rg=solve(g,x) rg (19^(1/2)*i)/2-1/2 (19^(1/2)*1)/2-1/2 【例2.1-7】 (1) clear all reset (symengine) Da=1.2;Dw=1/3: syms sa sw sx sy sz syms A B positive syms c real (2) whos Name Size Bytes Class Attributes A 1x1 58 sym 1x1 58 sym Q 1×1 58 sym Da 1x1 8 double Dw 1x1 8 double sa 1x1 60 sym Sw 1×1 60 sym 1x1 60 sym sy 1x1 60 sym 1x1 60 sym (3) syms IA BI ICI 'sa 'sy' (4) evalin(symengine,'anames(Properties)') ans (A,B,C) (5) clear A syms BI 'ans 'sa 'sy' evalin(symengine,'anames(Properties)') ans (A,B,C) (6) syms B clear syms B 'ans' sa 5
5 (4) syms x clear rg=solve(g,x) rg = - (19^(1/2)*i)/2 - 1/2 (19^(1/2)*i)/2 - 1/2 【例 2.1-7】 (1) clear all reset(symengine) Da=1.2;Dw=1/3; syms sa sw sx sy sz syms A B positive syms C real (2) whos Name Size Bytes Class Attributes A 1x1 58 sym B 1x1 58 sym C 1x1 58 sym Da 1x1 8 double Dw 1x1 8 double sa 1x1 60 sym sw 1x1 60 sym sx 1x1 60 sym sy 1x1 60 sym sz 1x1 60 sym (3) syms 'A' 'B' 'C' 'sa' 'sw' 'sx' 'sy' 'sz' (4) evalin(symengine,'anames(Properties)') ans = {A, B, C} (5) clear A syms 'B' 'C' 'ans' 'sa' 'sw' 'sx' 'sy' 'sz' evalin(symengine,'anames(Properties)') ans = {A, B, C} (6) syms B clear syms 'B' 'C' 'ans' 'sa' 'sw' 'sx' 'sy' 'sz
evalin(symengine,'anames(Properties)') ans {A,C} 2.1.6 符号帮助体系 【例2.1-8】 (1) ⑦e1p ▣x File Edit View Go Favorites Desktop Window Help laplace ×, fx<laplace Contents Search Results Type Relevance Product laplace fx laplace (sym)-Laplace transform Laplace transform L=laplace F)is the Laplace transform of the scalar svmbol F Syntax Symbolic Math Toolbox The Laplace and Inverse Lap... laplace(F) The Laplace transform of a laplace(F,t) function f(t)is...while the Symbolic Math Toolbox laplace(F,w,z) fx Integral and Z-Transforms Inverse Laplace transform.. Description laplace... LaDlace transform Symbolic Math Toolbox L laplace(F)is the Laplace fx ilaplace (sym)-Inverse Lapla. transform of the scalar symbol F=ilaplace (L)is the inverse with default independent variable Laplace transform of the scalar t.The default return is a function of Symbolic Math Toolbox s.The Laplace transform is Modeling a High-Speed Backp... applied to a function of t and Search Online Support for laplace 4 图2.1-1 (2) 6
6 evalin(symengine,'anames(Properties)') ans = {A, C} 2.1.6 符号帮助体系 【例 2.1-8】 (1) 图 2.1-1 (2)