demo_filtre.m 499 Bytes
pkg load signal
close all
clear all

d=firls(128,[0 .2 .3 .4 .5 1],[0 0 1 1 0 0]);
d=d/max(d);
plot(d)
N=6;
k=find(abs(d)<2^(-N))
hold on
plot(k,0,'r.')
line([1 128],[2^(-N) 2^(-N)])
line([1 128],[-2^(-N) -2^(-N)])
legend('filter coefficients',[num2str(N),' bit quantization'])
kk=find(diff(k)>1);
k(kk(1))
k(kk(end))
xlabel('cofficient num');ylabel('normalized coef. value')
line([0 k(kk(1))],[0.1 0.1])
line([k(kk(end)) 128],[0.1 0.1])
text(10,0.15,'30 coefs at 0')
text(110,0.15,'30 coefs at 0')