% 1 floater 2 pts
figure(1)

ls;
load obs_float_test.dat;
whos;
obs_float_test (1:4,:)
x=obs_float_test (1:2:40,4)
y=obs_float_test (2:2:40,4)
x=x+1
y=y+1
plot(x(1),y(1),'+')
hold on;
plot(x(20),y(20),'>')
hold on;
plot(x(1:20),y(1:20),'+');
hold on;
plot(x(1:20),y(1:20),'-r')
hold on;
load rfloat_total.dat
rfloat_total(:,:)
x2=rfloat_total(:,4)
y2=rfloat_total(:,3)
x2=x2+1
y2=y2+1
[k,h]=size(x2);
plot(x2(2),y2(2),'+')
hold on;
plot(x2(k-1),y2(k-1),'>')
hold on;
plot(x2(2:k-1),y2(2:k-1),'+')
hold on;
plot(x2(2:k-1),y2(2:k-1),'-g')
hold on;

load uv_total.dat;
whos;
X=uv_total(:,end-3);
Y=uv_total(:,end-2);
X=X+1;
Y=Y+1;
U=uv_total(:,end-1);
V=uv_total(:,end);
quiver(X,Y,U,V,'r');
X=X+1;
Y=Y+1;
load vel_bck_all.dat;
whos;
X=vel_bck_all(:,end-3);
Y=vel_bck_all(:,end-2);
U=vel_bck_all(:,end-1);
V=vel_bck_all(:,end);
quiver(X,Y,U,V,'b');

load vel_next_all.dat;
whos;
X=vel_next_all(:,end-3);
Y=vel_next_all(:,end-2);
U=vel_next_all(:,end-1);
V=vel_next_all(:,end);
quiver(X,Y,U,V,'g');
figure(2)

it=find(vel_next_all(:,1)==1);
T1=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==2);
T2=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==3);
T3=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==4);
T4=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==5);
T5=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==6);
T6=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==7);
T7=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==8);
T8=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==9);
T9=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==10);
T10=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==11);
T11=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==12);
T12=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==13);
T13=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==14);
T14=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==15);
T15=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==16);
T16=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==17);
T17=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==18);
T18=reshape(vel_next_all(it,4),58,87);
it=find(vel_next_all(:,1)==19);
T19=reshape(vel_next_all(it,4),58,87);

T=(T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12+T13+T14+T15+T16+T17+T18+T19)/19;

it=find(vel_bck_all(:,1)==1);
A1=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==2);
A2=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==3);
A3=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==4);
A4=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==5);
A5=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==6);
A6=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==7);
A7=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==8);
A8=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==9);
A9=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==10);
A10=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==11);
A11=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==12);
A12=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==13);
A13=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==14);
A14=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==15);
A15=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==16);
A16=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==17);
A17=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==18);
A18=reshape(vel_bck_all(it,4),58,87);
it=find(vel_bck_all(:,1)==19);
A19=reshape(vel_bck_all(it,4),58,87);

A=(A1+A2+A3+A4+A5+A6+A7+A8+A9+A10+A11+A12+A13+A14+A15+A16+A17+A18+A19)/19;
F=(A-T).^2
imagesc(F)

figure(3)
it=find(uv_total(:,1)==1);
I1=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==2);
I2=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==3);
I3=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==4);
I4=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==5);
I5=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==6);
I6=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==7);
I7=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==8);
I8=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==9);
I9=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==10);
I10=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==11);
I11=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==12);
I12=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==13);
I13=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==14);
I14=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==15);
I15=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==16);
I16=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==17);
I17=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==18)
I18=reshape(uv_total(it,4),58,87);
it=find(uv_total(:,1)==19)
I19=reshape(uv_total(it,4),58,87);

I=(I1+I2+I3+I4+I5+I6+I7+I8+I9+I10+I11+I12+I13+I14+I15+I16+I17+I18+I19)/19;
F1=(A-I).^2;
imagesc(F1)

F2=(I-T).^2;
figure(4)
imagesc(F2)
