필터 지우기
필터 지우기

How to design an arbitrary phase flat magnitude FIR filter?

조회 수: 10 (최근 30일)
Nathan Lively
Nathan Lively 2022년 2월 17일
답변: Nathan Lively 2022년 2월 19일
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.
If you'd like to try running the code, here's a link to download the phase variable below.
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.

채택된 답변

Nathan Lively
Nathan Lively 2022년 2월 19일
User error. I created use function complexVector, but was calling complex. ¯\_(ツ)_/¯

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by