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2*d+e^4*a^3*d^2*b-e^4*a^3*d^2*c-e^4*b^3*a^2*c+e^4*b^3*a^2*d+e^4*b^3*c^2*a-e^4*b^3*c^2*d-e^4*b^3*d^2*a+e^4*b^3*d^2*c+e^4*c^3*a^2*b-e^4*c^3*a^2*d-e^4*c^3*b^2*a+e^4*c^3*b^2*d+e^4*c^3*d^2*a-e^4*c^3*d^2*b-e^4*d^3*a^2*b+e^4*d^3*a^2*c+e^4*d^3*b^2*a-e^4*d^3*b^2*c-e^4*d^3*c^2*a+e^4*d^3*c^2*b ans =

(c-d)*(b-d)*(b-c)*(a-d)*(a-c)*(a-b)*(-d+e)*(e-c)*(e-b)*(e-a) >>

第十三题

>> A=[-2,0.5,-0.5,0.5;0,-1.5,0.5,-0.5;2,0.5,-4.5,0.5;2,1,-2,-2];[V J]=jordan(sym(A))

V =

[ 0, 1/2, 1/2, -1/4] [ 0, 0, 1/2, 1] [ 1/4, 1/2, 1/2, -1/4] [ 1/4, 1/2, 1, -1/4] J =

[ -4, 0, 0, 0] [ 0, -2, 1, 0] [ 0, 0, -2, 1] [ 0, 0, 0, -2] 第十四题 数值方法

>> A=[3,-6,-4,0,5;1,4,2,-2,4;-6,3,-6,7,3;-13,10,0,-11,0;0,4,0,3,4]; >> B=[3,-2,1;-2,9,2;-2,-1,9];

>> C=[-2,1,-1;4,1,2;5,-6,1;6,-4,-4;-6,6,-3]; >> X=lyap(A,B,C) X =

-2.3192 -0.4678 0.1505 -3.6284 0.1579 0.0629 5.4246 -1.0516 -0.5090 -0.5718 2.5848 -0.3649 3.0417 -0.6265 0.1580 >> norm(A*X+X*B+C)

ans =

3.8830e-014 解析方法 >> edit

function X=lyap(A,B,C) if nargin==2,C=B;B=A';end

[nr,nc]=size(C);A0=kron(A,eye(nc))+kron(eye(nr),B'); try

C1=C';x0=-inv(A0)*C1(:);X=reshape(x0,nc,nr)'; catch,error('singular matrix found.'),end

>> A=[3,-6,-4,0,5;1,4,2,-2,4;-6,3,-6,7,3;-13,10,0,-11,0;0,4,0,3,4]; >> B=[3,-2,1;-2,-9,2;-2,-1,9];

>> C=[-2,1,-1;4,1,2;5,-6,1;6,-4,-4;-6,6,-3];X=lyap(sym(A),B,C) X = [ -434641749950/107136516451, -4664546747350/321409549353, 503105815912/321409549353] [ 3809507498/107136516451, 8059112319373/321409549353, -880921527508/321409549353] [ 1016580400173/107136516451, 8334897743767/321409549353, -1419901706449/321409549353] [ 288938859984/107136516451, 6956912657222/321409549353, -927293592476/321409549353] [ 827401644798/107136516451, 10256166034813/321409549353, -1209595497577/321409549353]

>> A*X+X*B+C ans =

[ 0, 0, 0] [ 0, 0, 0] [ 0, 0, 0] [ 0, 0, 0] [ 0, 0, 0]

第十五题 (1)

>> A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3]; >> A=sym(A);syms t; >> expm(A*t) ans = [ 1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t^2*exp(-3*t), 1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t), 1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t),

1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t)]

[ 1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t), 1/2*exp(-3*t)+1/2*exp(-5*t), 1/2*t*exp(-3*t), 1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)]

[ 1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t), -1/2*exp(-5*t)+1/2*exp(-3*t),

exp(-3*t)+1/2*t*exp(-3*t), 1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)]

[ -1/2*t^2*exp(-3*t), -t*exp(-3*t), -1/2*t^2*exp(-3*t)-t*exp(-3*t), exp(-3*t)-1/2*t^2*exp(-3*t)] (2)

>> A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3]; >> A=sym(A);syms t; >> sin(A*t) ans =

[ -sin(9/2*t), 0, sin(1/2*t), -sin(3/2*t)] [ -sin(1/2*t), -sin(4*t), sin(1/2*t), -sin(1/2*t)] [ sin(3/2*t), sin(t), -sin(5/2*t), sin(3/2*t)] [ 0, -sin(t), -sin(t), -sin(3*t)] (3)

第二部分

第一题 (1)

>> syms a t;f=sin(a*t)/t;laplace(f) ans =

atan(a/s) (2)

>> syms t a;f=t^5*sin(a*t);laplace(f) ans =

60*i*(-1/(s-i*a)^6+1/(s+i*a)^6) (3)

>> syms t a;f=t^8*cos(a*t);laplace(f) ans =

20160/(s-i*a)^9+20160/(s+i*a)^9 第二题 (1)

>> syms s a b;F=1/(s^2*(s^2-a^2)*(a+b));ilaplace(F) ans =

1/(a+b)*(-1/a^2*t+1/a^3*sinh(a*t)) (2)

>> syms s a b;F=sqrt(s-a)-sqrt(s-b);ilaplace(F) ans =

1/2/t^(3/2)/pi^(1/2)*(exp(b*t)-exp(a*t)) (3)

>> syms s a b;F=log((s-a)/(s-b));ilaplace(F) ans =

1/t*(exp(b*t)-exp(a*t)) 第三题 (1)

>> syms x;f=x^2*(3*sym(pi)-2*abs(x));F=fourier(f) F =

-6*(4+pi^2*dirac(2,w)*w^4)/w^4

>> ifourier(F) ans =

x^2*(-4*x*heaviside(x)+3*pi+2*x) (2)

>> syms t;f=t^2*(t-2*sym(pi))^2;F=fourier(f) F =

2*pi*(-4*pi^2*dirac(2,w)+4*i*pi*dirac(3,w)+dirac(4,w))

>> ifourier(F) ans =

x^2*(-2*pi+x)^2 第四题 (1)

>> syms k a T;f=cos(k*a*T);F=ztrans(f) F =