How to plot Normal probability density function?

46 ビュー (過去 30 日間)
Nisar Ahmed
Nisar Ahmed 2021 年 9 月 3 日
コメント済み: Star Strider 2021 年 9 月 3 日
Hi
I am plotting probability density function by using this command:
mx = mean(RMS_vp); sx = std(RMS_vp); norm_vp = normpdf(RMS_vp,mx,sx);
The problem is shown in the attached figure. First, it do not touches the x axis at left side. Second, when I plot it as solid line (see the image in the center, a lot lines appears as zoom in (blue image).
How can I solve these issues?
  1 件のコメント
Chunru
Chunru 2021 年 9 月 3 日
Can you post your code?

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

採用された回答

Star Strider
Star Strider 2021 年 9 月 3 日
Try something like this:
RMS_vps = sort(RMS_vp);
norm_vp = normpdf(RMS_vp,mx,sx);
figure
plot(RMS_vps, norm_vp)
alternatively:
RMS_vpe = linspace(mx-5*sx, mx+5*sx, 250);
norm_vpe = normpdf(RMS_vpe,mx,sx);
figure
plot(RMS_vpe, norm_vpe)
One (or both) of those should do what you want.
.
  2 件のコメント
Nisar Ahmed
Nisar Ahmed 2021 年 9 月 3 日
Thanks @Star Strider, the second one is working.
Star Strider
Star Strider 2021 年 9 月 3 日
As always, my pleasure!
.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by