# Design of 10th order high pass filter using 2nd order biquads with Matlab and further substitution on to TI AIC3204

I am involved in designing a 10th order high pass filter with cutoff frequency 300Hz.

My hardware AIC3204 has a 5 biquads of direct form I, 24bit coefficient so I have chosen the FDA (filter design and anylysis) tool of MATLAB to design a 10th order filter and convert it to SOS sections 5 such and realize coefficients from it.

This is my procedure:

and realization of direct form I

Coefficients obtained as a file:

%
% Generated by MATLAB(R) 7.12 and the Signal Processing Toolbox 6.15.
%
% Generated on: 05-Aug-2013 15:26:23
%

% Discrete-Time IIR Filter (real)
% -------------------------------
% Filter Structure : Direct-Form I, Second-Order Sections
% Number of Sections : 5
% Stable : Yes
% Linear Phase : No
% Arithmetic : fixed
% Numerator : s24,22 -> [-2 2)
% Denominator : s24,22 -> [-2 2)
% Scale Values : s24,23 -> [-1 1)
% Input : s16,15 -> [-1 1)
% Output : s16,11 -> [-16 16)
% Numerator State : s16,15 -> [-1 1)
% Denominator State : s16,15 -> [-1 1)
% Numerator Prod : s40,37 -> [-4 4)
% Denominator Prod : s40,37 -> [-4 4)
% Numerator Accum : s40,35 -> [-16 16)
% Denominator Accum : s40,35 -> [-16 16)
% Round Mode : convergent
% Overflow Mode : wrap
% Cast Before Sum : true

SOS matrix:
400000 000000 c00000 400000 7ab444 3b9018
400000 000000 c00000 400000 8bd4b8 377a90
400000 000000 c00000 400000 7404d3 34d7f8
400000 000000 c00000 400000 976d93 2b9955
400000 000000 c00000 400000 067eae d364fd

Scale Values:
77c3b6
77c3b6
6f5fe0
6f5fe0
6c9b03


Is my approach correct?

How can these higher order SOS filters be realised?

Your basic approach seems correct so far. To implement your 2nd order filters you have to cascade the biquad filters, so that the output of the first feeds into the input of the next and so on.

This is due to the theorem that the overall transfer function $H(z)$ of $n$ cascaded subsystems is the multiplication of the transfer functions of the respective subsystems $H_i(z)$ like this

$$H(z) = H_1(z) \cdot H_2(z) \cdot \,\, ... \, \cdot H_n(z)$$

So what Matlab gives you, are the coefficients $a_j$ and $b_j$ for the biquad filter transfer functions (called SOS matrix in your result): $$H_{biquad}(z) = \frac{b_0 + b_1z^{-1} + b_2 z^{-2}}{1 + a_1z^{-1} + a_2 z^{-2}}$$

To implement it you should use the Direct Form I in time domain - its just the inverse Z-transform of the transfer function above:

$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2x[n-2] - a_1y[n-1]-a_2y[n-2]$$

Now you just have to cascade the filters, so that the output $y[n]$ of the first feeds into the input $x[n]$ of the next biquad and so on.

You may also want to check a similar question asked here: How does cascading biquad sections for higher order filters work?

And also the documentation of the Matlab biquad filter where it tells you how the SOSMatrix and ScaleValues are defined: Matlab Biquad Documentation

• in the above function Hbiquad my hardware filter has t/f like this H(z)=(N0+2N1*z-1+N2*z-2)/(2^23-2*D1*z-1-D2*z-2) i have set the filter arithmetic to 24 bit and what should be numerator fraction length and denom fractional length ? – kakeh Oct 14 '13 at 15:49
• To get the coefficients you need based on your transfer function you can just equate the coefficients to get the same structure as in the $H_{biquad}$. Regarding the fraction lengths, I am not sure, because I have not implemented a biquad filter on a fixed-point arithmetic system. – lmNt Oct 14 '13 at 22:30