# Phase correction using second order all pass filters/LMS with Wiener-Hopf equations

I am working on phase correction algorithms. Can anyone help me understand how can the following diagram be used for phase correction: Additionally, for a channel function suggested How determine the delay in my signal practically, I have tried the following:

Fs = 306.700*1e+3; % sampling rate
Fc = 100*1e+3; % central frequency
B = 4*1e+3;  % bandwidth
N = 3072;
T = (N-1)/Fs;
t = 0:1/Fs:T; %time

baseband_signal = chirp(t,-B/2,t(end),B/2)-i*chirp(t,-B/2,t(end),B/2,'linear',90);

% Modulation
modulated_signal = baseband_signal.*exp(i*2*pi*Fc.*t);
modulated_signal = real(modulated_signal);

% Transmitted signal
tx = modulated_signal.*1.25/max(modulated_signal);

rx = [zeros(1,200) tx];

% Computing equalization filter: rx and tx swapped!
coeff = channel(rx,tx,20);

% Equalization filtering
rx_corrected = filter(coeff, 1,  rx);

figure
freqz(coeff)
title('Equalization filter')

figure
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
legend('initial','corrected')


Shouldn't the equalization suggested here remove the phase delay and have the equalized and transmitted signal aligned?

I actually don't see how the following diagram can be possibly used for phase correction only as it will have an unavoidable amplitude correction as well. An all pass filter by definition will pass all magnitude without modification and only change the phase. The Time Delay block will similarly pass all magnitude without modification with a linear phase versus frequency. The resulting amplitude at the output will be the vector sum of the linear phase component with the all pass component. Since both will have the same magnitude then the sum will be dictated by the phase (for example if there are any frequencies where the phase for each are related by $$pi$$ radians there will be complete cancellation. The only way the resulting diagram can maintain a constant magnitude is if the all pass filter similarly has a linear phase (which is a trivial all-pass and further would not modify phase to perform phase correction).