Example of Fig 4.3

Covariance

function [lam]=example041(varargin)
%
% Show covariance explained converges to Rand distribution
%

flon = [ 0 360];lonbox=flon;
flat = [ -90 90];latbox=flat;
vlat = [ 34 60 30];
vlon = [ 210 220 280];
ilat = [ 34 41 33];
ilon = [ 56 59 75];
k = 3  %      Only threee independent vectors
s = [96 48];
lnorm = 'full';
tit = ' Z500 Geopotential Heights';
[zt,ind,fcos]=readz500(latbox,lonbox,'season','jfm','scaling','yes');

[zold,sdz]=anomaly(zt,lnorm);

k=3
ibase=ceil(linspace(1,34,k)), size(zold)
zbase=zold(:,ibase); size(zbase)

clf;

number = [ 50 100 500];

for i=1:3
zcof=2*rand(k,number(i))-1;
z = zbase*zcof; size(z)
lam=svds(z,3);
subplot(4,3,i)
lam=lam/sum(lam);
bar(1:3,lam(1:3));
line([0 length(lam)+1],[0 0]);
axis([ 0 length(lam)+1 -0.2 1]);
title(['Variance explained for ' num2str(number(i)) ' cases']);
end

zorth=orth(zbase); size(zorth)

for i=1:3
zcof=2*rand(k,number(i))-1;
z = zorth*zcof; size(z)
lam=svds(z,3);
subplot(4,3,i+3)
lam=lam/sum(lam);
bar(1:3,lam(1:3));
line([0 length(lam)+1],[0 0]);
axis([ 0 length(lam)+1 -0.2 1]);
title(['Variance explained for ' num2str(number(i)) ' cases']);
end


orient tall;
print('-dpdf','-painters','-adobecset','example041.pdf');

return;
k =

     3

Normalization full

k =

     3


ibase =

     1    18    34


ans =

        4608          34


ans =

        4608           3


ans =

        4608          50


ans =

        4608         100


ans =

        4608         500


ans =

        4608           3


ans =

        4608          50


ans =

        4608         100


ans =

        4608         500


ans =

    0.3479
    0.3336
    0.3184