东北大学Matlab实验课作业

更新时间:2023-09-28 20:15:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

第一部分

第2题

>>A=[1 2 3 4;4 3 2 1;2 3 4 1;3 2 4 1]

A =

1 2 3 4 4 3 2 1 2 3 4 1 3 2 4 1 >> B=[1+4i 2+3i 3+2i 4+1i; 4+i 3+2i 2+3i 1+4i; 2+3i 3+2i 4+1i 1+4i;

3+2i 2+3i 4+1i 1+4i;] B =

1.0000 + 4.0000i 2.0000 + 3.0000i 4.0000 + 1.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i 3.0000 + 2.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i >> A(5,6)=5 A =

1 2 3 4 0 0 4 3 2 1 0 0 2 3 4 1 0 0 3 2 4 1 0 0 0 0 0 0 0 5 第3题

>> A=magic(8)

A =

64 2 3 61 60 6 9 55 54 12 13 51 17 47 46 20 21 43 40 26 27 37 36 30 32 34 35 29 28 38 41 23 22 44 45 19 49 15 14 52 53 11 8 58 59 5 4 62

>> B=A(2:2:end,:)

3.0000 + 2.0000i 2.0000 + 3.0000i 4.0000 + 1.0000i 4.0000 + 1.0000i 7 57 50 16 42 24 31 33 39 25 18 48 10 56 63 1 4.0000 + 1.0000i 1.0000 + 4.0000i 1.0000 + 4.0000i 1.0000 + 4.0000i B =

9 55 54 12 13 51 50 16 40 26 27 37 36 30 31 33 41 23 22 44 45 19 18 48 8 58 59 5 4 62 63 1 第4题.

>> format long; >> sum(2.^[0:63])

ans =

1.844674407370955e+019

>> syms k;

>> symsum(2^k,k,0,200)

ans =

3213876088517980551083924184682325205044405987565585670602751

第5题.

(1) >> syms t;

>> t=[-1:0.01:1]; >> f=sin(1./t); >> plot(t,f)

(2) >> syms t;

t=[-pi:0.01:pi];

f=sin(tan (t))-tan(sin (t)); >> plot(t,f)

第6题.

>>syms x y;

>> [x,y]=meshgrid(-5:0.2:5,-5:0.2:5);

>>z=1./sqrt((1-x).^2+y.^2)+1./sqrt((1+x).^2+y.^2); >> subplot(221),surf(x,y,z)

>> subplot(222),surf(x,y,z),view(0,0) >> subplot(223),surf(x,y,z),view(90,0) >> subplot(224),surf(x,y,z),view(0,90)

第7题.

>> syms x;

>> f=(3^x+9^x)^(1./x); >> L=limit(f,x,inf)

L =

9

>> syms x y ;

>> f=(x*y)/(((x*y)+1)^(1/2)-1); >> L=limit(limit(f,x,0),y,0)

L =

2

>> syms x y;

>>z=(1-cos(x^2+y^2))./((x^2+y^2)*exp(x^2+y^2)); >> L=limit(limit(z,x,0),y,0)

L =

0 第8题.

首先定义函数

function reasult=paradiff(y,x,t,n)

if mod(n,1)~=0,error('should positive integer,please correct') else if n==1,reasult=diff(y,t)/diff(x,t);

else reasult=diff(paradiff(y,x,t,n-1)/diff(x,t)); end, end

调用函数进行计算: >>syms t;

y=log(cos(t)); x=cos(t)-t*sin(t);

f=simple(paradiff(y,x,t,1)) f =

sin(t)/(cos(t)*(2*sin(t) + t*cos(t)))

m=simple(paradiff(y,x,t,3)),t=pi/3 m =

(36*t*cos(t)^5 - 69*t*cos(t)^3 + 18*t*cos(t) + sin(t)*(cos(t)^2*(15*t^2 cos(t)^4*(6*t^2 - 56) + 8))/(cos(t)^3*(2*sin(t) + t*cos(t))^5)

t =

1.0472

第9题 .

>> syms x t y;

>> I=int(exp(-t^2),t,0,x*y);

>> m=x/y*diff(diff(I,x),x)-2*diff(diff(I,x),y)+diff(diff(I,y),y) m =

2*x^2*y^2*exp(-x^2*y^2) - 2*x^3*y*exp(-x^2*y^2) - 2*exp(-x^2*y^2) 第10题.

(1) >> syms n;

>> f=symsum(1/((2*n)^2-1),n,1,inf)

f =

1/2

(2) >> syms n k;

>> f=simple(limit(symsum(n*(1/(n^2+k*pi)),k,1,n),n,inf)) f = 1

第11题.

(1)>>syms t;

>> syms a positive;

- 22) - >> x=a*(cos(t)+t*sin(t)); >> y=a*(sin(t)-t*cos(t));

