difference between using max and length in histogram

3 ビュー (過去 30 日間)
Josh
Josh 2014 年 7 月 25 日
コメント済み: Image Analyst 2014 年 7 月 26 日
What it the difference between using max and length in histogram?
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 25 日
Max of what? and length of what?

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 25 日
A=[1 2 10 3]
Try
max(A) % The greatest value in A
and
length(A) % number of element in A

その他の回答 (1 件)

Josh
Josh 2014 年 7 月 25 日
Thank you, that's what I thought. I was working a problem and the resulting histogram is the same whether I use max(X) or length(X) which did not make sense to me, but since I was creating a vector using X(i) = sum(rand > cumsum(p))+1, I suppose in this case max(X) and length(X) are the same.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 7 月 26 日
No. X(i) can be any integer value between 1 or and length(p)+1. Those values are independent of the max value of X since you could have different X(i). We don't know how long X is. For example, maybe X = [10, 30, 100, 4, 16], so length(X) = 5 while max(X) = 100. Rand is different for each i so that's why the values of X could be different for each i, and thus the max value is independent of the length, except in very coincidental cases.

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

カテゴリ

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