% This script plots a set of temperature values
% and indiciates which are higher than average
% and which are lower than average.
% MTHSC 360, Project 1
% D. D. Warner
% 2/3/95

% Run the script to create the data values.
%  This script creates a vector of temperatures
%  (in degrees Celsius).
%  For MTHSC 360, Project 4, 10/10/94.
T = zeros(20,1);
for j=1:20,
   T(j) = 10.0 + 15*rem(j,4) - 0.01*j^2;
end
T

m = length(T);
axis([1 m min(T) max(T)]);
X = 1:m;
plot(X,T,'-r');
hold on
title ('DW''s Plot of Daily Temperatures')
xlabel ('Date')
ylabel ('Temperature')

av = mean(T);
fprintf('The Average Temperature is:  %g\n', av);
plot([1 m],[av av],':c5');

Ihi = 1:m;
Ihi = Ihi(T>av)
fprintf('There are %g temperatures above average.\n', length(Ihi));
plot(Ihi,T(Ihi),'ob');

Ilo = 1:m;
Ilo = Ilo(T<av)
fprintf('There are %g temperatures below average.\n', length(Ilo));
plot(Ilo,T(Ilo),'+g');
hold off