>> I=int((x^2+y^2)*sqrt(diff(x,t)^2+diff(y,t)^2),t,0,2*pi)

I =

2*pi^2*a^3*(2*pi^2 + 1) (2) >> syms a b c theta;

>>x=a*cos(theta)/c; >>y=b*sin(theta)/c;

>> F=[y*x^3+exp(y),x*y^3+x*exp(y)-2*y]; >>ds=[diff(x,theta);diff(y,theta)]; >>I=int(F*ds,theta,0,pi/2)

I =

-(2*a^4*b - 2*a*b^4 + 15*a*c^4 + 15*b^2*c^3)/(15*c^5)

第12题.

>> syms a b c d e; >> c=[a b c d e]; >> V=vander(c)

V =

[ a^4, a^3, a^2, a, 1] [ b^4, b^3, b^2, b, 1] [ c^4, c^3, c^2, c, 1] [ d^4, d^3, d^2, d, 1] [ e^4, e^3, e^2, e, 1] >> S=simple(det(V)) S =

(a - b)*(a - c)*(a - d)*(b - c)*(a - e)*(b - d)*(b - e)*(c - d)*(c - e)*(d - e) 第13题.

>> 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(A) V =

0 0.50000000000000 0.50000000000000 -0.25000000000000 0 0 0.50000000000000 1.00000000000000 0.25000000000000 0.50000000000000 0.50000000000000 -0.25000000000000 0.25000000000000 0.50000000000000 1.00000000000000 -0.25000000000000

J =

-4 0 0 0 0 -2 1 0 0 0 -2 1 0 0 0 -2 第14题.

定义函数脚本:

function X=lyapsym(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(A,B,C),norm(A*X+B*X+C)

X =

-4.0569 -14.5128 1.5653 0.0356 25.0743 -2.7408 9.4886 25.9323 -4.4177 2.6969 21.6450 -2.8851

7.7229 31.9100 -3.7634 ans =

3.4356e-13 验证:

>> x=lyapsym(sym(A),B,C),norm(A*x+x*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]

ans = 0 第15题.

>> syms t;

>> 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];

>> A0=exp(A*t),A1=sin(A*t),A2=(exp(A*t))*sin(A^2*t*exp(A*t)) A0 =

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

[ 1, exp(-t), exp(-t), exp(-3*t)] A1 =

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

[ sin((3*t)/2), sin(t), -sin((5*t)/2), sin((3*t)/2)]

[ 0, -sin(t), -sin(t), -sin(3*t)] A2 =

