normalization issue pdf gmm matlab

4 ビュー (過去 30 日間)
intesaaf ashraf
intesaaf ashraf 2022 年 6 月 3 日
コメント済み: Torsten 2022 年 6 月 3 日
I plotted a histogram normalized by pdf. I den fitted GMM model using fitgmdist. I then plotted the pdf of gmm over histrogram . I found pdf way too higher than the normalized histogram values. kindly help. I am attaching the data
options = statset('Display','final');
gmdist = fitgmdist(data',3,'CovType','diagonal','Regularize', 1e-5)
gmsigma = sqrt(gmdist.Sigma);
gmmu =;
gmwt = gmdist.ComponentProportion;
histogram(data, 'Normalization', 'pdf', 'EdgeColor', 'none')
x = -5:0.0001:30;
xlim([-5 30])
hold on;
plot(x', pdf(gmdist, x'), 'k')
hold on;
  2 件のコメント
Torsten 2022 年 6 月 3 日
@intesaaf ashraf comment moved here:
ok but why histogram is so low then



Tom Lane
Tom Lane 2022 年 6 月 3 日
You have a substantial amount of missing (NaN) data. I believe the histogram function produces a density that integrates to the proportion of missing values. That is, part of the pdf is allocated to the NaN values so is not shown. Try this instead:
histogram(data(~isnan(data)), 'Normalization', 'pdf', 'EdgeColor', 'none')
  1 件のコメント
Torsten 2022 年 6 月 3 日
@intesaaf ashraf comment moved here
thanks a lot


その他の回答 (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