Plotting Multiple Histograms with Increasing Number of Bins

2 ビュー (過去 30 日間)
rrv
rrv 2019 年 2 月 14 日
回答済み: KSSV 2019 年 2 月 14 日
I like to subplot multiple histograms with increasing number of bins. Here is my code:
for j=1:1:6
for nbins=5:5:30
subplot(2,3,j)
histogram(y,nbins);
end
end
This is the figure that I have been getting. Can you correct my code? I also want to put a title on every subplot .Thank you.

回答 (1 件)

KSSV
KSSV 2019 年 2 月 14 日
count = 0 ;
for i = 1:3
for j = 1:3
count = count+1 ;
subplot(3,3,count)
plot(rand(3,1))
title(sprintf('(%s, %s)',num2str(i),num2str(j)))
end
end

カテゴリ

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