[ sin(5*t + 17*t*exp(-t/2) - 3*t*exp((3*t)/2) + 5*t*exp(-(9*t)/2)) + exp(-(3*t)/2)*sin(8*t + 6*t*exp(-t/2) + 5*t*exp((3*t)/2) - t*exp(-(9*t)/2)) - exp(t/2)*sin(11*t + 8*t*exp(-t/2) - 6*t*exp((3*t)/2) + 11*t*exp(-(9*t)/2)) + exp(-(9*t)/2)*sin(12*t + 2*t*exp(-t/2) - 2*t*exp((3*t)/2) + 21*t*exp(-(9*t)/2)), sin(5*t + 5*t*exp(-t) + 17*t*exp(-4*t) - 3*t*exp(t)) - exp(t/2)*sin(11*t + 11*t*exp(-t) + 8*t*exp(-4*t) - 6*t*exp(t)) + exp(-(9*t)/2)*sin(21*t + 12*t*exp(-t) + 2*t*exp(-4*t) - 2*t*exp(t)) - sin(t - 8*t*exp(-t) - 6*t*exp(-4*t) - 5*t*exp(t))*exp(-(3*t)/2), sin(5*t*exp(-t) + 22*t*exp(t/2) - 3*t*exp(-(5*t)/2)) + exp(-(3*t)/2)*sin(8*t*exp(-t) + 5*t*exp(t/2) + 5*t*exp(-(5*t)/2)) - exp(t/2)*sin(11*t*exp(-t) + 19*t*exp(t/2) - 6*t*exp(-(5*t)/2)) - exp(-(9*t)/2)*sin(2*t*exp(-(5*t)/2) - 23*t*exp(t/2) - 12*t*exp(-t)), sin(5*t*exp(-3*t) + 17*t*exp(-t/2) + 5*t*exp(-(3*t)/2) - 3*t*exp((3*t)/2)) - sin(t*exp(-(3*t)/2) - 6*t*exp(-t/2) - 8*t*exp(-3*t) - 5*t*exp((3*t)/2))*exp(-(3*t)/2) - sin(11*t*exp(-3*t) + 8*t*exp(-t/2) + 11*t*exp(-(3*t)/2) - 6*t*exp((3*t)/2))*exp(t/2) + sin(12*t*exp(-3*t) + 2*t*exp(-t/2) + 21*t*exp(-(3*t)/2) - 2*t*exp((3*t)/2))*exp(-(9*t)/2)]

[ exp(-t/2)*sin(8*t + 6*t*exp(-t/2) + 5*t*exp((3*t)/2) - t*exp(-(9*t)/2)) + exp(-4*t)*sin(5*t + 17*t*exp(-t/2) - 3*t*exp((3*t)/2) + 5*t*exp(-(9*t)/2)) - exp(t/2)*sin(11*t + 8*t*exp(-t/2) - 6*t*exp((3*t)/2) + 11*t*exp(-(9*t)/2)) + exp(-t/2)*sin(12*t + 2*t*exp(-t/2) - 2*t*exp((3*t)/2) + 21*t*exp(-(9*t)/2)), exp(-4*t)*sin(5*t + 5*t*exp(-t) + 17*t*exp(-4*t) - 3*t*exp(t)) - exp(t/2)*sin(11*t + 11*t*exp(-t) + 8*t*exp(-4*t) - 6*t*exp(t)) + exp(-t/2)*sin(21*t + 12*t*exp(-t) + 2*t*exp(-4*t) - 2*t*exp(t)) - sin(t - 8*t*exp(-t) - 6*t*exp(-4*t) - 5*t*exp(t))*exp(-t/2), exp(-t/2)*sin(8*t*exp(-t) + 5*t*exp(t/2) + 5*t*exp(-(5*t)/2)) + exp(-4*t)*sin(5*t*exp(-t) + 22*t*exp(t/2) - 3*t*exp(-(5*t)/2)) - exp(t/2)*sin(11*t*exp(-t) +

19*t*exp(t/2) - 6*t*exp(-(5*t)/2)) - exp(-t/2)*sin(2*t*exp(-(5*t)/2) - 23*t*exp(t/2) - 12*t*exp(-t)), sin(5*t*exp(-3*t) + 17*t*exp(-t/2) + 5*t*exp(-(3*t)/2) - 3*t*exp((3*t)/2))*exp(-4*t) - sin(t*exp(-(3*t)/2) - 6*t*exp(-t/2) - 8*t*exp(-3*t) - 5*t*exp((3*t)/2))*exp(-t/2) - sin(11*t*exp(-3*t) + 8*t*exp(-t/2) + 11*t*exp(-(3*t)/2) - 6*t*exp((3*t)/2))*exp(t/2) + sin(12*t*exp(-3*t) + 2*t*exp(-t/2) + 21*t*exp(-(3*t)/2) - 2*t*exp((3*t)/2))*exp(-t/2)]

