フィルターのクリア

The precision of plot filter design function is different than plot just coefficients of the same function of filter

1 回表示 (過去 30 日間)
I'm confused about plotting the design filter with the same precision ,for example i have this coefficients (i found it by using fir1(68,[.35,.65])):
bb= [0.0005
0
0.0010
0.0000
-0.0024
-0.0000
0.0020
-0.0000
0.0015
-0.0000
-0.0066
0.0000
0.0078
-0.0000
-0.0000
-0.0000
-0.0142
-0.0000
0.0220
-0.0000
-0.0093
0
-0.0232
-0.0000
0.0519
-0.0000
-0.0411
0.0000
-0.0305
-0.0000
0.1464
0.0000
-0.2551
0.0000
0.2995
0.0000
-0.2551
0.0000
0.1464
-0.0000
-0.0305
0.0000
-0.0411
-0.0000
0.0519
-0.0000
-0.0232
0
-0.0093
-0.0000
0.0220
-0.0000
-0.0142
-0.0000
-0.0000
-0.0000
0.0078
0.0000
-0.0066
-0.0000
0.0015
-0.0000
0.0020
-0.0000
-0.0024
0.0000
0.0010
0
0.0005];
%% plot
freqz(bb,1,512)
the design Fig01
if i use the same last funtion fir1 with same specification
b=fir1(68,[.35,.65])';
freqz(b,1,512)
the design in Fig02
Why the Fig1 don't like the Fig2 in stop band ,why don't find the same precision ?

採用された回答

Star Strider
Star Strider 2020 年 1 月 27 日
To reproduce the posted results, plot them as:
b = fir1(68,[.35,.65]);
bb = round(b, 4);
figure
freqz(bb,1,512);
figure
freqz(b',1,512)
In plotting ‘bb’, note that the coefficients have significantly reduced precision. Rounding (or truncating) the coefficients significantly affects the plotted filter frequency response.
  2 件のコメント
Johan Johan
Johan Johan 2020 年 1 月 27 日
Thank you, but i found this error
Error using round
Too many input arguments.
Does it the same idea with
b = fir1(68,[.35,.65]);
n=4;
bb = round(b*10^n)/10^n;
Star Strider
Star Strider 2020 年 1 月 27 日
As always, my pleasure!
Yes.
That should work.
I created my own version a few years ago:
roundn = @(x,n) round(x .* 10.^n)./10.^n; % Round ‘x’ To ‘n’ Digits, Emulates Latest ‘round’ Function
I do not now remember when the new round was introduced, although I believe it was R2016b, since many similar upgrades occurred them.

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

その他の回答 (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