% Depth Migration with Straight Ray Assumption.
[vave vaves]=vavemod(dz,nz);
[MIG_depth1]=migrate_vave(stack,nx,nz,nt,dt,ap,dx,dz,vave,TOZS,TOZE);
[MIG_depth1s]=migrate_vave(stack,nx,nz,nt,dt,ap,dx,dz,vaves,TOZS,TOZE);
%stackd2=cat(2,-diff(stack,2,2),zeros(nx,2));
%[MIG1]=migrate_vave(stackd2,nx,nz,nt,dt,ap,dx,dz,vave,TOZS,TOZE);

%Plot Average Velocity Model
figure;
imagesc(x,dz*[1:nz],vave',[1500 3000]);
title('Average Velocity Model','FontSize',18);
xlabel('X (m)','FontSize',16);
ylabel('Depth (m)','FontSize',16);
colorbar;

%Plot Average Velocity Model
figure;
imagesc(x,dz*[1:nz],vaves',[1500 3000]);
title('Smoothed Average Velocity Model','FontSize',18);
xlabel('X (m)','FontSize',16);
ylabel('Depth (m)','FontSize',16);
colorbar;

% Plot Migration Result
migdmax=0.2*max(MIG_depth1(:));
figure;
imagesc(x,z,MIG_depth1',[-migdmax migdmax]);
title('Migrated Section with Straight Ray Assumption','FontSize',18);
xlabel('X (m)','FontSize',16);
ylabel('Depth (m)','FontSize',16);
colormap('gray');

% Plot Migration Result
figure;
imagesc(x,z,MIG_depth1s',[-migdmax migdmax]);
title('Migrated Section with Straight Ray Assumption','FontSize',18);
xlabel('X (m)','FontSize',16);
ylabel('Depth (m)','FontSize',16);
colormap('gray');  