[ exp(t)*sin(5*t + 17*t*exp(-t/2) - 3*t*exp((3*t)/2) + 5*t*exp(-(9*t)/2)) + exp((3*t)/2)*sin(8*t + 6*t*exp(-t/2) + 5*t*exp((3*t)/2) - t*exp(-(9*t)/2)) + exp((3*t)/2)*sin(12*t + 2*t*exp(-t/2) - 2*t*exp((3*t)/2) + 21*t*exp(-(9*t)/2)) - exp(-(5*t)/2)*sin(11*t + 8*t*exp(-t/2) - 6*t*exp((3*t)/2) + 11*t*exp(-(9*t)/2)), exp((3*t)/2)*sin(21*t + 12*t*exp(-t) + 2*t*exp(-4*t) - 2*t*exp(t)) - exp(-(5*t)/2)*sin(11*t + 11*t*exp(-t) + 8*t*exp(-4*t) - 6*t*exp(t)) - sin(t - 8*t*exp(-t) - 6*t*exp(-4*t) - 5*t*exp(t))*exp((3*t)/2) + exp(t)*sin(5*t + 5*t*exp(-t) + 17*t*exp(-4*t) - 3*t*exp(t)), exp(t)*sin(5*t*exp(-t) + 22*t*exp(t/2) - 3*t*exp(-(5*t)/2)) + exp((3*t)/2)*sin(8*t*exp(-t) + 5*t*exp(t/2) + 5*t*exp(-(5*t)/2)) - exp((3*t)/2)*sin(2*t*exp(-(5*t)/2) - 23*t*exp(t/2) - 12*t*exp(-t)) - exp(-(5*t)/2)*sin(11*t*exp(-t) + 19*t*exp(t/2) - 6*t*exp(-(5*t)/2)), sin(5*t*exp(-3*t) + 17*t*exp(-t/2) + 5*t*exp(-(3*t)/2) - 3*t*exp((3*t)/2))*exp(t) - sin(t*exp(-(3*t)/2) - 6*t*exp(-t/2) - 8*t*exp(-3*t) -

5*t*exp((3*t)/2))*exp((3*t)/2) + sin(12*t*exp(-3*t) + 2*t*exp(-t/2) + 21*t*exp(-(3*t)/2) - 2*t*exp((3*t)/2))*exp((3*t)/2) - sin(11*t*exp(-3*t) + 8*t*exp(-t/2) + 11*t*exp(-(3*t)/2) - 6*t*exp((3*t)/2))*exp(-(5*t)/2)]

[ sin(12*t + 2*t*exp(-t/2) - 2*t*exp((3*t)/2) + 21*t*exp(-(9*t)/2)) + exp(-3*t)*sin(8*t + 6*t*exp(-t/2) + 5*t*exp((3*t)/2) - t*exp(-(9*t)/2)) + exp(-t)*sin(5*t + 17*t*exp(-t/2) - 3*t*exp((3*t)/2) + 5*t*exp(-(9*t)/2)) - exp(-t)*sin(11*t + 8*t*exp(-t/2) - 6*t*exp((3*t)/2) + 11*t*exp(-(9*t)/2)), sin(21*t + 12*t*exp(-t) + 2*t*exp(-4*t) - 2*t*exp(t)) + exp(-t)*sin(5*t + 5*t*exp(-t) + 17*t*exp(-4*t) - 3*t*exp(t)) - exp(-t)*sin(11*t + 11*t*exp(-t) + 8*t*exp(-4*t) - 6*t*exp(t)) - sin(t - 8*t*exp(-t) - 6*t*exp(-4*t) - 5*t*exp(t))*exp(-3*t), exp(-3*t)*sin(8*t*exp(-t) + 5*t*exp(t/2) + 5*t*exp(-(5*t)/2)) - sin(2*t*exp(-(5*t)/2) - 23*t*exp(t/2) - 12*t*exp(-t)) + exp(-t)*sin(5*t*exp(-t)

+ 22*t*exp(t/2) - 3*t*exp(-(5*t)/2)) - exp(-t)*sin(11*t*exp(-t) + 19*t*exp(t/2) - 6*t*exp(-(5*t)/2)), sin(12*t*exp(-3*t) + 2*t*exp(-t/2) + 21*t*exp(-(3*t)/2) - 2*t*exp((3*t)/2)) - sin(t*exp(-(3*t)/2) - 6*t*exp(-t/2) - 8*t*exp(-3*t) - 5*t*exp((3*t)/2))*exp(-3*t) + sin(5*t*exp(-3*t) + 17*t*exp(-t/2) + 5*t*exp(-(3*t)/2) - 3*t*exp((3*t)/2))*exp(-t) - sin(11*t*exp(-3*t) + 8*t*exp(-t/2) + 11*t*exp(-(3*t)/2) - 6*t*exp((3*t)/2))*exp(-t)]

