
REstarA = [2400    -1800];
nR = length(REstarA);

Bo=1000;

REwave = 40000;
mu_ratio = 0.0181;
mu1 = 1/REwave;
mu2 = mu1* mu_ratio;

    %figure(1),clf

% index 280  => t=14.00
% index 390  => t=18.30

Call = [1.3304 1.3167];
BB = [14.6111 14.6676];


lfile = sprintf('Collected_Surface_Extract_RE%d_Bo%d',REstarA(1),Bo);
%load(lfile)
%SURF1=SURF;
%keyboard
lfile = sprintf('Collected_Surface_Extract_RE%d_Bo%d',REstarA(2),Bo);
%load(lfile)
%SURF2=SURF;


nt = length(time);


Nxbar = nan*ones(nt,nR);
Nxbar_denoise = nan*ones(nt,nR);
istart = 200; % time=0.5
iend = 358; % t=18.3


Xinst = [35:0.5:38];

ninst = length(Xinst);
Yinst = nan*ones(nt,nR,ninst);
figure(1),clf
nindex = 0;
istart = 220;  iend=460;
for i=istart:iend, %start+1, %iend,  % t=11 to 17.9, 00:300, %iend, %225:225, %istart:iend, %10:390, %280:280, %:nt, 
      for k=1:nR,
        REstar = REstarA(k);          
        Cphase = Call(k);
        Xpk = Cphase*(time)+ BB(k);
          
        eval(sprintf('A = SURF%d{i};',k));
        Y = A.Ys;  X = A.Xs;  Xp = X - Xpk(i);

        ix = xindex(X, Xinst);
        Yinst(i,k,:) = Y(ix);

  end;

end;

subplot(3,1,1)
plot(time,squeeze(Yinst(:,1,:)))

subplot(3,1,2)
plot(time,squeeze(Yinst(:,2,:)))



x0=0.15;  xw=0.8;  
y0=0.2;  yw=0.75;
pos = [ x0 y0 xw yw];

figure(1),
xSize = 8; ySize = 4;  %size of the figure to be generated
set(gcf,'PaperUnits','centimeters')
set(gcf,'PaperPosition',[0 0  xSize ySize])

subplot('position',pos(1,:))

plot(time,squeeze(Yinst(:,1,6)),time,squeeze(Yinst(:,2,6)),'--','linewidth',1)
grid
axis([15 19 0 0.8])
legend('$\mathrm{Re}^*=2400$','$\mathrm{Re}^*=-1800$','location','southeast','interpreter','latex')
xlabel('$\tilde{t}$','interpreter','latex')
ylabel('$\eta/h_0$','interpreter','latex')

set(gcf,'papersize',[xSize ySize],'paperposition',[ 0 0 xSize ySize]);    
print -dpdf -painters ../FinalFigs/FV05_analysis.pdf



%clear SURF1 SURF2 SURF A


%save MOVING1000.mat  

return

