Why is my 1kHz allpass filter returning 1.125kHz?
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Nathan Lively
 am 18 Aug. 2020
  
    
    
    
    
    Beantwortet: Nathan Lively
 am 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 Kommentare
  Sebastian Schlecht
 am 19 Aug. 2020
				Hi, 
can you please post xlsx file such that there is a full reproducible example.
Best,
Sebastian
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Filter Analysis finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

