% Matalb script gg250_lab02_1.m
% Prepares four plots of the prime lending rate, the oil price ($/barrel)
% and the inflation rate for the years 1950 - 2003
% The file gg250_lab02_2.dat contains the data
% Date: 9/2/04
% Name: your name

% Load the data file using the load command
;

% Preview the data by typing in the next line "gg250_lab02_2"
% Do not put a semi-colon at the end of the next line!!
gg250_lab02_1

% Create a new array, named "year", which contains the first column of data
;

% Create a new array, named "prime", which contains the first column of data
;

% Create a new array, named "price", which contains the first column of data
;

% Create a new array, named "inflation", which contains the first column of data
;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Plot 1 %%%%%%%%%%%%%%%%%%%%%

% Create a new figure window (figure 1) with Matlab's command "figure"
;

% Clear the window using the matlab command "clf"
;

% Plot the prime lending rate, the oil price ($/barrel)
% and the inflation rate vs. the year in a single plot.
% Use Matlab's plot command and the commands "hold on" and "hold off"
;
hold on;
;
;
hold off

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Plot 2 %%%%%%%%%%%%%%%%%%%%%

% The first plot has no title, the curves are all the same color, 
% the curves aren't identified, and the axes are not labeled.
% So the plot is not so useful.  We can do better.

% Create a new figure window (figure 2) with Matlab's command "figure"
figure(2);

% Clear the window using the matlab command "clf"
clf;

% Plot the prime lending rate, the oil price ($/barrel)
% and the inflation rate vs. the year in a single plot.
% Use Matlab's plot command and one line
plot(year,prime,year,price,year,inflation);

% Title the plot "Prime rate, oil price ($/barrel), inflation rate"
% use Matlab's "title" command
title('Prime rate, oil price ($/barrel), inflation rate')

% Label the horizontal axis as "Year" with Matlab's "xlabel" command
xlabel('Year')

% Add a legend identifying each curve using Matlab's "legend" command
legend('Prime rate', 'oil price ($/barrel)', 'inflation rate')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Plot 3 %%%%%%%%%%%%%%%%%%%%%

% The curves on the second plot all represent different variables,
% so we can't have a common label for the y-axis.  We need to have
% separate plots to have be able to label the y-axes.  We will use Matlab's
% subplot command to create three plots stacked one above the other.

% Create a new figure window (figure 3) with Matlab's command "figure"
;

% Clear the window using the matlab command "clf"
;

%%%%%%%%%%%%%

% Create a three-row subplot, with the folowing plot to be in the
% top row.  Use Matlab's subplot command
;

% Plot the prime lending rate vs. the year and use a red line.
% Use Matlab's plot command
;

% Title the plot "Prime Rate"
% Use Matlab's "title" command
;

% Label the vertical axis as "Prime Rate" with Matlab's "ylabel" command
;

%%%%%%%%%%%%%

% Place the next subplot in the second row.  Use Matlab's subplot command
;

% Plot the oil price vs. the year and use a blue line.
% Use Matlab's plot command
;

% Title the plot "Oil Price ($/barrel)"
% Use Matlab's "title" command
;

% Label the vertical axis as "Oil Price ($/barrel)" with Matlab's "ylabel" command
;

%%%%%%%%%%%%%

% Place the next subplot in the second row.  Use Matlab's subplot command
;

% Plot the inflation rate vs. the year and use a black, 3-point line.
% Use Matlab's plot command
;

% Title the plot "Inflation"
% Use Matlab's "title" command
;

% Label the horizontal axis as "Year" with Matlab's "xlabel" command
;

% Label the vertical axis as "Inflation Rate" with Matlab's "ylabel" command
;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Plot 4 %%%%%%%%%%%%%%%%%%%%%

% The final plot is a scatter plot of the prime rate vs. oil price.

% Create a new figure window (figure 4) with Matlab's command "figure"
;
% Clear the window using the matlab command "clf"
;

%%%%%%%%%%%%%

% Create a two-column subplot, with the folowing plot to be in the
% left (first) column.  Use Matlab's subplot command
;

% Plot the prime  rate vs. oil price (oil price on the horizontal axis).
% Use Matlab's plot command
;

% Title the plot "Prime Rate vs. Oil Price"
% Use Matlab's "title" command
;

% Label the horizontal axis as "Oil Price ($/barrel)" with Matlab's "xlabel" command
;

% Label the vertical axis as "Prime Rate" with Matlab's "ylabel" command
;

%%%%%%%%%%%%%

% Place the next subplot in the second (right) column.  Use Matlab's subplot command
;

% Plot the prime  rate vs. oil price (oil price on the horizontal axis).
% Use Matlab's plot command, and represent the data points with the '*"
% symbol
;

% Title the plot "Prime Rate vs. Oil Price"
% Use Matlab's "title" command
;

% Label the horizontal axis as "Oil Price ($/barrel)" with Matlab's "xlabel" command
;

% Label the vertical axis as "Prime Rate" with Matlab's "ylabel" command
;
