Frequency against every value
4 ビュー (過去 30 日間)
古いコメントを表示
i have dataset with column data,the last column in the dataset which i have attached.i want to calculate all number of data greater than 4 ,greater than 4.1, greater than 4.2 so on ....data sample is as Data
data
6
4.7
4.4
4.3
4.2
4.8
4
4.2
4.2
4.6
4.1
4.2
4.4
4.4
4.1
4.9
4.5
4.1
4.1
4.2
5
4.6
5.4
4
4.4
4.4
4.1
4.4
4
4
4.9
4.4
4.2
4.2
4.8
6
5.1
4.7
4
4
4.3
4.3
4.1
4
4
4.2
4.2
4.2
4.2
4.1
4.6
4.2
4.3
4.1
4.1
4.4
4.4
4.4
4.4
4.7
4.7
4.1
4.3
4.3
4.2
4.4
4.3
4.4
4.8
4.8
4.2
4.2
4.8
5.5
4.7
4.1
4.2
4.1
4.1
4.1
4.1
4.6
4.6
4.6
4.1
4
5.2
5.5
4.6
4.1
4.1
4.1
4.2
4.2
4
4.5
4.8
4.7
4.6
0 件のコメント
採用された回答
Guillaume
2015 年 12 月 8 日
Bearing in mind that the number of data greater than 4 also includes the number of data greater than 4.1, what you are asking for is a cumulative histogram but in reverse.
The histcounts function does cumulative histogram (the 'cumcount' option of 'normalization'), but not in reverse. No matter, you can reverse the ordering of your data simply by negating it:
bins = 6:-0.1:3.9; %note that it's 3.9 instead of 4 due to the way histcounts treat the last bin
count = fliplr(histcounts(-data, -bins, 'Normalization', 'cumcount')
count is the reversed cumulative histogram starting at 4, finishing at 5.9. That is count(1) is the number of data > 4, count(2) the number > 4.1, ... count(99) the number > 5.9.
3 件のコメント
Guillaume
2015 年 12 月 8 日
You don't have to accept an answer if it does not work for you.
You must be running an ancient version of matlab if histcount can't be found. You could possibly replace it with
cumsum(histc(-data, -bin)) %completely untested
You may need to adjusts the bins as histc behaves slightly differently at the edges than histcounts
その他の回答 (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!