source: trunk/src/mode_sahelien/lagged_correlations_eof2_eof3_1030.m @ 30

Last change on this file since 30 was 30, checked in by pinsard, 15 years ago

correction of usage of save function

File size: 3.9 KB
Line 
1%
2
3clear;
4close all;
5
6status=load('eof3_1030.txt');
7eof3_1030=status;
8clear status;
9status=load('eof2_1030.txt');
10eof2_1030=status;
11clear status;
12
13eof3_moy=mean(eof3_1030);
14eof2_moy=mean(eof2_1030);
15
16eof3_std=std(eof3_1030);
17eof2_std=std(eof2_1030);
18eof3_1030=zeros(3416);
19eof2_1030=zeros(3416);
20for a=1:3416;
21   eof3_1030(a)=(eof3_1030(a)-eof3_moy)/eof3_std;
22   eof2_1030(a)=(eof2_1030(a)-eof2_moy)/eof2_std;
23end;
24
25correlations2=zeros(21,1);
26correlations3=zeros(21,1);
27
28for a=1:21;
29   if a<12;
30      fin=3416-(11-a);
31      debut=(11-a)+1;
32      x=eof2_1030(1:fin);
33      y2=eof2_1030(debut:3416);
34      y3=eof3_1030(debut:3416);
35   else
36      fin=3416-(a-11);
37      debut=(a-11)+1;
38      y2=eof2_1030(1:fin);
39      y3=eof3_1030(1:fin);
40      x=eof2_1030(debut:3416);
41   end;
42   clear vad;
43   vad=corrcoef(x,y2);
44   correlations2(a)=vad(2,1);
45   clear vad;
46   vad=corrcoef(x,y3);
47   correlations3(a)=vad(2,1);
48end;
49jour=[-10:10]';
50plot(jour,correlations2,'k');
51hold on;
52plot(jour,correlations3,'k--');
53axis([-10 10 -1 1]);
54y=zeros(21,1);
55plot(jour,y,'k');
56
57figure(2);
58orient('landscape')
59
60plot(eof2_1030,eof3_1030,'b.');
61axis([-5 5 -5 5]);
62y=zeros(11,1);
63x=[-5:5]';
64hold on;
65plot(x,y,'k')
66
67XCentre=0;
68YCentre=0;
69Rayon=1.5;
70VTheta=[0:1:360]';
71XCercle=zeros(360);
72YCercle=zeros(360);
73for a=1:360;
74   XCercle(a)=XCentre+Rayon*cos((2*pi*VTheta(a))/360);
75   YCercle(a)=YCentre+Rayon*sin((2*pi*VTheta(a))/360);
76end;
77plot(XCercle, YCercle,'k');
78x=[-0.00001 0]';
79y=[-5 5]';
80plot(x,y,'k');
81x=[-5 5]';
82y=[-5 5]';
83plot(x,y,'k');
84x=[5 -5]';
85y=[-5 5]';
86plot(x,y,'k');
87xlabel('EOF1');
88ylabel('EOF2');
89title('Phase spae points for JJAS days from 1979 to 2006');
90text(-4,-1,'PHASE 1');
91text(-2,-4,'PHASE 2');
92text(1,-4,'PHASE 3');
93text(3,-1,'PHASE 4');
94text(3,1,'PHASE 5');
95text(1,4,'PHASE 6');
96text(-2,4,'PHASE 7');
97text(-4,1,'PHASE 8');
98set (gca,'tick','out');
99
100figure(1);
101print('-depsc2','lag_correlations_eof2_eof3_1030.eps');
102figure(2);
103print('-depsc2','phase_space_diagram_eof2_eof3_1030.eps');
104
105phase1=zeros(3416,3);
106phase2=zeros(3416,3);
107phase3=zeros(3416,3);
108phase4=zeros(3416,3);
109
110phase5=zeros(3416,3);
111phase6=zeros(3416,3);
112phase7=zeros(3416,3);
113phase8=zeros(3416,3);
114
115for a=1:3416;
116   % selection hors du cercle : il faut que la distance soit >1.5
117   if sqrt((eof2_1030(a))^2+(eof3_1030(a))^2) >1.5;
118      if eof3_1030(a)<0  % selection phase 1 2 3 4
119          % selection phase 1
120          if eof3_1030(a)>eof2_1030(a);
121              phase1(a,1)=1;
122              phase1(a,2)=eof2_1030(a);
123              phase1(a,3)=eof3_1030(a);
124          % selection phase 2
125          elseif eof2_1030(a)<0;
126              phase2(a,1)=1;
127              phase2(a,2)=eof2_1030(a);
128              phase2(a,3)=eof3_1030(a);
129          % selection phase 3
130          elseif abs(eof2_1030(a))<abs(eof3_1030(a));
131              phase3(a,1)=1;
132              phase3(a,2)=eof2_1030(a);
133              phase3(a,3)=eof3_1030(a);
134          else
135              phase4(a,1)=1;
136              phase4(a,2)=eof2_1030(a);
137              phase4(a,3)=eof3_1030(a);
138         end;
139      % selection phase 5 6 7 8
140      else
141         % selection phase 5
142         if eof3_1030(a)<eof2_1030(a);
143             phase5(a,1)=1;
144             phase5(a,2)=eof2_1030(a);
145             phase5(a,3)=eof3_1030(a);
146         elseif eof2_1030(a)>0;
147             phase6(a,1)=1;
148             phase6(a,2)=eof2_1030(a);
149             phase6(a,3)=eof3_1030(a);
150         % selection phase 7
151         elseif abs(eof2_1030(a))<abs(eof3_1030(a));
152             phase7(a,1)=1;
153             phase7(a,2)=eof2_1030(a);
154             phase7(a,3)=eof3_1030(a);
155         else
156             phase8(a,1)=1;
157             phase8(a,2)=eof2_1030(a);
158             phase8(a,3)=eof3_1030(a);
159         end;
160      end;
161  end;
162end;
163
164save('phase1.txt','phase1','-ASCII');
165save('phase2.txt','phase2','-ASCII');
166save('phase3.txt','phase3','-ASCII');
167save('phase4.txt','phase4','-ASCII');
168
169save('phase5.txt','phase5','-ASCII');
170save('phase6.txt','phase6','-ASCII');
171save('phase7.txt','phase7','-ASCII');
172save('phase8.txt','phase8','-ASCII');
Note: See TracBrowser for help on using the repository browser.