close all;
clear all;

%% Homework 8 Chapter 4 Problem 8

N = 10000;
%Generates N outcomes from the uniform distribution from -1 to 1
X = random('exp',1, 1, N);
Y = random('exp', 1, 1, N);

Z = X + Y; 
figure(1);
%Plot the field generated
subplot(2, 1, 1);
plot(X(:), Y(:), 'xb'); 
title('Field Generated');
xlim([-.1,1.1]);
ylim([-.1,1.1]);

subplot(2, 1, 2);
[n, xout] = hist(Z, 10);
bar(xout,n/N);
title('Z');