How to design an arbitrary phase flat magnitude FIR filter?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nathan Lively
am 17 Feb. 2022
Beantwortet: Nathan Lively
am 19 Feb. 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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital 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!