% Produces four plots of different density functions in a 2x2 table. % The exponential, gamma, beta, and normal densities are shown. % Opens a figure opject and sets the borders. figure set(gcf, 'Position', [200, 100, 1100, 800]) % Set some style parameters. fontsize = 18; linewidth = 2; % Using '-k' in plot calls uses a solid black line rather than the default blue. % Plot the exponential density. x = 0:(8/500):8; exponentialDensity = exppdf(x, 1); subplot(2, 2, 1) plot(x, exponentialDensity, '-k', 'LineWidth', linewdith) set(gca, 'Box','off', 'FontSize', fontsize, ... 'XTick', 0:2:8, 'YTick', [], 'TickDir', 'out') % Plot the gamma density. x = 0:(10/500):10; gammaDensity = gampdf(x, 2, 1); subplot(2, 2, 2) plot(x, gammaDensity, '-k', 'LineWidth', linewidth) set(gca, 'Box','off', 'FontSize', fontsize, ... 'XTick', 0:2:10, 'YTick', [], 'TickDir', 'out') % Plot the beta density. x = 0:(1/500):1; betaDensity = betapdf(x, 6, 6); subplot(2, 2, 3) plot(x, betaDensity, '-k', 'LineWidth', linewidth) set(gca, 'Box','off', 'FontSize', fontsize, ... 'XTick', 0:0.2:1, 'YTick', [], 'TickDir', 'out') % Plot the normal density. x = -4:(8/500):4; normalDensity = normpdf(x, 0, 1); subplot(2, 2, 4) plot(x, normalDensity, '-k', 'LineWidth', linewdith) set(gca, 'Box','off', 'FontSize', fontsize, ... 'XTick', -4:2:4, 'YTick', [], 'TickDir', 'out')