Generate Filters coeffitients using *.m file

1 回表示 (過去 30 日間)
AndyK
AndyK 2022 年 12 月 7 日
回答済み: Star Strider 2022 年 12 月 7 日
I have made a FIR filter without filterDesigner tool
Unrecognized function or variable 'I'.
Fs = 48000; % Sampling rate
T = 1/Fs;
L = 320;
t = (0:L-1)*T;
x = sin(2*pi*1000*t) + 0.5*sin(2*pi*15000*t);
h = fir1(28, 6/24);
y = filter (h, (1), x);
How can I generate the list of filter coeffitients?
Or I should convert it somehow to *.fda file (don't know)?
  3 件のコメント
AndyK
AndyK 2022 年 12 月 7 日
I mean to generate a C header file
Mathieu NOE
Mathieu NOE 2022 年 12 月 7 日
your code works fine
what's the problem ?
Fs = 48000; % Sampling rate
T = 1/Fs;
L = 320;
t = (0:L-1)*T;
x = sin(2*pi*1000*t) + 0.5*sin(2*pi*15000*t);
h = fir1(28, 6/24);
y = filter(h,1,x);
plot(t,x,t,y);

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2022 年 12 月 7 日
If I understand your question correctly, the filter coefficients are the ‘h’ vector.
Also, use filtfilt for the best results, not filter. This applies even to zero-phase FIR filters.

その他の回答 (1 件)

Gerard Burjalès
Gerard Burjalès 2022 年 12 月 7 日

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by