Suppose that we have this gamma distribution in MATLAB:
I want this part of distribution with higher density (x-axis range). How can I extract this in MATLAB? I fit this distribution using histfit
function.
PS. My codes:
figure;
histfit(Data,20,'gamma');
[phat, pci] = gamfit(Data);
phat =
11.3360 4.2276
pci =
8.4434 3.1281
15.2196 5.7136
When you fit a gamma distribution to your data with [phat, pci] = gamfit(Data);
, phat
contains the MLE parameters.
You can plug this into gaminv
:
x = gaminv(p, phat(1), phat(2));
where p
is a vector of percentages, e.g. p = [.2, .8]
.