フィルターのクリア

Histogram and Gaussian curve showing Mean and 1-sigma

2 ビュー (過去 30 日間)
Kash022
Kash022 2017 年 7 月 19 日
回答済み: supernoob 2018 年 4 月 13 日
Hi All,
I have a histogram over which I want to plot a gaussian curve and show the mean and 1-sigma deviation. I have tried using the example code from https://nl.mathworks.com/help/matlab/ref/histogram.html?s_tid=doc_ta but the problem is it replaces my histogram and only displays the gaussian. I want both of them as shown in the above example and also two lines which could show the mean and 1-sigma. This is the below code I am using. Thanks!
Ids_00 = squeeze(CMOS_00(1,max_SNR_pos,1:100));
figure(); h1=histogram(Ids_00,10);
mu = mean(Ids_00);
sigma = std(Ids_00);
figure(1); hold on;
dId_LSB = 5*pico;
y = min(xlim):dId_LSB:max(xlim);
f = exp(-(y-mu).^2./(2*sigma^2))./(sigma*sqrt(2*pi));
plot(y,f,'LineWidth',1.5)

回答 (1 件)

supernoob
supernoob 2018 年 4 月 13 日
Hi there, it looks like you are plotting on two separate figures. Try starting with something like: figure(100); hold on ---rest of your code goes here---

カテゴリ

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