第二部分

第1题 >> syms a t; >> f=(sin(a*t))/t; >> F1=laplace(f) F1 =

atan(a/s)

>> f2=(t^5)*sin(a*t); >> F2=laplace(f2) F2 =

(720*a*s)/(a^2 + s^2)^4 - (3840*a*s^3)/(a^2 + s^2)^5 + (3840*a*s^5)/(a^2 + s^2)^6

>> f3=(t^8)*cos(a*t); >> F3=simple(laplace(f3)) F3 =

(40320*s*(9*a^8 - 84*a^6*s^2 + 126*a^4*s^4 - 36*a^2*s^6 + s^8))/(a^2 + s^2)^9 第2题 >> syms s a b;

f=1/(sqrt(s^2)*(s^2-a^2)*(s+b));

F=ilaplace(f) F =

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

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

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

>> F3=log((s-a)/(s-b)); >> f3=simple(ilaplace(F3)) f3 =

exp(b*t)/t - exp(a*t)/t

第3题 >> syms x;

f=x^2*(3*pi-2*abs(x)); F=fourier(f) f1=ifourier(F) F =

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

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

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

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

x^2*(2*pi-x)^2 第4题.

>> syms a k z T; >> f1=cos(a*k*T); >> F=ztrans(f1,k,z) F =

(z*(z - cos(T*a)))/(z^2 - 2*cos(T*a)*z + 1)

>> f=iztrans(F,z,k) f =

cos(T*a*k)

>> syms a k z T;

>> f2=(k*T)^2*exp(-a*k*T); >> F=ztrans(f2,k,z) F =

(T^2*z*exp(T*a)*(z*exp(T*a) + 1))/(z*exp(T*a) - 1)^3 >> f=simple(iztrans(F,z,k)) f =

T^2*k^2*exp(-T*a)^k

>> syms a k z T;

>> f3=(a*k*T-1+exp(-a*k*T))/a;

>> F=ztrans(f3,k,z) F =

(T*z)/(z - 1)^2 + z/(a*(z - exp(-T*a))) - z/(a*(z - 1)) >> f=simple(iztrans(F,z,k)) f =

T*k + (exp(-T*a)^k - 1)/a 第5题: >> syms x;

>> S=solve((exp(-(x+2)^2+pi/2))*sin(5*x+2)) S =

-2/5

>> (exp(-(S+2)^2+pi/2))*sin(5*S+2)

ans = 0

>> syms x y;

f=(x^2+y^2+x*y)*exp(-x^2-y^2-x*y);

x1=solve('(x^2+y^2+x*y)*exp(-x^2-y^2-x*y)','x') simple(subs(f,x,x1)) x1 =

(-1/2+1/2*i*3^(1/2))*y (-1/2-1/2*i*3^(1/2))*y ans = 0 0

6. >> syms c x;

>> f=@(c)[int((exp(x)-c*x)^2,x,0,1)]; >> ezplot(f,[-10,10]) >> c=fminsearch(f,0)

c =

3.0000

第7题

function [c,ceq] =opt_con1(x) ceq=[];

c=[x(1)*x(2)-x(1)-x(2)+1.5;-x(1)*x(2)-10]; end

f=@(x)exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1); x0=[1;1]; A=[1 1]; B=[0];

xm=[-10;-10]; xM=[10;10];

ff=optimset;ff.LargeScale='off';

ff.TolFun=1e-30;ff.TolX=1e-15;ff.TolCon=1e-20; Aeq=[]; Beq=[];

[x,f_opt,c,d]=fmincon(f,x0,A,B,Aeq,Beq,xm,xM,@opt_con1,ff) x =

1.1825 -1.7398

f_opt =

3.0608 c =

0 d =

iterations: 51 funcCount: 202 lssteplength: 2

stepsize: 3.6563e-07

algorithm: 'medium-scale: SQP, Quasi-Newton, line-search' firstorderopt: 4.0018e-06

constrviolation: 4.1671e-08 message: [1x142 char]

第8题

f=[-592,-381,-273,-55,-48,-37,-23]; Aeq=[]; Beq=[];

A=[3534,2356,1767,589,528,451,304]; B=[119567];

