How to make a smoother pdf plot?

6 ビュー (過去 30 日間)
Hydro
Hydro 2018 年 8 月 13 日
回答済み: Nicholas Galang 2018 年 8 月 13 日
Hello,
I am trying to plot X versus it pdf value (Y) using gamma function. the plot i get (Ex#1) is very strange. I want to have a plot like Ex#2. Below is my code so far and i would appreciate any help.
X= [0.78;0.33;0.34;0.12;0.19;0.08;0.13;0.01;0.16;0.1;0.14;0.57;0.6;0.18;0.16;0.62;1.23;0.67;0.43;1.03];
G1=makedist('gamma','a',1.26,'b',0.31);
Y=pdf(G1,X);
plot(X,Y,'LineWidth',2)

回答 (1 件)

Nicholas Galang
Nicholas Galang 2018 年 8 月 13 日
Your X values are out of order causing the graph to look strange. If you were to sort those values it will help smooth out the graph.

カテゴリ

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