Example of Fig 4.15-16-17

A note on interpretation of EOF (1)

% Generate signal data with no overlap

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

n=34;
m=20;

nooverlap(n,m,0,'zero');
nooverlap(n,m,pi/2,'90');
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




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);
    c(:,:,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)));
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 --  Variance '   num2str(100*mvara/mvart,'%2.0f') '%'],'fontname','times')
subplot(3,3,2)
surf([mz,mz;b(:,:,5),mz]);colormap(gray); brighten(0.5);
title([' Second Mode --  Variance '   num2str(100*mvarb/mvart,'%2.0f') '%'],'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(phlab);
%[ax,h]=suplabel(['Non Overlapping Modes ', label],'t');
set(h,'fontname','times','fontsize',24);

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

return