How to make a smoother pdf plot?

2 Ansichten (letzte 30 Tage)
Hydro
Hydro am 13 Aug. 2018
Beantwortet: Nicholas Galang am 13 Aug. 2018
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)

Antworten (1)

Nicholas Galang
Nicholas Galang am 13 Aug. 2018
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.

Community Treasure Hunt

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

Start Hunting!

Translated by