フィルターのクリア

Add a distribution fit in a histogram

1 回表示 (過去 30 日間)
ka chun yick
ka chun yick 2020 年 2 月 12 日
コメント済み: Navya Seelam 2020 年 2 月 17 日
Hi,
This is my script and i would like to add a distribution fit along the bars (see attachment). I assumed using the histfit() function, but i am not sure how can i do it....
% Load yA
% Load yB
% Load yC
% comment out below 3 lines and uncomment your original data loads above
yA = randn(1000,1)*7+15;
yB = randn(1000,1)*3+7;
yC = randn(1000,1)*4+30;
% specify number of bins and edges of those bins; this example evenly spaces bins
NumBins = 25;
BinEdges = linspace(0,50,25);
% use histcounts and specify your bins
cntA = histcounts(yA,'BinEdges',BinEdges);
cntB = histcounts(yB,'BinEdges',BinEdges);
cntC = histcounts(yC,'BinEdges',BinEdges);
% plot
figure(1); cla; hold on;
% convert bin edges into bin centers
b = BinEdges(1:end-1)+diff(BinEdges)/2
% use bar
bar(b,[cntA',cntB',cntC'],'stacked')
  1 件のコメント
Navya Seelam
Navya Seelam 2020 年 2 月 17 日
Which data are you exactly trying to fit and what parameters are you trying to obtain by fitting the data?

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

回答 (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