Example of Fig 4.18

A note on interpretation of EOF (2)

% Overlapping signal data

function [F,a]=example418
close('all');

n=34;
m=10;

nooverlap(n,m,'random','random');
return

function nooverlap(n,m,phase,label)

figure;
u=linspace(0,2*pi,m);
ubig=linspace(0,2*pi,2*m);
vt=linspace(0,2*pi,n);

[x,y]=meshgrid(u);
[xb,yb]=meshgrid(ubig);
c= ones(2*m,2*m,n);

if ischar(phase)
    at=diag(randn(n));
    bt=diag(randn(n));
    phlab='Random Phase';
else
    at=sin(vt)';
    bt=sin(vt+phase)';
    switch round(pi/phase)
        case Inf
        phlab='No Phase Difference ';
        case 1
         phlab='Phase Difference \pi';
        otherwise
        phlab=['Phase Difference  \pi /' num2str(round(pi/phase),1)];
    end
end

ct=diag(randn(n));

for j = 1:n
    a(:,:,j) = 1*sin(0.5*x).*sin(0.5*y).*at(j);
    b(:,:,j) = 1*sin(0.5*x).*sin(0.5*y).*bt(j);
    d(:,:,j) = 0.25*sin(1*xb).*sin(1*yb).*ct(j) ;
    c(:,:,j) = d(:,:,j) + ...
        [zeros(length(u)), a(:,:,j); b(:,:,j), zeros(length(u))];
end
mz=zeros(size(a(:,:,1)));
mvara= sum(sum(var(a,0,3)));
mvarb= sum(sum(var(b,0,3)));
mvard= sum(sum(var(d,0,3)));
mvart= sum(sum(var(c,0,3)));

subplot(3,3,1)
surf([mz, a(:,:,5); mz, mz]);colormap(gray); brighten(0.5);
title([' First Mode '],'fontname','times')
subplot(3,3,2)
surf([mz,mz;b(:,:,5),mz]);colormap(gray); brighten(0.5);
title([' Second Mode '],'fontname','times')
subplot(3,3,3)
surf(d(:,:,5));colormap(gray); brighten(0.5);
title([' Third Mode '],'fontname','times')

%Second row EOF

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

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

lam=s.^2/sum(s.^2);

subplot(3,3,4)
surf(reshape(eof(:,1),[2*m 2*m]));colormap(gray); brighten(0.5);
title([' First EOF --  Variance '   num2str(100*lam(1),'%2.0f') '%'],'fontname','times')
subplot(3,3,5)
surf(reshape(eof(:,2),[2*m 2*m]));colormap(gray); brighten(0.5);
title([' Second EOF --  Variance '   num2str(100*lam(2),'%2.0f') '%'],'fontname','times')
subplot(3,3,6)
surf(reshape(eof(:,3),[2*m 2*m]));colormap(gray); brighten(0.5);
title([' Third EOF --  Variance '   num2str(100*lam(3),'%2.0f') '%'],'fontname','times')

%Third row Time development

subplot(3,2,5)
plot(1:n,at,'-',1:n,bt,'--');
title('Time evolution of the physical modes' ,'fontname','times')
subplot(3,2,6)
plot(1:n,v(:,1),'-',1:n,v(:,2),'--',1:n,v(:,3),':');
title('Time evolution of the EOF','fontname','times')


h=suptitle(['Overlapping -- ' phlab]);

set(h,'fontname','times','fontsize',24);

orient landscape;
print('-dpdf','-painters','-adobecset',[mfilename  label '.pdf']);

return