Binning time-dependent data in a histogram
4 ビュー (過去 30 日間)
古いコメントを表示
So, my data looks something like this: t1 = (1, 5, 8, 9), t2 = (2, 7, 9, 12), t3 = (2, 5, 5)
Each of the values is a datapoint; I'm measuring the time when the datapoint occured (so, in t1, datapoint 2 is occuring at timepoint 5s for example).
I want to combine all trails in one histogram, whos x-axis are timebins, so that I know how many datapoints I have at timepoint 2 sec, taken all the trails together.
So far, I put all my trails in one structure, but I can't get them aligned so that I can compute how many datapoints I have for a certain timepoint. I hope someone can help. It's driving me crazy, that I can't figure it out. :(
0 件のコメント
回答 (2 件)
Peter Manley-Cooke
2011 年 6 月 28 日
If the data is in vectors, then
t1 = [1 5 8 9];
t2 = [2 7 9 12];
t3 = [2 5 5];
% Combine the data
t= [t1 t2 t3];
% put it in a histogram
hist(t,max(t));
% or collect data about the histogram
[N B] = hist(t,max(t));
will show a histogram with seconds on the x axis. As shown in the documentation, N is the number of items in each bin and B is the value of the bin centre.
0 件のコメント
Fangjun Jiang
2011 年 6 月 28 日
I don't understand. The code below shows a histogram. It shows at time t=2 and t=5, there are 3 data points. At time t=9, there are two data points. The rest, there is one data points. Is this what you want? Or you just couldn't get structure data together? What does your structure data look like?
t1=[1 5 8 9];
t2=[2 7 9 12];
t3=[ 2 5 5];
t=[t1 t2 t3];
hist(t);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!