% Time migration with Constant Velocity
c=ones(nx,nt)*1500; % Migration with water velocity.
%c=ones(nx,nt)*3000;% What will happen if the velocity is chaned to 3000m/s?

% Time Migration Code.
[MIG_t_const]=timemigrate(stack,nx,nz,nt,dt,ap,dx,dz,c,TOTS,TOTE);

% Plot Migrated Section with Constant Velocity
maxtmigc=0.2*max(MIG_t_const(:));
figure;
imagesc(x,t,MIG_t_const',[-maxtmigc maxtmigc]);
title('Migrated Section with Constant Velocity','FontSize',18);
xlabel('X (m)','FontSize',16);
ylabel('TWT (msec)','FontSize',16);
colormap('gray');        

% % Stacking velocity is often used as RMS velocity for time migration.
% % RMS Velocity Model for Time Migration
% [vstk vstksmth]=vrmsmodel;

% [MIG_time]=timemigrate(stack,nx,nz,nt,dt,ap,dx,dz,vstk,TOTS,TOTE);
% [MIG_timesmth]=timemigrate(stack,nx,nz,nt,dt,ap,dx,dz,vstksmth,TOTS,TOTE);
% 
% %Plot Smoothed Stacking velocity (~RMS Velocity Model)
% figure;
% imagesc(x,dt*[1:nt],vrms');
% title('Stacking Velocity','FontSize',18);
% xlabel('X (m)','FontSize',16);
% ylabel('TWT (msec)','FontSize',16);
% colorbar;
% 
% figure;
% imagesc(x,dt*[1:nt],vrmssmth');
% title('Smoothed Stacking Velocity','FontSize',18);
% xlabel('X (m)','FontSize',16);
% ylabel('TWT (msec)','FontSize',16);
% colorbar;
% 
% % Plot Migration Result
% migtmax=0.2*max(MIG_time(:));
% figure;
% imagesc(x,t,MIG_time',[-migtmax migtmax]);
% title('Migrated Section with Stacking Velocity','FontSize',18);
% xlabel('X (m)','FontSize',16);
% ylabel('TWT (msec)','FontSize',16);
% colormap('gray');
% 
% % Plot Migration Result
% figure;
% imagesc(x,t,MIG_time',[-migtmax migtmax]);
% title('Migrated Section with Smoothed Stacking Velocity','FontSize',18);
% xlabel('X (m)','FontSize',16);
% ylabel('TWT (msec)','FontSize',16);
% colormap('gray');  
