% IIR_order_15.m % Calculating IIR filter coefficients of 6th Order highpass IIR Filter % Numerator coefficients for first order lowpass B00 = 28955; B01 = -28955; B02 = 0; % Denominator coefficients for first order filter A00 = 32767; A01 = -25143; A02 = 0; % Numerator coefficients for second order lowpass B10 = 27266; B11 = -27266 * 2 ; B12 = 27266; % Denominator coefficients for second order lowpass A10 = 32767; % Always 1.0000 A11 = -26754 * 2; A12 = 22629; sos = [ B10 B11 B12 A10 A11 A12 ; B10 B11 B12 A10 A11 A12 ; B10 B11 B12 A10 A11 A12 ]; % Convert second order sections to transfer function [b, a] = sos2tf( sos ); Fs = 48000 % Sampling frequency [H,f] = freqz ( b, a, 512, Fs) magnitude = 20 * log10(abs(H)); plot ( f, magnitude), grid on xlabel ('Frequency (Hz)'); ylabel ('Magnitude Response (dB)'); title ('2000 Hz Sixth Order IIR High Pass Filter Using BLT. 48000 Hz Sampling'); set (gca, 'xlim', [0, 12000]) set (gca, 'XTick', [0, 2000, 4000, 6000, 8000, 10000, 12000]) set (gca, 'XTickLabel', [0 2000 4000 6000 8000 10000, 12000]) set (gca, 'ylim', [-42, 6]) set (gca, 'YTick', [-42, -36, -30, -24, -18, -12, -6, 0, 6]) set (gca, 'YTickLabel', [-42, -36,-30, -24, -18, -12, -6, 0, 6]) zplane ( b, a)