フィルターのクリア

How to use freqz to plot filter frequency response?

43 ビュー (過去 30 日間)
Christopher Saltonstall
Christopher Saltonstall 2020 年 4 月 2 日
コメント済み: Kritika Gupta 2023 年 3 月 2 日
I used systemIdentification to calculate the transfer function of my filter (see first figure) and then saved the idtf variable (attached). However, when I load the idtf variable and use freqz to plot the frequency response it looks very different (see second figure).
%number of frequencies
n = 50000;
%sampling frequency
f_sample = 2e8; %Hz
%transfer function numerator
b = [9.875702215802889e+04,6.459317537238607e+09];
%transfer function denominator
a = [1,1.844463395715939e+05,5.691593683410083e+09];
%calculate tranfer function response
[h_calc, w_calc] = freqz(b,a,n,f_sample);
%plot transfer function
figure(3)
plot(w_calc,h_calc)
set(gca,'XScale','log')
set(gca,'YScale','log')
xlabel('Frequency (Hz)')
ylabel('Filter Response')

採用された回答

Christopher Saltonstall
Christopher Saltonstall 2020 年 4 月 2 日
Its is because the frequency response, h, is a complex value. By plotting,
plot(f,h)
only the real (in-phase) component is plotted. Instead, the magnitude of h must be plotted,
plot(f,abs(h))
  1 件のコメント
Kritika Gupta
Kritika Gupta 2023 年 3 月 2 日
how can i get coordinates

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by