%
% GENERATE DATA FROM THE GAMMA DISTRIBUTION
%
% Define the p-values at which the distribution is to be evaluated
x = 0:0.1:40;
% Evaluate the gamma distribution at these values
prob = pdf(makedist('Gamma','a',134,'b',1/7),x);

%
% GENERATE A PLOT FROM THE DATA AND CONTROL ITS APPEARANCE
%
% The figure command generates a figures window
fig=figure(2);
% The set command sets the properties of the figure 'fig'
set(fig,...
    'Color','w',...
    'Name','Gamma Distribution',...
    'PaperSize',[7 5.08],...
    'PaperPosition',[0 0 7 5.07],...
    'InvertHardcopy','off');

% The plot command generates a line plot of the data
h = plot(x,prob,'-');
% The set command sets the properties of the line 'h'
set(h,'LineWidth',2);

% The set command sets the properties of the current axes
set(gca,...
    'FontName','Times New Roman',...
    'FontSize',24,...
    'XTick',0:10:40,...
    'Ytick',0:0.05:0.25,...
    'Color',[0.8 0.8 0.8],...
    'LineWidth',2,...
    'TickLength',[0.02 0.0250],...
    'XLim',[0 40],...
    'YLim',[0 0.25],...
    'Units','inches',...
    'Position',[1.05 0.8 5.77 3.57],...
    'Layer','Top')

% The xlabel and ylabel commands specify the axes labels and their
% properties; they can be interpreted in latex
xlabel('$$x$$',...
    'Interpreter','latex')
ylabel('$$\mathrm{pdf}\,(x|n,k)$$',...
    'Interpreter','latex')

% The text command places text in the figure at a specific position
text(23,0.2,'$$n = 7$$',...
    'Interpreter','latex',...
    'FontSize',24);
text(23,0.13,'$$\sum_{i=1}^7k_i = 133$$',...
    'Interpreter','latex',...
    'FontSize',24);

% The title command defines the title above the axes
title('The gamma distribution')

% The saveas command saves the plot to a file, here a pdf file
saveas(gcf,'gamma_Matlab','pdf');