I am trying to create a script which draws a graph of gamma distribution with a fixed value of shape and a varied value of scale factor. I have written this script however, the graph it plots is completely blank. Any help would be greatly appreciated
4 views (last 30 days)
Show older comments
fprintf('You have choosen 1: Gamma distribution with a fixed value of k with an array of theta values \n');
xmin=input('Please enter an minimum value for x : ');
xmax=input('Please enter an maximum value for x : ');
xinc=input('Please enter an increment value for x : ');
thetamin=input('Please enter an minimum value for the scale factor, k: \n');
thetamax=input('Please enter an maximum value for the scale factor, k: \n');
thetainc=input('Please enter an increment value for the scale factor, k: \n');
k=input('Please enter a value for the constant, shape factor, theta: \n');
hold on
for x = xmin : xinc : xmax
for k = thetamin : thetainc : thetamax;
a = (x.^(k-1));
b = (exp(-x/theta));
d = ((theta^k)*gamma(k));
f = (a*b)/d;
plot(x ,f);
end
end
end
0 Comments
Answers (1)
See Also
Categories
Find more on Gamma Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!