% Tony Hyun Kim
% EE 278B, PS #7, Problem 5(c)
clear all; close all;

alphas  = [1 5 20];
Nalphas = length(alphas);

t = linspace(0,5,1e3);
Nsamples = 5; % Number of sample paths per alpha
for i = 1:Nalphas
    alpha = alphas(i);
    subplot(Nalphas,1,i);
    
    X = rand(Nsamples,2); % Format: (F,Theta)
    X(:,1) = alpha/pi*tan(pi*(X(:,1)-1/2));
    X(:,2) = 2*pi*X(:,2);
    for j = 1:Nsamples
        x = cos(2*pi*X(j,1)*t+X(j,2)); % Sample path
        plot(t,x); hold on;
    end
    title(sprintf('\\alpha = %d',alpha));
end
orient tall;