book_3_76.m

Remove average seasonal effect using seasonaloess.

load carbondioxide

if ~exist('seasonalPart', 'var')
    % loess parameters for seasonal fit
    period = 12;
    elShort = 25;
    lambdaShort = 1;

    seasonalPart = seasonaloess(Year,CO2,period,elShort,lambdaShort);
end

nonseasonalPart = CO2(:)-seasonalPart(:);

plot(Year,nonseasonalPart);
xlabel('Year')
ylabel('CO_2 (ppm)')
title('Nonseasonal Monthly Average Carbon Dioxide')

% Make a little space around points
ax = axis;
ax(1) = min(Year)-1;
ax(2) = max(Year)+1;
axis(ax)
axis square