How to make exceedance curve using histc?

10 ビュー (過去 30 日間)
Faith McColl
Faith McColl 2015 年 7 月 9 日
コメント済み: Mohammad Abouali 2015 年 7 月 9 日
I am making a histogram with bins of specified ranges, but I want it to be cumulative such that each bin shows the values that are in or greater than that range. I found the function cumsum which cumulatively adds the values so each column shows how many values are in or less than the specified range, but I want to do it the other way. For instance, if my values were 1:10 inclusive, cumsum gives me [1 3 6 10 15 21 28 36 45 55]. What I want is [55 54 52 49 45 40 34 27 19 10]. What function would I use for this?

採用された回答

Mohammad Abouali
Mohammad Abouali 2015 年 7 月 9 日
編集済み: Mohammad Abouali 2015 年 7 月 9 日
Just do the cumsum backwards on your histogram output
% generating some data
v=normrnd(0,1,[1,1000]);
% getting the histogram
n=hist(v,100);
% shows how many numbers are equal or less than
cV1=cumsum(n);
% Exceedance curve, shows howmany numbers are equal or greater.
cV2=fliplr(cumsum(fliplr(n)));
% Works on MATLAB R2015a
%cV2=cumsum(n,2,'reverse');
  2 件のコメント
Faith McColl
Faith McColl 2015 年 7 月 9 日
That worked! Thank you!
Mohammad Abouali
Mohammad Abouali 2015 年 7 月 9 日
You are welcome

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by