plot 正弦曲線
x = 0:pi/100:2*pi; % 步長pi/100畏吓,將2pi分成200份
y = sin(x);
plot(x,y);
surf 曲線
a = -1:.1:1;
[x,y] = meshgrid(a);
z = x.^2 + y.^2;
surf(x,y,z);
球體
[x,y,z]=sphere(50); % 指定球由半圓弧由50個網(wǎng)格組成
mesh(3*x,3*y,3*z); % 指定球的半徑為3
>> [x,y,z]=sphere(4) //4個網(wǎng)格,5個點挺益,類似正弦曲線的五點法作圖
x =
0 0 0 0 0
-0.707106781186548 0.000000000000000 0.707106781186548 0.000000000000000 -0.707106781186548
-1.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000 -1.000000000000000
-0.707106781186548 0.000000000000000 0.707106781186548 0.000000000000000 -0.707106781186548
0 0 0 0 0
y =
0 0 0 0 0
0 -0.707106781186548 0 0.707106781186548 0
0 -1.000000000000000 0 1.000000000000000 0
0 -0.707106781186548 0 0.707106781186548 0
0 0 0 0 0
z =
-1.000000000000000 -1.000000000000000 -1.000000000000000 -1.000000000000000 -1.000000000000000
-0.707106781186547 -0.707106781186547 -0.707106781186547 -0.707106781186547 -0.707106781186547
0 0 0 0 0
0.707106781186547 0.707106781186547 0.707106781186547 0.707106781186547 0.707106781186547
1.000000000000000 1.000000000000000 1.000000000000000 1.000000000000000 1.000000000000000
總共選取了14個點,效果差很多。