MATLAB和光栅图

时间:2013-10-25 19:12:32

标签: matlab plot raster

我已经在matlab的stackoverflow上查看了所有与栅格相关的东西,并且无法找到一种有用且简单的方法来制作某些数据的栅格图。

我想制作的栅格图使用以下向量:

X =[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;]

在该向量中,0 =无响应,1 =响应。每个元素也代表0.1秒。我想以下列方式制作一个将数据表示为栅格的图:

| ||| | | | |||||| | | |

--->时间 (注意:这个例子与我给出的数据不对应)

其中Time在X轴上,每行对应1(即响应)。有没有人对如何做到这一点有一些建议?

我确实使用了Matlab的命令来制作稀疏图,但这并不是我想要的。此外,我尝试了linalg :: raster但我没有这个命令所需的工具箱。

1 个答案:

答案 0 :(得分:2)

根据你的绘图我假设你正在寻找

stem(X,'Marker','none')

对于时间轴,您可以执行类似

的操作
t = (1./(24.*60.*60.*10)).*(1:length(X)) ;
stem(t,X,'Marker','none') 
datetick