I'm trying to implement an 8th order IIR filter and every application note and textbook I've read says that it is best to implement any filter of order more than 2 as second order sections. I used tf2sos
in MATLAB to get the coefficients for second order sections which gave me a 6x4 coeffs for 4 second order sections, as expected. Prior to implementation as SOS, the 8th order filter required 7 previous sample values to be stored (and output values as well). Now when implementing as second order sections how does the flow work from input to output, do I need to store only 2 previous sample values? Or does the output of the first filter feed as x_in
in to the second filter and so on?
Answer
It's the last thing you said ("Or does the output of the first filter feed as x_in in to the second filter and so on?"). The idea is simple: you treat the biquads as separate second-order filters that are in cascade. The output from the first filter is the input to the second, and so on, so the delay lines are spread out among the filters. If you need to optimize the structure in a memory-constrained environment, you can note that adjacent biquads have redundant delay memory (i.e. the last few output samples of stage 1 are the same as the last few input samples of stage 2, so you don't have to store them separately like you would if you just implement the filters in isolation).
No comments:
Post a Comment