Why the EOF gives the total of 99.9

1 visualización (últimos 30 días)
Sophia
Sophia el 4 de Abr. de 2017
Respondida: Chad Greene el 4 de Dic. de 2018
clear all; clc;
data= load('north_x_y_lat_lon');
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.;
load nsidc_sid_1979_2014.mat
% 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;
set(gcf,'MenuBar','none');
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);
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on')
[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%*

Respuestas (2)

Spencer Chen
Spencer Chen el 4 de Abr. de 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.

Chad Greene
Chad Greene el 4 de Dic. de 2018
This line in caleof is the culprit:
expvar(iN)=fix((dsum(iN)*100/sum(dsum))*10)/10;
The fix function rounds down. The part that multiplies by 10 and later divides by 10 is a way of rounding to down to the nearest 0.1 percent. It is probably better to replace that line with:
expvar(iN)=dsum(iN)*100/sum(dsum);

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by