clc clf hold on grid on % ve mat cau phan tren phi=linspace(0,2pi,30); theta=linspace(0,pi4,30); p t=meshgrid(phi,theta); x=sqrt(2)sin(t).cos(p); y=sqrt(2)sin(t).sin(p); z=sqrt(2)cos(t); mesh(x,y,z,FaceColor,c,FaceAlpha,0.5,EdgeColor,non); % ve mat cau phan duoi theta=linspace(3pi4,pi,30); p t=meshgrid(phi,theta); x=sqrt(2)sin(t).cos(p); y=sqrt(2)sin(t).sin(p); z=sqrt(2)cos(t); mesh(x,y,z,FaceColor,c,FaceAlpha,0.5,EdgeColor,non);
(CODE) BTL MatLab môn giải tích 2- HK152 2.2 Vẽ hình vật thể V 1: x2 + y2 ≤ 1,x2 + y2 + z2 ≤ clc clf hold on grid on % ve mat cau phan tren phi=linspace(0,2*pi,30); theta=linspace(0,pi/4,30); [p t]=meshgrid(phi,theta); x=sqrt(2)*sin(t).*cos(p); y=sqrt(2)*sin(t).*sin(p); z=sqrt(2)*cos(t); mesh(x,y,z,'FaceColor','c','FaceAlpha',0.5,'EdgeColor','non'); % ve mat cau phan duoi theta=linspace(3*pi/4,pi,30); [p t]=meshgrid(phi,theta); x=sqrt(2)*sin(t).*cos(p); y=sqrt(2)*sin(t).*sin(p); z=sqrt(2)*cos(t); mesh(x,y,z,'FaceColor','c','FaceAlpha',0.5,'EdgeColor','non'); % ve mat tru z=linspace(-1,1,30); [z phi]=meshgrid(z,phi); r=1; x=r.*cos(phi);y=r.*sin(phi); mesh(x,y,z,'FaceColor','y','FaceAlpha',0.5,'EdgeColor','non'); % ve giao tuyen plot3(cos(phi),sin(phi),1+0*phi,'r'); plot3(cos(phi),sin(phi),-1+0*phi,'r'); xlabel('Truc Ox') ylabel('Truc Oy') zlabel('Truc Oz') rotate3d on title('x^2+y^21,0=[...]... mesh(x,y2,z,'facecolor','m','edgecolor','w','facealpha',.3) % ve duong giao tuyen t=linspace(0,2*pi,50); plot3(cos(t),sin(t),sin(t),'r'); plot3(cos(t),sin(t),-sin(t),'r'); 17 V 25: x2 + z2 = 1,x2 + z2 = 4,y = −1,y = 3 % ve x2 + z2 = 1, x2 + z2 = 4, y = ?1, y = 3 clc clf hold on grid on xlabel('Truc Ox') ylabel('Truc Oy') zlabel('Truc Oz') rotate3d on title('x2 + z2 = 1, x2 + z2 = 4, y = ?1, y = 3'); % ve mat x^2+y^2=1 r=linspace(-1,3,30);... mesh(x,y,z2,'facecolor','m','edgecolor','non','facealpha',.3); % ve giao tuyen t=linspace(0,2*pi,100); plot3(2*cos(t),sin(t),0*t,'r'); plot3(2*cos(t),sin(t),2-2*cos(t),'r'); V 16: x = 0,y = 0,3x + y = 3,3x + 2y = 6,x + y + z = 3 √ %Vat the gioi han boi x=0, y=0, 3*x+y=3, 3*x+2*y=6, x+y+z=3 clc clf hold on grid on xlabel('Truc Ox') ylabel('Truc Oy') zlabel('Truc Oz') rotate3d on title('x=0, y=0, 3*x+y=3, 3*x+2*y=6, x+y+z=3') 11 % ve mat y=0, 3*x+y=3,... mesh(x,y3,z,'facecolor','m','edgecolor','non','facealpha',.5) % ve mat x=0 z=linspace(0,4,500); x=linspace(0,2,500); [x, z]=meshgrid(x,z); y2=3-3.*x; x1=0.*x; for i=1:length(z) for j=1:length(x) if z(i,j)+x1(i,j)+y2(i,j) > 3 || y2(i,j)2 y1(i,j)=NaN;y2(i,j)=NaN; end end end mesh(x,y1,z,'FaceColor','c','FaceAlpha',0.5,'EdgeColor','non') mesh(x,y2,z,'FaceColor','c','FaceAlpha',0.5,'EdgeColor','non') %ve mat z=0 va z=2-x x=linspace(-2,2,200);... 0],[-2 2],'Color','r') V 18: phần ứng với x ≥ 0,y ≥ 0 %Vat the gioi han boi z=0,z=4-x^2-y^2;y=x,y=x/sqrt(3) clc clf hold on grid on xlabel('Truc Ox') ylabel('Truc Oy') zlabel('Truc Oz') rotate3d on % ve mat y=x,y=x/sqrt(3) x=linspace(0,2,300); z=linspace(0,4,300); [x z]=meshgrid(x,z); y1=x; for i=1:length(x) for j=1:length(z) if x(i,j)^2+y1(i,j)^2+z(i,j)>4 y1(i,j)=NaN; end end end y2=x/sqrt(3); for