MATLAB實驗報告_第1頁
MATLAB實驗報告_第2頁
MATLAB實驗報告_第3頁
MATLAB實驗報告_第4頁
MATLAB實驗報告_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、MATLAB語言與應(yīng)用實驗課程任務(wù)書第一部分MATLAB語言編程、科學(xué)繪圖與基本數(shù)學(xué)問題求解1、 用MATLAB語句輸入矩陣和 , 前面給出的是矩陣,如果給出命令將得出什么結(jié)果?>> A=1,2,3,4;4,3,2,1;2,3,4,1;3,2,4,1B=1+4j,2+3j,3+2j,4+1j;4+1j,3+2j,2+3j,1+4j;2+3j,3+2j,4+1j,1+4j;3+2j,2+3j,4+1j,1+4jA(6,5)=5A = 1 2 3 4 4 3 2 1 2 3 4 1 3 2 4 1B = 1.0000 + 4.0000i 2.0000 + 3.0000i 3.0000

2、+ 2.0000i 4.0000 + 1.0000i 4.0000 + 1.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i 1.0000 + 4.0000i 2.0000 + 3.0000i 3.0000 + 2.0000i 4.0000 + 1.0000i 1.0000 + 4.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i 4.0000 + 1.0000i 1.0000 + 4.0000iA = 1 2 3 4 0 4 3 2 1 0 2 3 4 1 0 3 2 4 1 0 0 0 0 0 0 0 0 0 0 52、 假設(shè)已知

3、矩陣,試給出相應(yīng)的MATLAB命令,將其全部偶數(shù)行提取出來,賦給矩陣,用命令生成矩陣,用上述命令檢驗一下結(jié)果是不是正確。>> A=magic(8)B=A(2:2:end, :)A = 64 2 3 61 60 6 7 57 9 55 54 12 13 51 50 16 17 47 46 20 21 43 42 24 40 26 27 37 36 30 31 33 32 34 35 29 28 38 39 25 41 23 22 44 45 19 18 48 49 15 14 52 53 11 10 56 8 58 59 5 4 62 63 1B = 9 55 54 12 13 51

4、 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 13、 用數(shù)值方法可以求出,試不采用循環(huán)的形式求出和式的數(shù)值解。由于數(shù)值方法是采用double形式進行計算的,難以保證有效位數(shù)字,所以結(jié)果不一定精確。試采用運算的方法求該和式的精確值。>> sum(sym(2).0:63) ans =4、 選擇合適的步距繪制出下面的圖形。(1),其中; >> t=-1:0.005:-0.001,0.001:0.005:1;y=sin(1./t);plot(t,y)(2),其中。>>

