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

coefficientsfigurefilterMATLABplotprecision

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 ?

Best Answer

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.