フィルターのクリア

How to fit a normal distribution curve to a bar graph?

7 ビュー (過去 30 日間)
parslee
parslee 2022 年 12 月 26 日
編集済み: Matt J 2022 年 12 月 26 日
I have a bar plot and I tried fitting a Gaussian distribution curve using normpdf, but it's not working. What am I doing wrong?
lx = linspace(1,32,32);
figure(1)
hold on
bar(diftn)
plot(lx,normpdf(diftn))
  1 件のコメント
parslee
parslee 2022 年 12 月 26 日
編集済み: parslee 2022 年 12 月 26 日
diftn =
0.0401
0.0422
0.0755
0.0914
0.1044
0.1358
0.1955
0.2271
0.2311
0.2337
0.3979
0.3490
0.4389
0.4626
0.7340
1.0000
1.0000
0.7340
0.4626
0.4389
0.3490
0.3979
0.2337
0.2311
0.2271
0.1955
0.1358
0.1044
0.0914
0.0755
0.0422
0.0401

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

採用された回答

Matt J
Matt J 2022 年 12 月 26 日
編集済み: Matt J 2022 年 12 月 26 日
One way,
load diftn
x=(1:numel(diftn))';
fobj=fit(x,diftn,'gauss1');
plot(fobj,x,diftn)

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by