Dear Team,
I am learning the audio processing algorithm of adsp21489.
Calculate according to the bandpass coefficient in the help document of General 2nd Order.
I tried it in matlab.
The following code
clear;
fs = 48000;
% f1 Low cutoff f2 High cutoff
f2 = 11000;
f1 = 9000;
% center frequency
f0 = sqrt(f1*f2)
% Bandwidth is Bandwidth_in_octaves
Bandwidth_in_octaves = log(f2/f1)/log(2)
gainLinear = 1 ; % (Vo/Vi)
W0 = 2 * pi * f0 / fs
Alpha = sin(W0) * sinh(log(2)/2 * Bandwidth_in_octaves * W0 / sin(W0))
a0 = 1 + Alpha
a1 = -2 * cos(W0)
a2 = 1 - Alpha
b0 = Alpha * gainLinear
b1 = 0
b2 = -Alpha * gainLinear
% Normalized a0
numerator_B = [b0,b1,b2]/a0
denominator_A = [a0,a1,a2]/a0
% Matlab butter()
[b,a] = butter(1,[f1/(fs/2),f2/(fs/2)],'bandpass')
The end of the code uses the Matlab butter() function for comparison.
I found that the calculation results are inconsistent.
Who knows the reason?
I simulated the two results with sigma, and also simulated with bandwidth.Although the difference between the three frequency response curves is very small, I would like to know which of the two calculation methods is correct?
Thank you experts very much!