How to design an arbitrary phase flat magnitude FIR filter?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nathan Lively
el 17 de Feb. de 2022
Respondida: Nathan Lively
el 19 de Feb. de 2022
I need to design an FIR filter with flat magnitude, but arbitrary phase. This seems like a pretty straight forward request, but I have searched through all of the FIR functions and cannot find anyting that will work. I most recently experimented with fdesign.arbmagnphase, but the results did not look correct. Plus, it gives me a design object when what I want are the FIR filter coefficients that I can export to a CSV file and load into a DSP.
Fs = 192000;
magnitudeFlat = zeros(height(Fs),1);
phase = phaseA - phaseB; % The phase specification is based on the difference of two other responses.
% convert to complex vector
complexVector = @(mag_dB,phase_radians) [10.^(mag_dB/20) .* exp(1j*(phase_radians))];
Z = complex(magnitudeFlat,phaseDiff);
% design FIR filter
n = 2^12;
Nyq = Fs/2;
f = frequencyHz(1:Nyq) / Nyq; f(end)=1; % Normalize the last row to 1 since it's off by a tiny amount.
b = fir2(n,f,Z(1:Nyq)); % So far, this is the only FIR function I have found that will take in a complex array.
% plot filter kernel
semilogx(abs(fft(b))*2) % The resulting plot does not have flat magnitude.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Single-Rate Filters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!