%% Plot Beta Function
% Calculate the beta function for z = 0.05, 0.1, 0.2, and 1 within the interval 0\leq w \leq 10. Loop over values of z, evaluate the function at each one, and assign each result to a row of B.

Z = [0.05 0.1 0.2 1];
W = 0:0.05:10;
B = zeros(4,201);
for i = 1:4
    B(i,:) = beta(Z(i),W);
end

% Plot all of the beta functions in the same figure.

plot(W,B)
grid on
legend('$z = 0.05$','$z = 0.1$','$z = 0.2$','$z = 1$','interpreter','latex')
title('Beta function for $z = 0.05, 0.1, 0.2$, and $1$','interpreter','latex')
xlabel('$w$','interpreter','latex')
ylabel('$B(z,w)$','interpreter','latex')

%
% Copyright 2019 The MathWorks, Inc.