フィルターのクリア

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 Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by