x1 = -8:1:8;
y1 = 0:1:16;
x2 = -10:2:10;
y2 = -10:2:10;
x3 = -3:0.5:3;
y3 = 0:0.5:6;
plot(x1,y1,x2,y2,x3,y3)
subplot(1,3,1)
plot([1,2,3,4],[2,3,4,5])
subplot(1,3,3)
plot([1,2,3,4,5,6],[2,4,5,8,6,3])
theta = 0:pi/50:2*pi;
r = sin(2*theta);
h = polar(theta,r)
效果图
代码
x = 1:10;
y = 1:10;
z1 = x+y+2;
plot3(x,y,z1);
hold on;
[x2,y2] = meshgrid(x,y);
z2 = x2+y2-1
plot3(x2,y2,z2)
xlabel("x axis")
ylabel("y axis")
zlabel("z axis")
提示点
'-' | 实线 | o | 小圆圈 | r | 红色 |
‘:’ | 虚线 | * | 小星星 | b | 蓝色 |
'-.' | 点划线 | s | 小方块 | k | 黑色 |
‘--’ | 双划线 | p | 五角星 | g | 绿色 |
^ | 向上的三角形 | ||||
d | 棱形 | X | 叉号 | v | 向下的三角形 |
< | 朝左的三角形 | + | 加号 | > | 朝右的三角形 |
H | 六角形 |
t = 0:pi/60:10*pi;
x = sin(t);
y = cos(t)+sin(t);
plot3(x,y,t,'o-r')
x = -10:10;
y = -10:10;
[x1,y1] = meshgrid(x,y);
z1 = (x1 + y1);
meshz(x1,y1,z1)
x1 = -8:8;
y1 = -8:8;
[X,Y] = meshgrid(x1,y1);
Z = (X.*Y);
meshz(X,Y,Z)
x1 = -8:8;
y1 = -8:8;
bar(x1,y1)
x = -8:.5:8;
y = -8:.5:8;
[x1 y1] = meshgrid(x,y);
z1 = x1.* y1
bar3(z1)
x = randn(100,1);
y = randn(100,1);
histogram(x)
%histogram2(x,y)
x = [15,30,45,60];
pie(x)
pie3(x)
x = -8:2:8;
y = -8:2:8;
stem(x,y)
[x1 y1] = meshgrid(x,y);
z1 = x1.^2+y1;
%stem3(x1,y1,z1)
stem3(x1,y1,z1,'filled')
x = -8:2:8;
y = -8:2:8;
%stem(x,y)
[x1 y1] = meshgrid(x,y);
z1 = x1.^2+y1;
surf(x1,y1,z1)