How to Plot Absolute Frequency Response of Filter?

8 ビュー (過去 30 日間)
Matlab Student
Matlab Student 2016 年 5 月 15 日
コメント済み: Star Strider 2016 年 5 月 16 日
I am currently using the freqz() command to plot the frequency response of an FIR filter designed in fdatool and exported to the workspace as a variable.This plots the correct frequency response (as seen in FDAtool), but with normalized frequency on the x-axis.I understand that the freqz() command returns 512 points from 0 to pi.I divide the index by 512 and multiply it with FS/2, which "corrects" the x-axis but when I plot this against 20*log10(abs(filter)), the amplitude is not as seen in FDA tool.
mag=(freqz(Filter1,512));
plot(((1:512)/512)*(44100/2),20*log10(abs(mag(1:512))));

回答 (1 件)

Star Strider
Star Strider 2016 年 5 月 15 日
You can output the frequency in Hz if you give freqz the sampling frequency as an argument (at least in more recent MATLAB releases):
[mag,frq] = freqz(Filter1,2048,FS);
I’ve also noticed that fdatool and freqz give different results. I design my own filters with the individual filter functions, and analyse them with freqz. (I have nothing against using fdatool and the others, but when I learned signal processing, we had to design our own filters at every step, and I just got used to designing them that way.)
  2 件のコメント
Matlab Student
Matlab Student 2016 年 5 月 16 日
Thank you for your reply! I'd like to add that the correct frequency response can be obtained with
mag=(freqz(Filter1,512));
plot(((1:512)/512)*(44100/2),20*log10(abs(mag(1:512))));
Star Strider
Star Strider 2016 年 5 月 16 日
My pleasure.
If you use freqz with no outputs, it plots the frequency response by default:
figure(1)
freqz(Filter1,2048,FS)

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

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by