Friday, September 16, 2011

TEST OF MATLAB PUBLISHING


Contents

%practice script from the matlab interactive tutorial
%loading data into the matlab editor

LOADING THE RELEVANT DATA

load annual_temps
%LOADING THE RELEVANT DATA

PLOTTING THE RAW

plot(year,annual)
title('HadCRUT3 Temperature Anomaly Measurements')
xlabel('Year')
ylabel('Temperature Anomaly (°c)')
% PLOTTING THE RAW

PLOTTING THE MEAN

annual_avg = mean(annual);
figure
area(year,annual_avg)
title('Average Annual Temperature Anomaly')
xlabel('Year')
ylabel('Temperature Anomaly (°c)')
 

PLOTTING THE RUNNING AVERAGE

k = 1/5*ones(1,5);
five_year_avg = convn(annual_avg,k,'valid');
plot(year,annual_avg,'--o')
hold on
plot(year(3:end-2),five_year_avg,'r')
legend('Annual Avg', 'Five Year Avg')

No comments:

Post a Comment