How to make a smoother pdf plot?

조회 수: 5 (최근 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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by