%
%  Example 6.18b: Trend Removal
%
%  Bob Newell, March 1996
%------------------------------------------------------------
load nitrogen.dat;
%
t = nitrogen(:,1);
tkn = nitrogen(:,3);
%
disp( 'TKN Data' );
[z,sl] = trend( tkn, 2 );
%
tm = mean( t );
tkn1 = tkn - sl * ( t - tm );
disp( 'Adjusted TKN Data' );
trend( tkn1, 2 );
%
fontsz = 24;
figure
plot( t, tkn1, '-', t, tkn, '--' )
axis([0 120 20 160]);
set( gca, 'fontsize', fontsz );
xlabel( 'Time in hours' );
ylabel( 'Concentration in mg/l' );
h = text( 90, 95, 'Adjusted' );
set( h, 'fontsize', fontsz );
h = text( 100, 30, 'Raw' );
set( h, 'fontsize', fontsz );
%
print -f1 -deps2 ex6-14b.eps
%
