how to predetermine the load bins in a histogram?

1 回表示 (過去 30 日間)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 12 月 12 日
コメント済み: MAHMOUD ALZIOUD 2017 年 12 月 13 日
Dear all, I draw a histogram for an array called (single{K}), using the following code, it seems ok but what I need to do is how to determine the ranges of load bins before drawing it? i already defined the number of bins which is 38, but how can i tell matlab to set the bins with fixed increments, such as: 3000 to 40000 lb at 1000 lb interval? attached is my histogram which needs help
figure
histogram(single{K}, 38)
xlabel('Load in Kips')
ylabel('Counts')
title(['ALS for C9 Single For Month ',num2str(months),' ', 'Station' ,' ', num2str(stations)])

採用された回答

Image Analyst
Image Analyst 2017 年 12 月 12 日
Use bin edges:
edges = [-inf, 3000:1000:40000, inf];
histogram(single{K}, edges);
  4 件のコメント
Steven Lord
Steven Lord 2017 年 12 月 13 日
編集済み: Steven Lord 2017 年 12 月 13 日
It is. It's just a histogram where all the bins but one are empty.
Let's say I were to ask everyone who posted on MATLAB Answers today for their year of birth and I created a histogram. I create one bin is for everyone born before 2020 and bins for everyone born in 2020, 2021, 2022, ... 2100. That histogram is going to look very similar to yours, since it's highly unlikely that anyone posting here today was born after 2020. Though if we do have any time traveling posters, welcome to the past. I'd love to talk to you.
Experiment with the different options for the BinMethod option of histogram and look at the bounds of your data. Or just let histogram try to choose "nice" bins for you.
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 12 月 13 日
this makes sense, thank you very much Mr Steven.

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

その他の回答 (0 件)

カテゴリ

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