syms x y;ezplot(x.^2+y.^2-4*x); www.mh456.com防采集。
程序如下:
t=0:pi/20:2*pi;x=sin(t)*2;y=cos(t)*2;z=linspace(-5,5,length(t));X=meshgrid(x);Y=meshgrid(y);Z=[meshgrid(z)]';mesh(X,Y,Z)%第一2113个圆5261柱面xlabel('x')ylabel('y')zlabel('z')hold onx1=sin(t)*2;z1=cos(t)*2;y1=linspace(-5,5,length(t));X1=meshgrid(x1);Y1=[meshgrid(y1)]';Z1=meshgrid(z1);mesh(X1,Y1,Z1)%第二个圆柱面plot3(sin(t)*2,cos(t)*2,cos(t)*2,'k-*','LineWidth',2)%交线1hold onplot3(-sin(t)*2,-cos(t)*2,cos(t)*2,'k-*','LineWidth',2)%交线2title('柱面x^41022+y^2=4 和柱面x^2+z^2=4 相交的图1653形')
你看看程序,不懂得可以问我。%程序xgrid = -2:0.1:2;ygrid = -2:0.1:2;[x,y] = meshgrid(xgrid,ygrid);z_p = sqrt(x.^2+y.^2);z_n = -sqrt(x.^2+y.^2);mesh(x,y,z_p);%锥面上半部分hold on
结果:
cylinder函数是MATLAB提供的画垂直于XOY平面的圆柱面的函数,如果想要画倾斜圆柱又想用cylinder函数的话,可以先画出同半径同高度的圆柱面,再通过旋转矩阵将圆柱面上的坐标(x,y,z)旋转至所要求的角度,不会啊?高难度,大学生内容来自www.mh456.com请勿采集。