source: altifloat/matlab_toolbox/nemedofthreejtlag3.m @ 160

Last change on this file since 160 was 129, checked in by jbrlod, 10 years ago

last version of Varanth

File size: 10.4 KB
Line 
1clear all
2close all
3
4figure(1)
5
6fid = fopen('obs_float/obs_float_test.dat', 'rb');
7fseek(fid, 0, 'eof');
8fileSize = ftell(fid);
9frewind(fid);
10data = fread(fid, fileSize, 'uint8');
11numLines = sum(data == 10) + 1;
12fclose(fid);
13m=numLines-1;
14n=m/2;
15load obs_float/obs_float_test.dat;
16
17x=obs_float_test (1:2:n,4);
18y=obs_float_test (2:2:n,4);
19% x=x+1;
20% y=y+1;
21plot(x(1),y(1),'+')
22hold on;
23plot(x(n/2),y(n/2),'>')
24hold on;
25plot(x(1:n/2),y(1:n/2),'+');
26hold on;
27plot(x(1:n/2),y(1:n/2),'-r')
28hold on;
29
30x3=obs_float_test (n+1:2:m,4);
31y3=obs_float_test (n+2:2:m,4);
32% x3=x3+1;
33% y3=y3+1;
34plot(x3(1),y3(1),'+')
35hold on;
36plot(x3(n/2),y3(n/2),'>')
37hold on;
38plot(x3(1:n/2),y3(1:n/2),'+');
39hold on;
40plot(x3(1:n/2),y3(1:n/2),'-r')
41hold on;
42
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?
44
45fid = fopen('obs_float/third_observation.dat', 'rb');
46fseek(fid, 0, 'eof');
47fileSize = ftell(fid);
48frewind(fid);
49data = fread(fid, fileSize, 'uint8');
50numLines = sum(data == 10) + 1;
51fclose(fid);
52m5=numLines-1;
53n5=m5/2;
54load obs_float/third_observation.dat;
55
56x5=third_observation (1:2:m5,4);
57y5=third_observation (2:2:m5,4);
58x=x+1;
59y=y+1;
60plot(x5(1),y5(1),'+')
61hold on;
62plot(x5(n5),y5(n5),'>')
63hold on;
64plot(x5(1:n5),y5(1:n5),'+');
65hold on;
66plot(x5(1:n5),y5(1:n5),'-m')
67hold on;
68
69
70
71%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72fid = fopen('obs_float/rfloat_total.dat', 'rb');
73fseek(fid, 0, 'eof');
74fileSize = ftell(fid);
75frewind(fid);
76data = fread(fid, fileSize, 'uint8');
77numLines = sum(data == 10) + 1;
78fclose(fid);
79p=numLines-1;
80u=p/2;
81load obs_float/rfloat_total.dat
82x2=rfloat_total(1:u,4);
83y2=rfloat_total(1:u,3);
84ligne=1;
85for h=1:3:u
86    x2(h)=obs_float_test(ligne,4);
87    y2(h)=obs_float_test(ligne+1,4);
88    ligne=ligne+2;
89end
90% x2=x2+1;
91% y2=y2+1;
92[k,h]=size(x2);
93plot(x2(1),y2(1),'+')
94hold on;
95plot(x2(k),y2(k),'>')
96hold on;
97plot(x2(1:k),y2(1:k),'+')
98hold on;
99plot(x2(1:k),y2(1:k),'-g')
100hold on;
101
102rfloat_total(:,:)
103x4=rfloat_total(u+1:p,4)
104y4=rfloat_total(u+1:p,3)
105ligne=n+1;
106for h=1:3:u
107    x4(h)=obs_float_test(ligne,4);
108    y4(h)=obs_float_test(ligne+1,4);
109    ligne=ligne+2;
110end
111% x4=x4+1;
112% y4=y4+1;
113[k,h]=size(x4);
114plot(x4(1),y4(1),'+')
115hold on;
116plot(x4(k),y4(k),'>')
117hold on;
118plot(x4(1:k),y4(1:k),'+')
119hold on;
120plot(x4(1:k),y4(1:k),'-g')
121hold on;
122
123%%% To show the same path but forwarded with the bck that is beeing used
124fid = fopen('obs_float/generated_fwd.dat', 'rb');
125fseek(fid, 0, 'eof');
126fileSize = ftell(fid);
127frewind(fid);
128data = fread(fid, fileSize, 'uint8');
129numLines = sum(data == 10) + 1;
130fclose(fid);
131p3=numLines-1;
132u3=p3/3;
133
134load obs_float/generated_fwd.dat
135x11=generated_fwd (1:2:u3,4);
136y11=generated_fwd (2:2:u3,4);
137x=x+1;
138y=y+1;
139plot(x11(1),y11(1),'+')
140hold on;
141plot(x11(u3/2),y11(u3/2),'>')
142hold on;
143plot(x11(1:u3/2),y11(1:u3/2),'+');
144hold on;
145plot(x11(1:u3/2),y11(1:u3/2),'-b')
146hold on;
147
148x13=generated_fwd (u3+1:2:2*u3,4);
149y13=generated_fwd (u3+2:2:2*u3,4);
150x3=x3+1;
151y3=y3+1;
152plot(x13(1),y13(1),'+')
153hold on;
154plot(x13(u3/2),y13(u3/2),'>')
155hold on;
156plot(x13(1:u3/2),y13(1:u3/2),'+');
157hold on;
158plot(x13(1:u3/2),y13(1:u3/2),'-b')
159hold on;
160
161x15=generated_fwd (2*u3+1:2:p3,4);
162y15=generated_fwd (2*u3+2:2:p3,4);
163x3=x3+1;
164y3=y3+1;
165plot(x15(1),y15(1),'+')
166hold on;
167plot(x15(u3/2),y15(u3/2),'>')
168hold on;
169plot(x15(1:u3/2),y15(1:u3/2),'+');
170hold on;
171plot(x15(1:u3/2),y15(1:u3/2),'-b')
172hold on;
173
174%%%% To show the same path but forwarded with the mean that is beeing used
175fid = fopen('obs_float/forwardedbymean.dat', 'rb');
176fseek(fid, 0, 'eof');
177fileSize = ftell(fid);
178frewind(fid);
179data = fread(fid, fileSize, 'uint8');
180numLines = sum(data == 10) + 1;
181fclose(fid);
182p4=numLines-1;
183u4=p4/3;
184%
185load obs_float/forwardedbymean.dat
186x11=forwardedbymean (1:2:u4,4);
187y11=forwardedbymean (2:2:u4,4);
188% x=x+1;
189% y=y+1;
190plot(x11(1),y11(1),'+')
191hold on;
192plot(x11(u4/2),y11(u4/2),'>')
193hold on;
194plot(x11(1:u4/2),y11(1:u4/2),'+');
195hold on;
196plot(x11(1:u4/2),y11(1:u4/2),'-r')
197hold on;
198
199x13=forwardedbymean (u4+1:2:2*u4,4);
200y13=forwardedbymean (u4+2:2:2*u4,4);
201% x3=x3+1;
202% y3=y3+1;
203plot(x13(1),y13(1),'+')
204hold on;
205plot(x13(u4/2),y13(u4/2),'>')
206hold on;
207plot(x13(1:u4/2),y13(1:u4/2),'+');
208hold on;
209plot(x13(1:u4/2),y13(1:u4/2),'-r')
210hold on;
211
212x15=forwardedbymean (2*u4+1:2:p4,4);
213y15=forwardedbymean (2*u4+2:2:p4,4);
214% x3=x3+1;
215% y3=y3+1;
216plot(x15(1),y15(1),'+')
217hold on;
218plot(x15(u4/2),y15(u4/2),'>')
219hold on;
220plot(x15(1:u4/2),y15(1:u4/2),'+');
221hold on;
222plot(x15(1:u4/2),y15(1:u4/2),'-r')
223hold on;
224
225
226load obs_float/uv_total.dat;
227whos;
228X1=uv_total(1:5046,end-3);
229Y1=uv_total(1:5046,end-2);
230X1=X1+1;
231Y1=Y1+1;
232%%%%%%change si pas de temps change
233U1=zeros(5046,1);
234V1=zeros(5046,1);
235e=1;
236for r=1:1:117
237   
238    Unew=zeros(1,5046);
239    Vnew=zeros(1,5046);
240    for count=1:5046
241        Unew(count)=uv_total(e,end-1);
242        Vnew(count)=uv_total(e,end);
243        e=e+1;
244    end
245    U1=U1+Unew';
246    V1=V1+Vnew';
247   
248   
249end
250
251U1=U1./117;
252V1=V1./117;
253%%% Because if the jtlag is 3 we have a set of zeros each 3 time steps in
254%%% the uv_total.
255U1=U1;
256V1=V1;
257% U1=roundn(U1,-6);
258% V1=roundn(V1,-6);
259
260quiver(X1,Y1,U1,V1,2,'r','Autoscale','off');
261%
262% % % load obs_float/unext3d.dat;
263% % %
264% % % unext3d=roundn(unext3d,-6)
265% % % whos;
266% % % X3=unext3d(:,end-2);
267% % % Y3=unext3d(:,end-1);
268% % % U3=unext3d(:,end);
269% % % load obs_float/vnext3d.dat
270% % % vnext3d=roundn(vnext3d,-6)
271% % % V3=vnext3d(:,end);
272% % % quiver(X3,Y3,U3,V3,2,'g','Autoscale','off');
273
274load obs_float/uzero.dat;
275
276uzero=roundn(uzero,-6)
277whos;
278X2=uzero(:,end-2);
279Y2=uzero(:,end-1);
280U2=uzero(:,end);
281load obs_float/vzero.dat
282vzero=roundn(vzero,-6)
283V2=vzero(:,end);
284quiver(X2,Y2,U2,V2,2,'b','Autoscale','off');
285
286
287
288%
289%
290%  figure(2)
291% load obs_float/vel_bck_all.dat
292% vel_bck_all=roundn(vel_bck_all,-6);
293% it=find(vel_bck_all(:,1)==1);
294% Tu=reshape(vel_bck_all(it,4),58,87);
295% Tv=reshape(vel_bck_all(it,5),58,87);
296%
297% load obs_float/uv_total.dat
298%
299% % steps=50
300% % counterr=1;
301% %
302% % Cu=0;
303% % Cv=0;
304% % for ll=1:steps
305% %     Iu=0;
306% %     Iv=0;
307% %     it=counterr:(counterr+5045);
308% % U1=roundn(U1,-6);
309% % V1=roundn(V1,-6);
310%
311%     Cu=reshape(U1,58,87);
312%     Cv=reshape(V1,58,87);
313% %     counterr=counterr+5046;
314% %     Cu=Cu+Iu;
315% %     Cv=Cv+Iv;
316% % end
317%     
318% % Cu=Cu/50;
319% % Cv=Cv/50;
320% F1=(Tu-Cu).^2+(Tv-Cv).^2;
321% imagesc(F1)
322% axis xy
323% colorbar
324%
325% %
326% %  figure(2)
327% % load obs_float/vel_bck_all.dat
328% % it=find(vel_bck_all(:,1)==1);
329% % Tu=reshape(vel_bck_all(it,4),58,87);
330% % Tv=reshape(vel_bck_all(it,5),58,87);
331% %
332% % load obs_float/vel_next_all.dat
333% % it=find(vel_next_all(:,1)==1);
334% % Bu=reshape(vel_next_all(it,4),58,87);
335% % Bv=reshape(vel_next_all(it,5),58,87);
336% %
337% % F=(Bu-Tu).^2+(Bv-Tv).^2
338% % imagesc(F)
339% % axis xy
340% % colorbar
341% % % caxis([0 15*10^-15])
342% % hold on
343% % x=obs_float_test (1:2:n,4);
344% % y=obs_float_test (2:2:n,4);
345% % x=x+1;
346% % y=y+1;
347% % plot(x(1),y(1),'+')
348% % hold on;
349% % plot(x(n/2),y(n/2),'>')
350% % hold on;
351% % plot(x(1:n/2),y(1:n/2),'+');
352% % hold on;
353% % plot(x(1:n/2),y(1:n/2),'-r')
354% % hold on;
355% %
356% % x3=obs_float_test (n+1:2:m,4);
357% % y3=obs_float_test (n+2:2:m,4);
358% % x3=x3+1;
359% % y3=y3+1;
360% % plot(x3(1),y3(1),'+')
361% % hold on;
362% % plot(x3(n/2),y3(n/2),'>')
363% % hold on;
364% % plot(x3(1:n/2),y3(1:n/2),'+');
365% % hold on;
366% % plot(x3(1:n/2),y3(1:n/2),'-m')
367% % hold on;
368% %
369% % figure(3)
370% %
371% % load obs_float/uv_total.dat
372% %
373% % steps=100
374% % counterr=1;
375% %
376% % Cu=0;
377% % Cv=0;
378% % for ll=1:steps
379% %     Iu=0;
380% %     Iv=0;
381% %     it=counterr:(counterr+5045);
382% %     Iu=reshape(uv_total(it,4),58,87);
383% %     Iv=reshape(uv_total(it,5),58,87);
384% %     counterr=counterr+5046;
385% %     Cu=Cu+Iu;
386% %     Cv=Cv+Iv;
387% % end
388% %     
389% % Cu=Cu/100;
390% % Cv=Cv/100;
391% %
392% % F1=(Tu-Cu).^2+(Tv-Cv).^2;
393% % imagesc(F1)
394% % axis xy
395% % colorbar
396% % hold on
397% % x=obs_float_test (1:2:n,4);
398% % y=obs_float_test (2:2:n,4);
399% % x=x+1;
400% % y=y+1;
401% % plot(x(1),y(1),'+')
402% % hold on;
403% % plot(x(n/2),y(n/2),'>')
404% % hold on;
405% % plot(x(1:n/2),y(1:n/2),'+');
406% % hold on;
407% % plot(x(1:n/2),y(1:n/2),'-r')
408% % hold on;
409% %
410% % x3=obs_float_test (n+1:2:m,4);
411% % y3=obs_float_test (n+2:2:m,4);
412% % x3=x3+1;
413% % y3=y3+1;
414% % plot(x3(1),y3(1),'+')
415% % hold on;
416% % plot(x3(n/2),y3(n/2),'>')
417% % hold on;
418% % plot(x3(1:n/2),y3(1:n/2),'+');
419% % hold on;
420% % plot(x3(1:n/2),y3(1:n/2),'-m')
421% % hold on;
422% %
423% % % F2=(Bu-Cu).^2+(Bv-Cv).^2;
424% % % figure(4)
425% % % imagesc(F2)
426% % % axis xy
427% % % colorbar
428% % % hold on
429% % x=obs_float_test (1:2:n,4);
430% % y=obs_float_test (2:2:n,4);
431% % x=x+1;
432% % y=y+1;
433% % plot(x(1),y(1),'+')
434% % hold on;
435% % plot(x(n/2),y(n/2),'>')
436% % hold on;
437% % plot(x(1:n/2),y(1:n/2),'+');
438% % hold on;
439% % plot(x(1:n/2),y(1:n/2),'-r')
440% % hold on;
441% %
442% % x3=obs_float_test (n+1:2:m,4);
443% % y3=obs_float_test (n+2:2:m,4);
444% % x3=x3+1;
445% % y3=y3+1;
446% % plot(x3(1),y3(1),'+')
447% % hold on;
448% % plot(x3(n/2),y3(n/2),'>')
449% % hold on;
450% % plot(x3(1:n/2),y3(1:n/2),'+');
451% % hold on;
452% % plot(x3(1:n/2),y3(1:n/2),'-m')
453% % hold on;
454% %
455% % % figure (5)
456% % % imagesc(F)
457% % % axis([71 77 33 37])
458% % % hold on
459% % x=obs_float_test (1:2:n,4);
460% % y=obs_float_test (2:2:n,4);
461% % x=x+1;
462% % y=y+1;
463% % plot(x(1),y(1),'+')
464% % hold on;
465% % plot(x(n/2),y(n/2),'>')
466% % hold on;
467% % plot(x(1:n/2),y(1:n/2),'+');
468% % hold on;
469% % plot(x(1:n/2),y(1:n/2),'-r')
470% % hold on;
471% %
472% % x3=obs_float_test (n+1:2:m,4);
473% % y3=obs_float_test (n+2:2:m,4);
474% % x3=x3+1;
475% % y3=y3+1;
476% % plot(x3(1),y3(1),'+')
477% % hold on;
478% % plot(x3(n/2),y3(n/2),'>')
479% % hold on;
480% % plot(x3(1:n/2),y3(1:n/2),'+');
481% % hold on;
482% % plot(x3(1:n/2),y3(1:n/2),'-m')
483% % hold on;
484% %
485% % %
486% % % figure (6)
487% % % imagesc(F1)
488% % %
489% % % axis([71 77 33 37])
490% % % hold on
491% % x=obs_float_test (1:2:n,4);
492% % y=obs_float_test (2:2:n,4);
493% % x=x+1;
494% % y=y+1;
495% % plot(x(1),y(1),'+')
496% % hold on;
497% % plot(x(n/2),y(n/2),'>')
498% % hold on;
499% % plot(x(1:n/2),y(1:n/2),'+');
500% % hold on;
501% % plot(x(1:n/2),y(1:n/2),'-r')
502% % hold on;
503% %
504% % x3=obs_float_test (n+1:2:m,4);
505% % y3=obs_float_test (n+2:2:m,4);
506% % x3=x3+1;
507% % y3=y3+1;
508% % plot(x3(1),y3(1),'+')
509% % hold on;
510% % plot(x3(n/2),y3(n/2),'>')
511% % hold on;
512% % plot(x3(1:n/2),y3(1:n/2),'+');
513% % hold on;
514% % plot(x3(1:n/2),y3(1:n/2),'-m')
515% % hold on;
516% %
517% % % sum=0;
518% % % count=0;
519% % % for r=71:76
520% % %     for t=33:37
521% % %         sum=sum+F(t,r);
522% % %         count=count+1;
523% % %     end
524% % % end
525% % % sum=sum/count
526% % %
527% % % sum3=0;
528% % % count3=0;
529% % % for r=71:76
530% % %     for t=33:37
531% % %         sum3=sum3+F1(t,r);
532% % %         count3=count3+1;
533% % %     end
534% % % end
535% % % sum3=sum3/count3
536% % % sum=sqrt(sum/count);
537% % % sum3=sqrt(sum3/count3);
538% % % errorbefore=sum
539% % % errorafter=sum3
Note: See TracBrowser for help on using the repository browser.