err = norm(wt(:) .* (db(Hp(:))-db(Hph(:))))/norm(wt(:) .* Hp(:)); disp(sprintf(['Relative weighted L2 norm of frequency ', 'db-magnitude response error = %f'],err));
Conversion to minimum phase is an important preprocessing step for phase-sensitive filter-design methods when the desired frequency response is given as the FFT of a measured impulse response with an unknown excess delay. Otherwise, the leading zeros can be trimmed away manually. Further discussion on this point appears in [11].
Note that minphaseir will give poor results (in the form of time-aliasing) if there are poles or zeros too close to the unit circle in the plane. To address this, the spectrum of h can be smoothed to eliminate any excessively sharp peaks or nulls. The requirement is that the inverse-FFT of the log magnitude spectrum H = fft(h) must not time-alias appreciably at the FFT size used (which is determined by the smoothness and the amount of zero padding used in the FFT).
function [hmp] = minphaseir(h) % % MINPHASEIR - Convert a real impulse response to its % minimum phase counterpart % USAGE: % [hmp] = minphaseir(h) % where % h = impulse response (any length - will be zero-padded) % hmp = min-phase impulse response (at zero-padded length) nh = length(h); nfft = 2^nextpow2(5*nh); Hzp = fft(h,nfft); Hmpzp = exp( fft( fold( ifft( log( clipdb(Hzp,-100) ))))); hmpzp = ifft(Hmpzp); hmp = real(hmpzp(1:nh)); |
In summary, a second-order analog transfer-function was fit to each RTFMT-measured frequency response using invfreqs in Octave. Closed-form expressions relating the returned coefficients to , peak-frequency, and peak-gain were used to obtain these parameters.