Matlab中的线图 [英] Line plots in Matlab

查看:107
本文介绍了Matlab中的线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用Surf的情况下绘制矩阵的线图,例如A = rand(5)?

How do you do a line plot of a matrix such as A=rand(5) without using surf?

推荐答案

如果要在2D图中分别绘制每列,则只需编写

If you want to plot every column separately in a 2D plot, you just write

plot(A)

如果要用线条绘制3D图,可以编写:

If you want to make a 3D plot with lines, you could write:

[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.

这篇关于Matlab中的线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