<< Chapter < Page | Chapter >> Page > |
Next sample the frequency response logarithmically so that low frequencies will be weighted more importantly by the filter. This allows the logarithmic plot of an ideal inverse filter and the inverse filter implemented by FIR coefficients to match (rather than matching only high frequencies). Next use MATLAB’s built in Savitzky Golay [ y = sgolayfilt(x,k,f)] filter to smooth the curve so as to reduce the noise of the response. The motivation behind this was is to prevent the fir2 algorithm from trying to create an inverse filter with the inverse of the noise of the frequency response.
sampfft=thisfft(round(10.^(linspace(0,log10(length(thisfft)),1000)))); %sample fft logrithmicly at 1000 points
smoothfft=sgolayfilt(sampfft, 3, 71);
smoothfft(smoothfft<0)=0; %fix smoothing errors
semilogy(smoothfft)
title('Smoothed Frequency Response');
xlabel('Frequency');
ylabel('Response (dB)');
Notification Switch
Would you like to follow the 'Procedure' conversation and receive update notifications?