How to design an arbitrary phase flat magnitude FIR filter?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nathan Lively
le 17 Fév 2022
Réponse apportée : Nathan Lively
le 19 Fév 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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Single-Rate 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!