Why is my 1kHz allpass filter returning 1.125kHz?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nathan Lively
le 18 Août 2020
Réponse apportée : Nathan Lively
le 3 Sep 2020
I was happy to discover allpass.m from Dean Andersen, but I'm struggling to get the expected result.
My expectation is based off of the Galaxy output processor from Meyer Sound with an APF set at 1kHz with a Q of 1. This is the filter I'm trying to recreate (viewed as wrapped phase). Here's a link to the full sized image.
This is the result I'm getting in MATLAB viewed as unwrapped phase in orange. Instead of the filter crossing 180º at 1kHz, it's at 1.125kHz. The blue line is another input for my own reference.
What am I missing here? Thanks for any guidance!
%% load stuff
M = readtable('dB Technologies T4 PS1.xlsx','Sheet','TF');
%% Create APF
Q = 1;
Fc = 1000;
Fs = 96000;
% Magnitude
w0B22 =2*pi*Fc/Fs;
alphaB23 = sin(w0B22)/(2*Q);
a0B24 = 1+alphaB23;
a1B12 = -(-2*cos(w0B22))/a0B24;
a2B13 = -(1-alphaB23)/a0B24;
a1Z2 = round(-a1B12,14);
a2Z3 = round(-a2B13,14);
realpart = -a1Z2/(2*1);
D = a1Z2^2-4*1*a2Z3;
ipart = sqrt(-D)/(2*1);
magnitude = sqrt(realpart^2+ipart^2);
n=1; % poles
Fst = Fc % Not sure if this correct.
Fed = M.Frequency_Hz(515); % This variable didn't seem to change anything.
mag = magnitude;
[b,a] = allpass(n,Fst,Fed,mag,Fs);
% Phase of APF
w = M.Frequency_Hz;
M.Frequency_Norm = (2 * w / Fs) * pi; % Frequency in Hz to rad/samp
phase_unwrap = rad2deg(phasez(b,a,M.Frequency_Norm));
% phase of APF
M.Phase_unwrap = rad2deg(unwrap(deg2rad(M.Phase_deg)));
semilogx(w,M.Phase_unwrap)
hold on
semilogx(w,phase_unwrap) % the filter
grid on
ylim([-360 180]);
xlim([20 20000]);
xlabel('Frequency')
ylabel('Phase Unwrapped (degrees)')
legend('Phase example','Phase filter','Location','best');
hold off
2 commentaires
Sebastian Schlecht
le 19 Août 2020
Hi,
can you please post xlsx file such that there is a full reproducible example.
Best,
Sebastian
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Analog Filters dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!