xm=[0;0;0;0;0;0;0];

xM=[Inf;Inf;Inf;Inf;Inf;Inf;Inf;]; ff=optimset;

ff.Tolx=1e-15;ff.TolFun=1e-20;TolCon=1e-20;ff.LargeScale='off'; [x,f_opt,key,c]=linprog(f,A,B,Aeq,Beq,xm,xM,[0;0;0;0;0;0;0],ff) x =

33.8333 0 0 0.0000 -0.0000 -0.0000 -0.0000

f_opt =

-2.0029e+04

key =

1 c =

iterations: 7

constrviolation: 3.5527e-15

algorithm: 'medium-scale: active-set' cgiterations: []

message: 'Optimization terminated.' firstorderopt: 2.4377e-12 第九题

y=dsolve('D2y-(2-1/x)*Dy+(1-1/x)*y=x^2*exp(-5*x)','x');

y=simple(y) y =

(exp(-5*x)*(30*x - 6*Ei(-6*x)*exp(6*x) + 36*x^2 + 1296*C2*exp(6*x) + 1296*C3*exp(6*x)*log(x) + 11))/1296

y=dsolve('D2y-(2-1/x)*Dy+(1-1/x)*y=x^2*exp(-5*x)','y(1)=pi,y(pi)=1','x'); y=simple(y) y =

(exp(-5*x)*(30*x - 77*exp(6*x - 6) + 1296*pi*exp(6*x - 1) - 6*Ei(-6*x)*exp(6*x) + 36*x^2 + 6*Ei(-6)*exp(6*x) + 11))/1296 - (exp(-5*x)*(11*exp(6*x - 6*pi)*log(x) - 1296*exp(6*x - pi)*log(x) - 77*exp(6*x - 6)*log(x) + 1296*pi*exp(6*x - 1)*log(x) + 36*pi^2*exp(6*x - 6*pi)*log(x) - 6*exp(6*x)*log(x)*Ei(-6*pi) + 6*Ei(-6)*exp(6*x)*log(x) + 30*pi*exp(6*x - 6*pi)*log(x)))/(1296*log(pi))

第10题

syms x t; u=t+1;

y=dsolve(['D2x+2*t*Dx+t^2*x=',char(u)]); y=simple(y) y =

C8*exp(-(t*(t - 2))/2) + C9*exp(-(t*(t + 2))/2) - (2^(1/2)*pi^(1/2)*erf(2^(1/2)*((t*i)/2 - i/2))*exp(-(t - 1)^2/2)*i)/2

(1)syms x y; u=x*exp(-x^2);

y=dsolve(['Dy+2*x*y=',char(u)]); y=simple(y) 结果: y =

(exp(-x^2)*(C11*exp(-2*t*x) + 1))/2

第11题

f=@(t,x)[-x(2)-x(3);x(1)+0.2*x(2);0.2+(x(1)-5.7)*x(3)]; t_final=100;x0=[0;0;0]; [t,x]=ode45(f,[0,t_final],x0); plot3(x(:,1),x(:,2),x(:,3)) figure;

plot3(x(:,1),x(:,2),x(:,3)),view(0,90);

第12题

f=@(t,x)[-x(2)-x(3);x(1)+0.2*x(2);0.5+(x(1)-10)*x(3)]; t_final=100;x0=[0;0;0]; [t,x]=ode45(f,[0,t_final],x0); plot(t,x) figure;

plot3(x(:,1),x(:,2),x(:,3))

f=@(t,x)[x(2);-x(1)-x(3)-9*x(2)^2+x(4)^3+6*x(5)+2*t;x(4);x(5);-x(5)-x(2)-exp(-x(1))-t]; t_final=100;x0=[2;4;-2;7;6]; [t,x]=ode45(f,[0,t_final],x0); plot(x(:,1),x(:,3))

第13题

仿真模型:

[t,x,y]=sim(‘untitled’,[0,10]);plot(t,x) figure;plot(t,y)

T-x T-y

第14题

t=0:0.2:2;

y=t.^2.*exp(-5.*t).*sin(t); t1=0:0.12:2;

y1=interp1(t,y,t1,'spline'); plot(t,y) figure; plot(t1,y1)

本文来源:https://www.bwwdw.com/article/0ojd.html

Top