필터 지우기
필터 지우기

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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by