例如,
x为(16:2:50)
y( 0.25:0.125:1);
Z=[1,2,3,4,5,6
2,3,4,5,6,7
3,4,5,6,7,8
4,5,6,7,8,9
5,6,7,8,9,10
6,7,8,9,10,11
7,8,9,10,11,12]
画三维图
代码如下
[X,Y] = meshgrid(16:2:26, 0.25:0.125:1);
Z=[1,2,3,4,5,6
2,3,4,5,6,7
3,4,5,6,7,8
4,5,6,7,8,9
5,6,7,8,9,10
6,7,8,9,10,11
7,8,9,10,11,12]
surf(X,Y,Z);
也可以用
mesh(X,Y,Z)
surf和mesh的调用方法类似,