% Illustrate the effect of depth-to-time conversion errors using
% log-related and seismic functions
global S4M %#ok
% Create a Ricker wavelet
% Create a synthetic well log
% Integrate sonic to get two-way time (adds new curve with mnemonic 'twt')
% Extract vector with two-way time from the log
% Define a sinusoidal depth-time conversion error function and add
% it as log curve with mnemonic 'error'
% For each of the amplitudes "a" defined below
% 1. Create a new log where the two-way time 'twt" is replaced by twt + a*dt_error
% 2. Switch the depth coordinate of the well log to two-way time
% 3. Resample the well log to the uniform sample interval "step" (here 1 ms)
% 4. Compute reflection coefficients
% 5a. For the first "a" compute a synthetic by convolving the
% reflectivity with the wavelet
% 5b. For all other values of "a" append the modified reflectivity to
% the previously computed ones
% 6. Estimate/extract the wavelet
% 7. Save estimated wavelets in a seismic structure vector
if ii == 1
% Compute a synthetic using the unmodified refleclection coefficients (a=0)
% Combine the individual wavelets of the structure vector into one data set
% For display purposes, add to the reflectivity a header with the amplitude
% of the depth-time error of the reflectivity that was used to compute it.
reflect=s_header(reflect,'add','dt_error',a,'ms','Maximum stretch/squeeze of well log');
% For display purposes, add to the wavelet a header with the amplitude of
% the depth-time error of the reflectivity that was used to compute it.
wavelets=s_header(wavelets,'add','dt_error',a,'ms','Maximum stretch/squeeze of well log');
% Compute attributes of the wavelet (such as RMS amplitude, maximom vlue, etc.)
% and add them to the wavelet headers
% Get the header with maxima of the wavelet
% Get the header with the cross-correlation between seismic and
% synthetic computed during wavelet estimation in "s_wavextra".
% Plot all reflection coefficient series; use header 'dt_error'
% for trace annotation
% Plot blow-up of the reflection coefficient series
% Plot seismic headers 'max' (maximum wavelet amplitude) and 'cc_wavelet'
% (cross-correlation between seismic and synthetic) above the wavelets
legend(aux.legend_handle,'Maximum amplitude of wavelet','Correlation coefficient',3)
mysuptitle('Maximum wavelet amplitude vs. correlation coefficient')
% Compute and display the spectra of the individual wavelets