Example of Fig 5.5

Coefficients for harmonic wave

function [F,a]=example55
%
%  Eof of signal and noise
%


% Generate signal data

clf;

n=34;
m=20;

u=linspace(0,2*pi,m);
v=linspace(0,2*pi,n);

[x,y]=meshgrid(u);


for j = 1:n
    a(:,:,j) = 10*sin(x - 2*v(j)) + 10*randn(length(u));
    surf(x,y,a(:,:,j)) ; colormap(gray);brighten(0.5);
end

for j = 1:n
    z(:,j) = reshape(a(:,:,j),[m*m 1]);
end

size(z)

[eof,s,v] = svd(z,0); size(eof), size(v)

subplot(2,1,1)
plot(1:n,v(:,1),1:n,v(:,2),'--');
legend('EOF 1','EOF 2');
title(' Time coefficients for propagating wave')

for j = 1:n
    a(:,:,j) = 10*sin(x)*sin(2*v(j)) + 10*randn(length(u));
end

for j = 1:n
    z(:,j) = reshape(a(:,:,j),[m*m 1]);
end

[eof,s,v] = svd(z,0); size(eof), size(v)

subplot(2,1,2)
plot(1:n,v(:,1),1:n,v(:,2),'--');
legend('EOF 1','EOF 2');
title(' Time coefficients for stationary wave')

print('-dpdf','-adobecset','-painters','example132.pdf');

return
ans =

   400    34


ans =

   400    34


ans =

    34    34


ans =

   400    34


ans =

    34    34