Hi A.O.,
As per my understanding, the issue you are encountering is due to the numerical instability of the classic ‘deconv’ function when applied to your specific kernel and signal.
- This is a common occurrence, especially when the kernel contains very small values or zeros in its frequency domain representation.
- In such cases, direct deconvolution can amplify noise and computational errors, resulting in extremely large, infinite, or undefined (NaN) values.
- The classic ‘deconv’ function performs direct division in either the time or frequency domain.If the kernel contains values close to zero, the division becomes unstable and can lead to overflow or undefined results.
A more robust approach in these scenarios is to use ‘Wiener deconvolution’ with a regularization parameter. Wiener deconvolution adds a small constant (epsilon) to the denominator, which prevents division by zero and suppresses the amplification of noise. This makes the deconvolution process much more stable and reliable.
Here is how we can do that:
h_padded = [h; zeros(length(C_full) - length(h), 1)];
Q_wiener_fft = C_fft .* conj(H_fft) ./ (H_fft .* conj(H_fft) + epsilon);
q_wiener = real(ifft(Q_wiener_fft));
q_wiener = q_wiener(1:n1);
By introducing a small regularization term (epsilon), the Wiener deconvolution method mitigates the effects of near-zero denominators and suppresses noise, resulting in a stable and accurate recovery of the original signal as you can see below: