Why the EOF gives the total of 99.9

Sophia (view profile)

on 4 Apr 2017

on 4 Dec 2018
clear all; clc;
datacoord = reshape(data, 361,361,4);
lat = squeeze(datacoord(:,:,3));
long = squeeze(datacoord(:,:,4));
years = 1979:2015;
long1 = long(1:10:end,1:10:end);
lat1 = lat(1:10:end,1:10:end);
rlong = long*pi/180.;
rlat = lat*pi/180.;
% change the matrix to the size 36*361*361 (required for map2mat)
M = [];
for i = 1:36,
M(i,:,:) = mm_r(:,:,i);
end
%take every 10th pixel to make the calculation easier
g = M(:,1:10:end,1:10:end);
%Replace NaN's with zeros
g(isnan(g)) = 0;
%change it into (time*pt)
G = map2mat(ones(size(g,2),size(g,3)),g);
N = 2;
for method = 1:4;
% method=1;
[E,pc,expvar] = caleof(G,N,method);
eof = mat2map(ones(size(g,2),size(g,3)),E);
figure(method);clf;iw=1;jw=N+1;
posi = [576 0 710 205];
set(gcf,'position',[posi(1) (method-1)*250+50 posi(3) posi(4)]);
for i=1:iw*jw
if i<= iw*jw-1
C = squeeze(eof(i,:,:));
subplot(iw,jw,i);
[cs,h] = m_contourf(long1,lat1,C,50,'linestyle','none');
colorbar;
% clabel(cs,h);
m_grid('linewi',1,'tickdir','out',...
'xtick', [],'ytick',[])
m_coast('patch',[.6 .6 .6],'edgecolor','k')
title(strcat('EOF:',num2str(i),'/',num2str(expvar(i)),'%'));
axis square;
%caxis([cont(1) cont(end)]);
else
subplot(iw,jw,iw*jw);
plot(pc');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N]'),2);
box on
end %if
end %for i
title(strcat('METHOD:',num2str(method)));
end %for method
• I have two questions regarding the caleof function-1. Why the method 1 and 3 gives the same result and method 2 and 4 gives the same result2. when i am trying to change the N to 2,3 4.. every time the total of the respective PC's is 99.9%*

Spencer Chen (view profile)

on 4 Apr 2017

Running error, perhaps.
caleof is not a built-in Matlab function. You are probably using the File Exchange toolbox:
https://www.mathworks.com/matlabcentral/fileexchange/17915-pcatool?focused=5095377&tab=function
Maybe you should ask the question there.