Plotting Gamma Distribution, please help?

10 Ansichten (letzte 30 Tage)
Hydro
Hydro am 22 Sep. 2014
Bearbeitet: Benabed Rabia am 2 Jan. 2018
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,'-');

Antworten (5)

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

Melden Sie sich an, um zu kommentieren.


Mohammed
Mohammed am 22 Sep. 2014
Bearbeitet: Mohammed am 22 Sep. 2014
Change capital P-letter to small P-letter, MATLAB is case senstive!
plot(pdf,X,'-');

Hydro
Hydro am 22 Sep. 2014
here is my plot which i dont think is a gamma distribution plot. my alpha is 3 and my beta is 409.

Hydro
Hydro am 22 Sep. 2014
  2 Kommentare
Youssef  Khmou
Youssef Khmou am 22 Sep. 2014
X=1:100; ALPHA=3; BETA=2; PDF=gampdf(X,ALPHA,BETA); plot(X,PDF);
Hydro
Hydro am 22 Sep. 2014
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

Melden Sie sich an, um zu kommentieren.


Benabed Rabia
Benabed Rabia am 2 Jan. 2018
Bearbeitet: Benabed Rabia am 2 Jan. 2018
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