Figure 4 shows the resulting desired magnitude response of our loop filter as calculated from the EDR..
The code segments demonstrates how we fitted a filter using invfreqz and stmcb.
% Note that Hmin corresponds to the response of the min-phase filter % that we want to fit to obtain filter parameters using invfreqz wH = (0:Npt/2)*2*pi/Npt; wH(1) = wH(2); wt = 1./wH; [B,A] = invfreqz(Hmin(1:Npt/2+1),wH,25,25,wt); figure;freqz(B,A) title('freqz of filter obtained using invfreqz'); % % Obtain filter parameters using stmcb hdesired = real(ifft(Hmin)); figure;plot((0:length(hdesired)-1)/fs,(hdesired)); title('impulse response of min phase filter') xlabel('seconds'); ylabel('amplitude'); [stmb,stma] = stmcb(hdesired,40,40); figure;freqz(stmb,stma) title('freqz of filter obtained using stmcb');
Figure 8 shows the result obtained for this example using stmcb from the Matlab Signal Processing Tool Box.
Plotting the results in Matlab is simple, as the following code segments shows. Note that Matlab's freqz function takes as arguments the coefficients of a filter plots the magnitude and phase responses of the described filter.
figure;freqz(B,A) title('freqz of filter obtained using invfreqz'); figure;freqz(stmb,stma) title('freqz of filter obtained using stmcb');