在Matlab中计算对象随时间的频率

时间:2014-10-28 15:16:06

标签: matlab

我有两个矩阵,"位置"并且"跟踪",每个都是402乘1000. 1000表示1000个对象,移动超过402个时间步长。 "轨道"取0-5的整数,位置取0-200的浮点数。轨道0被认为是偏离轨道的。我可以使用以下方式绘制所有在轨天线:

for indt = 1:ntimes
    plot(pos(indt,:), track(indt,:), 'o', 'MarkerSize', 18) ;
    title(['t = ' num2str(T(indt))])
    axis([0,200,0.5,5.5])
    pause(p)
end

当ntimes = 402,并且从0.5开始的轴切断位于0的偏离轨道对象。问题是,我希望看到偏离轨迹物体的直方图,轴是位置(所以他们需要分组)与频率相比。我遇到这样的麻烦!任何想法,将不胜感激。

1 个答案:

答案 0 :(得分:2)

这是你的意思吗?

% Just some random data:
pos = rand(402,1000)*200;
track = randi(6,402,1000)-1;

% find all off tracks:
offTrack = track ==0;

% get the positions of the off tracks:
positionOfOffTracks = pos(offTrack);

% and plot this one
figure();
hist(positionOfOffTracks(:),20);