Matlab中的线图

时间:2010-07-02 21:39:45

标签: matlab

如何在不使用冲浪的情况下绘制A = rand(5)等矩阵的线图?

1 个答案:

答案 0 :(得分:1)

如果要在2D绘图中单独绘制每一列,只需编写

即可
plot(A)

如果你想用线条制作3D图,你可以写:

[xx,yy] = ndgrid(1:6,1:5);
A = [A;NaN(1,size(A,2))]; %# add NaNs so that the lines will be plotted separately
plot3(xx(:),yy(:),A(:)) %# use plot3(xx(:),yy(:),A(:),'.') if you want to plot dots instead of lines.