5、 t=-pi:0.05:-1.8,-1.799:0.001:-1.2,-1.2:0.05:1.2,1.201:0.001:1.8,1.81:0.05:pi;y=sin(tan(t)-tan(sin(t);plot(t,y)5、 試繪制出二元函數(shù)的三維圖和三視圖。>>xx=-2:.1:-1.2,-1.1:0.02:-0.9,-0.8:0.1:0.8,0.9:0.02:1.1,1.2:0.1:2;yy=-1:0.1:-0.2,-0.1:0.02:0.1,0.2:0.1:1;x,y=meshgrid(xx,yy);z=1./(sqrt(1-x).2+y.2)+1./(sqrt(1+x).

6、2+y.2);surf(x,y,z),shading flat;figure;zlim(0,15)subplot(221),surf(x,y,z),view(0,90);subplot(222),surf(x,y,z),view(90,0);subplot(223),surf(x,y,z),view(0,0);6、 試求出如下極限。(1); >> syms x;f=(3x+9x)(1/x);L=limit(f,x,inf) L = 9(2); >> syms x y;f=x*y/(sqrt(x*y+1)-1);L=limit(limit(f,x,0),y,0) L =

7、2(3)。>> syms x y;f=(1-cos(x2+y2)/(x2+y2)*exp(x2+y2);L=limit(limit(f,x,0),y,0) L = 07、 已知參數(shù)方程,試求出和。>> syms t;x=log(cos(t);y=cos(t)-t*sin(t);f1=diff(y,t)/diff(x,t)f2=diff(f1,t)subs(f2,t,pi/3) f1 = -(-2*sin(t)-t*cos(t)/sin(t)*cos(t) f2 = -(-3*cos(t)+t*sin(t)/sin(t)*cos(t)+(-2*sin(t)-t*cos(t

8、)/sin(t)2*cos(t)2-2*sin(t)-t*cos(t) ans = -2.66518、 假設(shè),試求。>> syms x y t;f=exp(-t2);I=simple(int(f,t,0,x*y)F=(x/y)*(diff(diff(I,x),x)-2*(diff(diff(I,x),y)+diff(diff(I,y),y) I = 1/2*pi(1/2)*erf(x*y)F =2*x2*y2*exp(-x2*y2)-2*exp(-x2*y2)-2*x3*y*exp(-x2*y2)9、 試求出下面的極限。 (1);>> syms n;limit(syms

9、um(1/(2*n)2-1),n,inf) ans = 0(2)。>> syms n;limit(symsum(n/(n2+n*pi),n,inf)ans = Inf10、 試求出以下的曲線積分。 (1),為曲線,。>> syms t a;x=a*(cos(t)+t*sin(t);y=a*(sin(t)-t*cos(t);I=int(x2+y2,t,0,2*pi) I = 8/3*a2*pi3+2*a2*pi (2),其中為正向上半橢圓。>> syms a b c t;F=y*x3+exp(y),x*y3+x*exp(y)-2*y;ds=diff(x,t);

10、diff(y,t);I=simple(int(F*ds,t,2*pi,0) I=4*a2*pi2+712/27*a5*pi3-3254/81*a5*pi-1120/27*a5*pi2-64/15*a5*pi5+112/9*a5*pi4-a/exp(pi*a)2+a11、 試求出Vandermonde矩陣的行列式,并以最簡的形式顯示結(jié)果。>> syms a b c d e;A=a4,a3,a2,a,1;b4,b3,b2,b,1;c4,c3,c2,c,1;d4,d3,d2,d,1;e4,e3,e2,e,1;simple(det(A)ans =(c-d)*(b-d)*(b-c)*(a-d

11、)*(a-c)*(a-b)*(-d+e)*(e-c)*(e-b)*(e-a)12、 試對矩陣進行Jordan變換,并得出變換矩陣。>> 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;J=jordan(A)J = -4 0 0 0 0 -2 1 0 0 0 -2 1 0 0 0 -213、 試用數(shù)值方法和解析方法求取下面的Sylvester方程,并驗證得出的結(jié)果。先編寫出Sylvester型方程的解析解求解程序lyap.m,置于sym目錄下:function X=lyap(A,B,C)if nargin=2,C=

12、B;B=A'endnr,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,

13、6,-3;X=lyap(A,B,C),norm(A*X+X*B+C)Y=lyap(sym(A),B,C),norm(double(A*X+X*B+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.7634ans = 2.7059e-013Y = ans = 014、 假設(shè)已知矩陣如下,試求出,。>> syms t;A=-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-

14、2.5,1.5;0,-1,-1,-3;B=simple(expm(A*t)C=simple(sin(A*t)D=simple(expm(A*t)*sin(A2*expm(A*t)*t) B =1/2/exp(t)3-1/2*t/exp(t)3+1/2/exp(t)5+1/2*t2/exp(t)3,1/2/exp(t)5-1/2/exp(t)3+t/exp(t)3,1/2*t/exp(t)3+1/2*t2/exp(t)3, 1/2/exp(t)5-1/2/exp(t)3-1/2*t/exp(t)3+1/2*t2/exp(t)31/2*t/exp(t)3+1/2/exp(t)5-1/2/exp(t

15、)3,1/2/exp(t)3+1/2/exp(t)5,1/2*t/exp(t)3,1/2*t/exp(t)3+1/2/exp(t)5-1/2/exp(t)31/2*t/exp(t)3-1/2/exp(t)5+1/2/exp(t)3,-1/2/exp(t)5+1/2/exp(t)3,1/exp(t)3+1/2*t/exp(t)3,1/2*t/exp(t)3-1/2/exp(t)5+1/2/exp(t)3-1/2*t2/exp(t)3,-t/exp(t)3,-1/2*t2/exp(t)3-t/exp(t)3, 1/exp(t)3-1/2*t2/exp(t)3C = -sin(9/2*t), 0,

16、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)D = (1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t2*exp(-3*t)*sin(t*(17/2*exp(-3*t)-21/2*t*exp(-3*t)+25/2*exp(-5*t)+9/2*t2*exp(-3*t)+(1/2*exp(-5*t)-1/

17、2*exp(-3*t)+t*exp(-3*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+(1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(-exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t),(1/2*exp(-3*t)-1/2*t*exp(

18、-3*t)+1/2*exp(-5*t)+1/2*t2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-21/2*exp(-3*t)+9*t*exp(-3*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t)*sin(t*(25/2*exp(-5*t)+9/2*exp(-3*t)+(1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(-25/2*exp(-5*t)+9/2*exp(-3*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*si

19、n(t*(6*exp(-3*t)-9*t*exp(-3*t),(1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t2*exp(-3*t)*sin(t*(-3/2*t*exp(-3*t)+9/2*t2*exp(-3*t)-2*exp(-3*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)-3*exp(-3*t)+(1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)+6*exp(-3*t)+(1/2*exp(

20、-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(-3*t*exp(-3*t)-9/2*t2*exp(-3*t)+5*exp(-3*t),(1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-1/2*exp(-3*t)-21/2*t*exp(-3*t)+9/2*t2*exp(-3*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t)*sin(t*(-15/2*exp(-3*t)+

21、9/2*t*exp(-3*t)+25/2*exp(-5*t)+(1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t2*exp(-3*t)*sin(t*(8*exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t)(1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(17/2*exp(-3*t)-21/2*

22、t*exp(-3*t)+25/2*exp(-5*t)+9/2*t2*exp(-3*t)+(1/2*exp(-3*t)+1/2*exp(-5*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+1/2*t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(-exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t),(1/2*t*exp(

23、-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-21/2*exp(-3*t)+9*t*exp(-3*t)+(1/2*exp(-3*t)+1/2*exp(-5*t)*sin(t*(25/2*exp(-5*t)+9/2*exp(-3*t)+1/2*t*exp(-3*t)*sin(t*(-25/2*exp(-5*t)+9/2*exp(-3*t)+(1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(6*exp(-3*t)-9*t*exp(-3*t),(1/2*t*exp(-3*t)+1/

24、2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(-3/2*t*exp(-3*t)+9/2*t2*exp(-3*t)-2*exp(-3*t)+(1/2*exp(-3*t)+1/2*exp(-5*t)*sin(t*(9/2*t*exp(-3*t)-3*exp(-3*t)+1/2*t*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)+6*exp(-3*t)+(1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(-3*t*exp(-3*t)-9/2*t2*exp(-3*t)+5*exp(-3*t),(1/2*t*exp

25、(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-1/2*exp(-3*t)-21/2*t*exp(-3*t)+9/2*t2*exp(-3*t)+(1/2*exp(-3*t)+1/2*exp(-5*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+1/2*t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)

26、*sin(t*(8*exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t)(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(17/2*exp(-3*t)-21/2*t*exp(-3*t)+25/2*exp(-5*t)+9/2*t2*exp(-3*t)+(-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+(exp(-3*t)+1/2*t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/

27、2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(-exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t),(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-21/2*exp(-3*t)+9*t*exp(-3*t)+(-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(25/2*exp(-5*t)+9/2*exp(-3*t)+(exp(-3*t)+1/2*

28、t*exp(-3*t)*sin(t*(-25/2*exp(-5*t)+9/2*exp(-3*t)+(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(6*exp(-3*t)-9*t*exp(-3*t),(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(-3/2*t*exp(-3*t)+9/2*t2*exp(-3*t)-2*exp(-3*t)+(-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)-3*exp(-3*t)+(exp(-3*t)

29、+1/2*t*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)+6*exp(-3*t)+(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(-3*t*exp(-3*t)-9/2*t2*exp(-3*t)+5*exp(-3*t),(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-1/2*exp(-3*t)-21/2*t*exp(-3*t)+9/2*t2*exp(-3*t)+(-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(

30、-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+(exp(-3*t)+1/2*t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)*sin(t*(8*exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t)-1/2*t2*exp(-3*t)*sin(t*(17/2*exp(-3*t)-21/2*t*exp(-3*t)+25/2*exp(-5*t)+9/2*t2*e

31、xp(-3*t)-t*exp(-3*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+(-1/2*t2*exp(-3*t)-t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(exp(-3*t)-1/2*t2*exp(-3*t)*sin(t*(-exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t), -1/2*t2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-21/2*exp(-3*t)+9*t*exp(-

32、3*t)-t*exp(-3*t)*sin(t*(25/2*exp(-5*t)+9/2*exp(-3*t)+(-1/2*t2*exp(-3*t)-t*exp(-3*t)*sin(t*(-25/2*exp(-5*t)+9/2*exp(-3*t)+(exp(-3*t)-1/2*t2*exp(-3*t)*sin(t*(6*exp(-3*t)-9*t*exp(-3*t),-1/2*t2*exp(-3*t)*sin(t*(-3/2*t*exp(-3*t)+9/2*t2*exp(-3*t)-2*exp(-3*t)-t*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)-3*exp(-3*t)+

33、(-1/2*t2*exp(-3*t)-t*exp(-3*t)*sin(t*(9/2*t*exp(-3*t)+6*exp(-3*t)+(exp(-3*t)-1/2*t2*exp(-3*t)*sin(t*(-3*t*exp(-3*t)-9/2*t2*exp(-3*t)+5*exp(-3*t),-1/2*t2*exp(-3*t)*sin(t*(25/2*exp(-5*t)-1/2*exp(-3*t)-21/2*t*exp(-3*t)+9/2*t2*exp(-3*t)-t*exp(-3*t)*sin(t*(-15/2*exp(-3*t)+9/2*t*exp(-3*t)+25/2*exp(-5*t)+(

34、-1/2*t2*exp(-3*t)-t*exp(-3*t)*sin(t*(3/2*exp(-3*t)+9/2*t*exp(-3*t)-25/2*exp(-5*t)+(exp(-3*t)-1/2*t2*exp(-3*t)*sin(t*(8*exp(-3*t)+6*t*exp(-3*t)-9/2*t2*exp(-3*t)第二部分 數(shù)學(xué)問題求解與數(shù)據(jù)處理1、 對下列的函數(shù)進行Laplace變換。(1);>> syms t a;f=sin(a*t)/t;F=laplace(f) F =atan(a/s)(2);>> syms t a;f=t5*sin(a*t);F=laplac

35、e(f) F =120/(s2+a2)3*sin(6*atan(a/s)(3)。>> syms t a;f=t8*cos(a*t);F=laplace(f) F =40320/(s2+a2)(9/2)*cos(9*atan(a/s)2、 對下面的式進行Laplace反變換。(1);>> syms s a b;f=1/(sqrt(s2)*(s2-a2)*(s+b);F=ilaplace(f) F =-1/2/(a-b)/a2*exp(-a*t)+1/2/(a+b)/a2*exp(a*t)-1/a2/b+1/b/(a2-b2)*exp(-b*t)(2);>> s

36、yms 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)(3)。>> syms s a b;f=log(s-a)/(s-b);F=ilaplace(f) F =(exp(b*t)-exp(a*t)/t3、 試求出下面函數(shù)的Fourier變換,對得出的結(jié)果再進行Fourier反變換,觀察是否能得出原來函數(shù)。(1);>> syms x;f=x2*(3*pi-2*abs(x);F=fourier(f)f1=ifourier(F) F = -6*(4+pi2*dir

37、ac(2,w)*w4)/w4f1 =x2*(-4*x*heaviside(x)+3*pi+2*x)(2)。>> syms t;f=t2*(t-2*pi)2;F=fourier(f) f1=ifourier(F) F =2*pi*(-4*pi2*dirac(2,w)+4*i*pi*dirac(3,w)+dirac(4,w) f1 =x2*(2*pi-x)24、 請將下述時域序列函數(shù)進行Z變換,并對結(jié)果進行反變換檢驗。(1);>> syms a T k z;f=cos(k*a*T);F=ztrans(f,k,z)f1=iztrans(F,z,k) F = (z-cos(a*

38、T)*z/(z2-2*z*cos(a*T)+1)f1 =cos(k*a*T)(2);>> syms a T k z;f=(k*T)2*exp(-a*k*T);F=ztrans(f,k,z)f1=iztrans(F,z,k) F =-T2*z*exp(-a*T)*(z+exp(-a*T)/(-z+exp(-a*T)3f1 =T2*(1/exp(a*T)k*k2(3)。>> syms a T k z;f=(1/a)*(a*k*T-1+exp(-a*k*T);F=ztrans(f,k,z)f1=iztrans(F,z,k) F =1/a*(a*T*z/(z-1)2-z/(z-

39、1)+z/exp(-a*T)/(z/exp(-a*T)-1)f1 =(-1+k*a*T+(1/exp(a*T)k)/a5、 用數(shù)值求解函數(shù)求解下述一元和二元方程的根,并對得出的結(jié)果進行檢驗。(1);>> syms x;f=exp(-(x+1)2+pi/2)*sin(5*x+2);t=solve(f) t =-2/5 >> subs(f,x,-2/5)ans =0(2)。>> syms x y;f=(x2+y2+x*y)*exp(-x2-y2-x*y);y1=solve('(x2+y2+x*y)*exp(-x2-y2-x*y)','y&

40、#39;) y1 = (-1/2+1/2*i*3(1/2)*x (-1/2-1/2*i*3(1/2)*x>> simple(subs(f,y,y1)ans = 0 06、 試求出使得取得極小值的值。>> syms c x;f=(exp(x)-c*x)2;F=int(f,x,0,1) F =1/2*exp(1)2+1/3*c2-1/2-2*c>> D=diff(F,c) D =2/3*c-2>> solve(D) ans =37、 試求解下面的非線性規(guī)劃問題。 先編寫如下非線性約束函數(shù):function c,ceq=opt_con1(x)ceq=x

41、(1)+x(2);x(1)*x(2)-x(1)-x(2)+1.5;-x(1)*x(2)-10;c=;>> y=(x)exp(x(1)*(4*x(1)*x(1)+2*x(2)*x(2)+4*x(1)*x(2)+2*x(2)+1); ff=optimset;ff.TolFun=1e-30;ff.TolX=1e-20;A=;B=;Aeq=;Beq=;xm=-10;-10;xM=10;10;x0=(xm+xM)/2; x,f_opt,c,d=fmincon(y,x0,A,B,Aeq,Beq,xm,xM,opt_con1,ff)x = 0 0f_opt = 1c = -2d = iterat

42、ions: 1 funcCount: 6 stepsize: 2 algorithm: 'medium-scale: SQP, Quasi-Newton, line-search' firstorderopt: 2.0000 cgiterations: message: 1x143 char8、 求解下面的整數(shù)線性規(guī)劃問題。 MATLAB 7.*下無法用ipslv_mex()函數(shù)求解:>>f=-592 381 273 55 48 37 23'A=3534 2356 1767 589 528 451 304;B=119567;Ae=;Be=;xm=0,0,0,

43、0,0,0,0;ff=optimset;ff.LargeScale='off' ff.TolX=1e-15;ff.TolFun=1e-20;ff.TolCon=1e-20;x,f_opt,key,c=linprog(f,A,B,Ae,Be,xm,ff)x = 33.8333 0 0.0000 0.0000 -0.0000 -0.0000 0.0000f_opt =-2.0029e+004key = 1c = iterations: 7 algorithm: 'medium-scale: active-set' cgiterations: message: 

44、9;Optimization terminated.'9、 試求出微分方程的解析解通解,并求出滿足邊界條件的解析解。>> syms x;y1=dsolve('D2y-(2-1/x)*Dy+(1-1/x)*y=x2*exp(-5*x)','x') y1 =exp(x)*C2+exp(x)*log(x)*C1+1/1296*(6*exp(6*x)*Ei(1,6*x)+11+30*x+36*x2)*exp(-5*x)>> y=dsolve('D2y-(2-1/x)*Dy+(1-1/x)*y=x2*exp(-5*x)',&

45、#39;y(1)=sym(pi)','y(sym(pi)=1','x') y =-1/1296*exp(x)*(6*exp(1)*Ei(1,6)+77*exp(-5)-1296*sym(pi)/exp(1)+1/1296*exp(x)*log(x)*(6*Ei(1,6)*exp(6*sym(pi)+6)+77*exp(6*sym(pi)-1296*sym(pi)*exp(6*sym(pi)+5)+3*i*pi*csgn(sym(pi)*exp(6*sym(pi)+6)-6*Ei(1,6*sym(pi)*exp(6*sym(pi)+6)-3*i*pi*ex

46、p(6*sym(pi)+6)-3*i*pi*csgn(6*i*sym(pi)*exp(6*sym(pi)+6)-30*sym(pi)*exp(6)+3*i*pi*csgn(sym(pi)*csgn(6*i*sym(pi)*exp(6*sym(pi)+6)-36*sym(pi)2*exp(6)-11*exp(6)+1296*exp(5*sym(pi)+6)/log(sym(pi)*exp(-6*sym(pi)-6)+1/1296*(6*exp(6*x)*Ei(1,6*x)+11+30*x+36*x2)*exp(-5*x)10、 試求出下面微分方程的通解。(1);>> syms t;x=dsolve('D2x+2*t*Dx+t2*x=t+1') x =exp(-1-1/2*t)*t)*C2+exp(-1/2*t*(-2+t)*C1-1/2*i*pi(1/2)*2(1/2)*erf(1/2*i*2(1/2)*t-1/2*i*2(1/2)*exp(-1/2*(t-1)2)(2)。>> y=dsolve('Dy+2*x*y=x*exp(-x2)') y =(1/2*exp(-x*(x-2*t)+C1)*exp(-2*x*t)11

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論