1.用plot3命令绘制下面的三维曲线
{ x = c o s t , t ∈ [ 0 , 2 π ] y = s i n t z = t s i n t c o s t \begin{cases} x=cost , t\in [0, 2\pi ]& \text{ } \\ y=sint& \text{ } \\ z=tsintcost& \text{ } \end{cases} ⎩⎪⎨⎪⎧x=cost,t∈[0,2π]y=sintz=tsintcost
t = 0:pi/100:2*pi;
x = cos(t);
y = sin(t);
z = t.*sin(t).*cos(t);
plot3(x, y, z)
2. 在xy平面选择区域 [-8, 8]x[-8, 8],利用mesh,surf,meshc,surfc绘制下面函数,要求子图在同一个图形窗口绘制,并添加标题说明
z = s i n x 2 + y 2 x 2 + y 2 z=\frac{sin\sqrt{x^{2}+y^{2}}}{\sqrt{x^{2}+y^{2}}} z=x2+y2sinx2+y2
[x, y] = meshgrid(-8: 1:8); % 生成网格矩阵
z = sin(sqrt(x.^2+y.^2))./sqrt(x.^2+y.^2);
subplot(2, 2, 1); %分割图新窗口
mesh(x, y, z)
title('mesh');
subplot(2, 2, 2)
surf(x, y, z)
title('surf');
subplot(2, 2, 3);
meshc(x, y, z)
title('meshc');
subplot(2, 2, 4);
surfc(x, y, z)
title('surfc');
3.绘制光照处理后的球面,取三个不同的光照位置进行比较(提示:可以利用sphere函数和light命令)
subplot(2, 2, 1);
sphere(30);light('Color', [1, 1, 1], 'Style', 'local', 'Position', [-4, -1, 10]);
subplot(2, 2, 2);
sphere(30);light('Color', [1, 1, 1], 'Style', 'local', 'Position', [-1, <