Using map2mat for eof analysis!

조회 수: 5 (최근 30일)
Sophia
Sophia 2017년 3월 13일
댓글: Sophia 2017년 5월 16일
I have a matrix mm_r of the size 361*361*36; where 36 represent the number of years
i need to make it of size 36*130321
% Get EOFs:
G = map2mat(ones(size(mm_r,3),size(mm_r,2)),mm_r);
  • *the error message is Attempted to access F(37,1); index out of bounds because size(F)=[36,361].
Error in map2mat (line 30) if F(ix,iy)>0**
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 3월 13일
Is mat2map from the pcatool File Exchange contribution?
Sophia
Sophia 2017년 3월 15일
Yes, it is from pcatool file excahnge.

댓글을 달려면 로그인하십시오.

답변 (3개)

Chad Greene
Chad Greene 2017년 3월 13일
Hi Sophia,
Be careful, because map2mat assumes the first dimension is time. For normal climate data (lon*lat*time or lat*lon*time) it's probably easier to use eof, which does all the reshaping for you.
  댓글 수: 6
Sophia
Sophia 2017년 5월 16일
편집: Sophia 2017년 5월 16일
Hi
I used your eof technique as well..Somehow, does not matter what i choose as N, I mean 2 or 3 the total of all the eof is 99.9%, is there a reason for that or i am missing something..take a look at the codes below
Sophia
Sophia 2017년 5월 16일
I changed it to 36, it seems somehow better now. is it like that ??

댓글을 달려면 로그인하십시오.


Sophia
Sophia 2017년 5월 16일
** the total is 99.9% **
clear all; clc;
data= load('north_x_y_lat_lon');
datacoord = reshape(data, 361,361,4);
lat = squeeze(datacoord(:,:,3));
long = squeeze(datacoord(:,:,4));
rlong = long*pi/180.;
rlat = lat*pi/180.;
load nsidc_sid_1979_2014.mat
N1=2;
[eof_maps,pc,expv] = eof(t_u,2);
[eof_maps1,pc1,expv1] = eof(t_v,2);
figure(1);clf;iw=1;jw=N1+2;
set(gcf,'MenuBar','none');
for i=1:iw*jw
if i<= iw*jw-2
C1 = squeeze(eof_maps(:,:,i));
C2 = squeeze(eof_maps1(:,:,i));
pc_u = pc';
pc_v = pc1';
subplot(iw,jw,i);
m_proj('stereographic','lat',90,'long', 300,'radius',35,'rect','on')
m_grid('linewi',1,'tickdir','out',...
'xtick',[],'ytick',[])
m_quiver(long(1:10:361,1:10:361), lat(1:10:361,1:10:361),-C1(1:10:361,1:10:361),-C2(1:10:361,1:10:361),2,'k')
m_coast('patch',[.6 .6 .6],'edgecolor','k')
axis on
set(gca,'Xticklabel',[])
set(gca,'Yticklabel',[])
title(strcat('EOF:',num2str(i),'/',num2str(expv(i)),'%'));
else
subplot(iw,jw,iw*jw-1);
plot(pc_u(:,1),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,1),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw);
plot(pc_u(:,2),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,2),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
end
end

Sophia
Sophia 2017년 5월 16일
the total again is 99.9%
clear all; clc;
data= load('north_x_y_lat_lon');
datacoord = reshape(data, 361,361,4);
lat = squeeze(datacoord(:,:,3));
long = squeeze(datacoord(:,:,4));
rlong = long*pi/180.;
rlat = lat*pi/180.;
load nsidc_sid_1979_2014.mat
N1=3;
[eof_maps,pc,expv] = eof(t_u,3);
[eof_maps1,pc1,expv1] = eof(t_v,3);
figure(1);clf;iw=1;jw=N1+3;
set(gcf,'MenuBar','none');
for i=1:iw*jw
if i<= iw*jw-3
C1 = squeeze(eof_maps(:,:,i));
C2 = squeeze(eof_maps1(:,:,i));
pc_u = pc';
pc_v = pc1';
subplot(iw,jw,i);
m_proj('stereographic','lat',90,'long', 300,'radius',35,'rect','on')
m_grid('linewi',1,'tickdir','out',...
'xtick',[],'ytick',[])
m_quiver(long(1:10:361,1:10:361), lat(1:10:361,1:10:361),-C1(1:10:361,1:10:361),-C2(1:10:361,1:10:361),2,'k')
m_coast('patch',[.6 .6 .6],'edgecolor','k')
axis on
set(gca,'Xticklabel',[])
set(gca,'Yticklabel',[])
title(strcat('EOF:',num2str(i),'/',num2str(expv(i)),'%'));
else
subplot(iw,jw,iw*jw-2);
plot(pc_u(:,1),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,1),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw-1);
plot(pc_u(:,2),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,2),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw);
plot(pc_u(:,3),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,3),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
end
end

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by