Plotting Gamma Distribution, please help?

14 ビュー (過去 30 日間)
Hydro
Hydro 2014 年 9 月 22 日
編集済み: Benabed Rabia 2018 年 1 月 2 日
These are my code, however, i am not getting the plot.
X=1:100; % Duration of data
Data=rand(1,100); % randomly generated 100 years of data
Z=gamfit(Data); % fitting distribution for shape and scale factor
beta=2; % Shape factor
alpha=3; % scale factor
pdf=gampdf(X,alpha,beta); % pdf of the gamma distribution
Plot(pdf,X,'-');

回答 (5 件)

Youssef  Khmou
Youssef Khmou 2014 年 9 月 22 日
It is correct, you just need to exchange pdf with X :
plot(x,pdf);
  2 件のコメント
Hydro
Hydro 2014 年 9 月 22 日
still giving me the error that:
Index exceeded matrix dimension for this line.
pdf=gampdf(X,alpha,beta);
Youssef  Khmou
Youssef Khmou 2014 年 9 月 22 日
the variables alpha and beta are in the system , change theirs names to Alpha, Beta for example.

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


Mohammed
Mohammed 2014 年 9 月 22 日
編集済み: Mohammed 2014 年 9 月 22 日
Change capital P-letter to small P-letter, MATLAB is case senstive!
plot(pdf,X,'-');

Hydro
Hydro 2014 年 9 月 22 日
here is my plot which i dont think is a gamma distribution plot. my alpha is 3 and my beta is 409.

Hydro
Hydro 2014 年 9 月 22 日
  2 件のコメント
Youssef  Khmou
Youssef Khmou 2014 年 9 月 22 日
X=1:100; ALPHA=3; BETA=2; PDF=gampdf(X,ALPHA,BETA); plot(X,PDF);
Hydro
Hydro 2014 年 9 月 22 日
Thanks Youssef, please have a look at my excel sheet which i am using for this problem...see if you are getting the same as i got up there...sorry for asking too much however, i really need to get this done as i am going to present it soon.
my x is years while alpha and beta were generated from the flow data.
Thanks dear

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


Benabed Rabia
Benabed Rabia 2018 年 1 月 2 日
編集済み: Benabed Rabia 2018 年 1 月 2 日
When i use plot command the graph just links the dots it does not give a curve, please help me! Thanks in advence

Community Treasure Hunt

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

Start Hunting!

Translated by