

Our stop band matches our intial design of being below -40dB and our passband ripple has been reduced. With scaling, we see the frequency spectrum is much better behaved than that of Figure 4. Title('Frequency Spectrum W/ Scaling - Blue(Octave), Red(8-Bit Quantized)')

In order to tame the response, we need to scale the coefficients. Scaling the coefficients maximizes the range of values the coefficients can take in an actual processing system, which in turn minimizes quantization noise error. This is because our quantization noise shown in Figure 3 has been added to our initial design. The stop band is well above -40dB and the passband has some terrible ripple. It's easy to see from Figure 4 that the quantization spectrum in red is FAR off from our initial design. Quantization Error and Quantization Error Spectrum Title('Frequency Spectrum - Blue(Octave), Red(8-Bit Quantized)')
Plot filter designer output matlab code#
The output would simply be that impulse touching each tap ($$b_ = floor(hc*2^8)/(2^8)$$ This will give us 8-bit quantized coefficients we can store in a float variable type.Īdd the following code to compute the quantized coefficients, the quantization error, the quantization error spectrum, and a comparison between the frequency spectrum calculated in Octave and one we would implement on an 8-bit microprocessor. Imagine passing a signal of one time sample duration with a magnitude of 1 into x. The impulse response is just the coefficients of the filter. We can take a look at the impulse response of the filter by plotting the variable 'hc':Īssuming some prior knowledge of DSP, recall that in processing an FIR, it has the topology of Figure 2 below. This tutorial will outline the steps necessary to implement your filter in actual hardware.įor reference, the code from Part 1 is listed below: close all In Part 1 we focused on designing a digital filter in Octave/Matlab.
