Báo cáo Bài tập lớn Matlab Giải tích 2 - Trần Đại Nghĩa

  • Trong đời sống:

+ Tháp đôi Petronas ở Kuala 

Lumpur chịu sự tác động rất 

lớn của gió cao. Tích phân được 

sử dụng để tính toán sức chịu đựng 

của tháp.

 

      + Nhà hát Opera Sydney được 

       thiết kế độc đáo theo mặt cắt của 

quả bóng. Để thiết kế, người ta phải 

sử dụng nhiều phương trình vi phân 

(một dạng của phép tích phân).

 

 + Về phương diện lịch sử, một trong 

docx 65 trang xuanthi 27/12/2022 1780
Bạn đang xem 20 trang mẫu của tài liệu "Báo cáo Bài tập lớn Matlab Giải tích 2 - Trần Đại Nghĩa", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.

File đính kèm:

  • docxbao_cao_bai_tap_lon_matlab_giai_tich_2_tran_dai_nghia.docx

Nội dung text: Báo cáo Bài tập lớn Matlab Giải tích 2 - Trần Đại Nghĩa

  1. TRƯỜNG ĐẠI HỌC BÁCH KHOA TPHCM KHOA: CÔNG NGHỆ VẬT LIỆU BÁO CÁO BÀI TẬP LỚN GIẢI TÍCH 2 HỌ VÀ TÊN: TRẦN ĐẠI NGHĨA MSSV:1612226 GIÁO VIÊN HƯỚNG DẪN: LÊ THỊ YẾN NHI NHÓM 6 – L29 –LỚP VL1604-K2016 Tp. Hồ Chí Minh, ngày 31 tháng 05 năm 2017 1
  2. ỨNG DỤNG CỦA TÍCH PHÂN • Trong toán học: 3
  3. • Trong đời sống: + Tháp đôi Petronas ở Kuala Lumpur chịu sự tác động rất lớn của gió cao. Tích phân được sử dụng để tính toán sức chịu đựng của tháp. + Nhà hát Opera Sydney được thiết kế độc đáo theo mặt cắt của quả bóng. Để thiết kế, người ta phải sử dụng nhiều phương trình vi phân (một dạng của phép tích phân). + Về phương diện lịch sử, một trong 9
  4. ĐỀ 1 Code: Ví dụ minh họa với a =2, b =3 syms x y z; a = input('nhap a= '); b = input('nhap b= '); z = x^2/a^2 + y^2/b^2; grid on; ezsurf(z); 11
  5. disp(yn(i)) end else disp('khong co cuc tri tai x = ' ) disp(xn(i)) disp ('y = ') disp(yn(i)) end zn(i) = xn(i)*xn(i) + yn(i)*yn(i) - 32 *log(xn(i)*yn(i)); end grid on ezsurf(z); for i = 1:2 text(double(xn(i)),double(yn(i)),double(zn(i)),' cuc tieu'); end 13
  6. Code: syms x y z; f=y; tp1=int(f,z,0,1-y); tp2= int(tp1,y,x^2,1); tp3 = int(tp2,-1,1); disp(tp3) Code: syms n; s=n/3^n; s=symsum(s,n,1,inf) 15
  7. Code: syms x y z f = x*y -sinh(x+y -z*z); Lx=-diff(f,x)/diff(f,z); L2xx=diff(Lx,x)+diff(Lx,z)*Lx; disp('tai z =1') kq1= subs(subs(subs(L2xx,x,0),y,1),z,1) disp('tai z = -1') kq2=subs(subs(subs(L2xx,x,0),y,1),z,-1) 17
  8. dy(i)=(double(subs(diff(p,x),X(i)))/(double(- subs(diff(p,y),Y(i))))); d2L(i)=(subs(Lxx, lamda(i)))+subs(Lyy, lamda(i)*dy(i)^2)+2*Lxy*dy(i); if d2L(i) < 0 disp('ham cuc dai tai x=') disp(X(i)) disp('y=') disp(Y(i)); fCD(i)=subs(subs(f,x,X(i)),y,Y(i)); scatter3(double(X(i)),double(Y(i)),double(fCD(i) ),'filled','yellow') else if (d2L(i)==0) disp('ham ko dat cuc tri tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); else disp('ham dat cuc tieu tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); fCT(i)=subs(subs(f,x,X(i)),y,Y(i)); scatter3(double(X(i)),double(Y(i)),double(fCT(i) ),'filled','red') end end end 19
  9. Code: Code: syms n; s=(-1)^n/(n^2); s=symsum(s,n,1,inf) 21
  10. Code: syms x y t f = exp(3*x+2*y); daohamx = subs(diff(f,x),{x y},{0 0}) daohamy = subs(diff(f,y),{x y},{0 0}) x = sin(t); y = t^2; daohamxt = subs(diff(x,t),t,0) daohamyt = subs(diff(y,t),t,0) A = daohamx*daohamxt + daohamy*daohamyt 23
  11. [k,p]=max(gt); [m,n]=min(gt); GTLN = k for i=1:5 if (k==gt(i)) disp('tai [x,y] = ') disp([X(i) Y(i)]) scatter3(double(X(i)),double(Y(i)),gt(i),'filled ','yellow') end end GTNN = m for i=1:5 if (m==gt(i)) disp('tai [x,y] = ') disp([X(i) Y(i)]) scatter3(double(X(i)),double(Y(i)),gt(i),'filled ','red') end end 25
  12. Code: syms n s = ((-1)^n/3^n)/(2*n + 1); S = symsum(s,n,1,inf) 27
  13. Code: clear all clf clc syms x y lamda phi dx dy phi = linspace(0,2*pi,100); plot(cos(phi),sin(phi)) f = x.^2 +y.^2 +x*y; P = x.^2 +y.^2 -1; L = f + lamda*P Lx = diff(L,x) Ly = diff(L,y) X = solve(Lx*y-Ly*x,x) disp(' Giai x y lamda ') nghiem = solve(Lx,Ly,P,x,y,lamda) X = nghiem.x Y = nghiem.y lamda = nghiem.lamda L2x = diff(Lx,x) L2y = diff(Ly,y) Lxy = diff(Lx,y) for i=1:4 a(i)=(double(subs(diff(P,x),X(i)))/(double(- subs(diff(P,y),Y(i))))); b(i)=(subs(L2x,lamda(i))*(a(i))^2)+subs(L2y,l amda(i)) + 2*Lxy; if b(i) < 0 disp('ham dat cuc dai tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); else if (b(i)==0) 29
  14. Code: syms x y z t; z = sqrt(2)*t; x = t; y = t; f = z*y-2*x; 31
  15. ĐỀ 5 Code: clc syms x y z f=80/(1+x^2+2*y^2+3*z^2); fx=subs(diff(f,x),{x y z},{1 1 -2}); fy=subs(diff(f,y),{x y z},{1 1 -2}); fz=subs(diff(f,z),{x y z},{1 1 -2}); gradf=[fx,fy,fz] Code: clc syms x y z f=x+y-z-exp(z-x-y); zx=-(diff(f,x))/(diff(f,z)) Code: clf clc 33
  16. if (k==gt(i)) disp('tai [x,y] = ') disp([X(i) Y(i)]) scatter3(double(X(i)),double(Y(i)),gt(i),'filled ','yellow') end end GTNN = m for i=1:5 if (m==gt(i)) disp('tai [x,y] = ') disp([X(i) Y(i)]) scatter3(double(X(i)),double(Y(i)),gt(i),'filled ','red') end end 35
  17. Code: syms n an=(2^n-5)/factorial(n); a=symsum(an,0,inf) 37
  18. Code: clc syms u x y z f=exp(u^2); fu=diff(f,u); u=sin(x*y); ux=diff(u,x); uy=diff(u,y); disp('Dao ham rieng cua f theo x') fx=fu*ux; f1x=eval(fx) disp('Dao ham rieng cua f theo y') fy=fu*uy; f1y=eval(fy) 39
  19. else if (d2L(i)==0) disp('ham ko dat cuc tri tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); else disp('ham dat cuc tieu tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); fCT(i)=subs(subs(f,x,X(i)),y,Y(i)); scatter3(double(X(i)),double(Y(i)),double(fCT (i)),'filled','red') end end end 41
  20. zy=-diff(z,y) ham=P*zx+Q*zy+R %I=int(int(ham.*r,r,0,2.*cos(phi)),phi,- pi/2,pi/2) I=int(int(ham.*r,r,0,1),phi,0,2*pi) hold on r=linspace(0,1,30); phi=linspace(0,2*pi,30); [r,phi]=meshgrid(r,phi); x=1+r.*cos(phi); y=r.*sin(phi); z=3-x-y; surf(x,y,z) syms u v ezsurf(1+cos(u),sin(u),v) 43
  21. ĐỀ 7 Code: f=x^2+ sin(x*y); subs(diff(f,1,x),[x,y],[1,0]); subs(diff(f,1,y),[x,y],[1,0]); u= (2*(a-1)+b)/sqrt((a-1)^2+b^2); a=solve('u=1') % vậy a=1 => b=+-1 ( a^2+b^2=1) Code: syms x y f=1/(2*x+3*y); taylor(f,[x y],[1,2],'Order',3) 45
  22. Code: syms x y % cho mat cau x^2+y^2+z^2=2 z=sqrt(2-x^2-y^2); % lay phan duong do bao ngoài mat nón z=sqrt(x^2+y^2)>0 A=diff(z,x); B=diff(z,y); C=sqrt(1+A^2+B^2); D=x^2+y^2+(sqrt(x^2+y^2))^2; %D=2=> x^2+y^2=1 %hình chieu lên Oxy {x,y thuc R(2),x^2+y^2<=1 g=(x+sqrt(x^2+y^2))*sqrt(x^2+y^2)*C; 47
  23. Code: syms n; s=1/(3^n*factorial(n)); tong=symsum(s,n,1,inf) 49
  24. Code: syms x y t f = exp(x/y); tichphan1 = int(f,x,0,y^2); tichphan = int(tichphan1,y,0,1) grid on hold on ezplot(t,0*t+0, [0 1]) ezplot(0*t+1,t,[0 1]) ezplot(sqrt(x),[0 1]) Code: syms x y z f = 2*x^2 + y^2 - z; a = subs(diff(f,x),x,1); 51
  25. ĐỀ 9 Code: syms x y z [x, z]=meshgrid(-2:.2:2); y=x.^2; surf(x, y, z) Code: syms x y u v f=exp(u*v); 53
  26. daohamy=diff(f,y) c=solve(daohamx,x) solve(daohamy,y) %x=-2 y=0 A=subs(A,[x y],[-2 0]) B=subs(B,[x y],[-2 0]) C=subs(C,[x y],[-2 0]) d=subs(f,[x y],[-2 0]) delta=A*C-B^2 %cuc tieu [x, y]=meshgrid(-2:.2:2); z=(x+y.^2).*exp(x/2); surf(x, y, z) text(-2,0,-2*exp(-1),'CT') 55
  27. %tinh tich phan syms r phi real x=r*cos(phi);y=r*sin(phi); % chuyen sang phuong phap truc toa do f=eval(f); S=int(int(f*r,'r',0,1),'phi',0,2*pi); %tinh tich phan S=double(S); disp(['Tich phan can tinh la: I= ' num2str(S)]) 57
  28. ĐỀ 10 Code: syms x y u = (2*x+3*y)*log(x+2*y); ketqua=diff(u,100,x); temp=subs(ketqua,[x y],[1 2]); disp('Ket qua cau 1 la:'); disp(double(temp)); Code: clc clf clear all syms x y z f = x*y*z -log(x+2*z-2); zy=-diff(f,y)/diff(f,z) subs(subs(subs(zy,x,2),y,0),z,1/2) L2xy= diff(zy,y)+diff(zy,z)*zy disp('tai z =1/2') kq= subs(subs(subs(L2xx,x,2),y,0),z,1/2) 59
  29. disp('ham ko dat cuc tri tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); else disp('ham dat cuc tieu tai x= ') disp(X(i)) disp('y= ') disp(Y(i)); fCT(i)=subs(subs(f,x,X(i)),y,Y(i)); scatter3(double(X(i)),double(Y(i)),double(fCT (i)),'filled','red') end end end 61
  30. set(surf(x,y,z),'facecolor','g','edgecolor','non ','facealpha',.1) % ve duong giao tuyen t=linspace(0,2*pi,50); x=sqrt(3)*cos(t)-1;y=sqrt(3)*sin(t);z=x.^2+y.^2; plot3(x,y,z,'color','r') %tinh tich phan mat syms x y z real P=3*x-+y^2; Q=3*y-z^2; R=3*z-x^2; f=z+2*x-2; n=[diff(f,'x') diff(f,'y') diff(f,'z')]; n=n/sqrt(diff(f,'x')^2 + diff(f,'y')^2 + diff(f,'z')^2); % tinh vector don vi cua vector phap %phuong phap tinh la phuong phap stokes p=(diff(R,'y')-diff(Q,'z'))*n(1,1); q=(diff(P,'z')-diff(R,'x'))*n(1,2); r=(diff(Q,'x')-diff(P,'y'))*n(1,3); z=2-2*x; % chuyen ve tich phan mat loai 1 f=(eval(p)+eval(q)+eval(r))*sqrt(1+diff(z,'x')^2 +diff(z,'y')^2); %tinh tich phan syms r phi real x=r*cos(phi);y=r*sin(phi); % chuyen sang phuong phap truc toa do f=eval(f); S=int(int(f*r,'r',0,sqrt(3)),'phi',0,2*pi); %tinh tich phan S=double(S); disp(['Tich phan can tinh la: I= ' num2str(S)]) 63