Problem with sampling frequency in freqz and fvtools
Afficher commentaires plus anciens
I am trying to use `fvtool` function in Matlab (2011a).
This is an interactive "tool" composed of many functions. My code goes like this:
%fs1=256; fs2=64; fs3=32;
b1 = fir1(52,0.25,kaiser(53,7.85726));
b2 = fir1(40,0.5,kaiser(41,7.85726));
b3 = fir1(204,0.5,kaiser(205,10.0613));
fvtool(b1,1,b2,1,b3,1);
This produces:

Now I go to the "analysis" menue and choose "sampling frequency", and enter the sampling freq. for each filter. The result is:

Not very good, since the response of the second and third filters is repeating. The response of the first filter is fine, going from 0 to 256/2=128 Hz. I would like to have the response of the second and third filters to go up to 64/2=32 and 32/2=16. respectively.
So I tried to manually do it,
%Digital filter:
fs1=256; fs2=64; fs3=32;
b1 = fir1(52,0.25,kaiser(53,7.85726)); b1(end+256)=0;
b2 = fir1(40,0.5,kaiser(41,7.85726)); b2(end+448)=0;
b3 = fir1(204,0.5,kaiser(205,10.0613)); b3(end+480)=0;
%Filters Response
n=1024;
w = logspace(-1,2,n);
digi_1 = freqz(b1,1,n,fs1); emilogx(w,20*log10(abs(digi_1)),'Color','k');
hold on
digi_2 = freqz(b2,1,n,fs2); emilogx(w,20*log10(abs(digi_2)),'Color','b');
hold on
digi_3 = freqz(b3,1,n,fs3); emilogx(w,20*log10(abs(digi_3)),'Color','r');
axis ([0.1 128 -140 10])
Here I used freqz and give it the filter numerator and denomenator, plus the number of points n, plus the sampling freq. fs. The problem is that Matlab does not seem to do any change with or without the sampling freq., i.e. if I left it nothing change.
So if someone wants to help, he/she would either help me with `fvtools` or with my manual code which is a step late than `fvtools`.
1 commentaire
Ali Alsaqqa
le 27 Juin 2013
Réponses (1)
Ali Alsaqqa
le 27 Juin 2013
0 votes
Catégories
En savoir plus sur Filter Design dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!