How to plot a graph like hist without using hist

3 ビュー (過去 30 日間)
arash rad
arash rad 2022 年 7 月 18 日
回答済み: Adarshini K 2022 年 7 月 19 日
Hi
In my code I have this :
And some of this values are the same and I want to plot it like histogram the values from the matrix below from zero to 6
but when I use hist it omits the equal values and I don't want that
what should i do ?
thank you for helping me
qu = [length(idx_100) length(idx_200) length(idx_300) length(idx_400) length(idx_500) length(idx_end)]
Unrecognized function or variable 'idx_100'.
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 7 月 18 日
bar() maybe ?
arash rad
arash rad 2022 年 7 月 18 日
Thanks

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

回答 (2 件)

Adam Danz
Adam Danz 2022 年 7 月 18 日
>but when I use hist it omits the equal values
hist does the binning, counting, and produces the plot. If "17" occurs 3 times, then the bar for 17:18 should be 3 units tall (assuming there are no other values between 17 and 18.
If the input data represent the bar heights and you don't want the function to do the binning and counting, use histogram('BinEdges',edges,'BinCounts',counts)
histogram('BinEdges',0:7,'BinCounts',qu)

Adarshini K
Adarshini K 2022 年 7 月 19 日
Hi Arash rad,
From my understanding of your question, I hope the following documentation which has a similar use case may give you an insight of how to plot a histogram with repeated values.

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by