Design a band pass filter using kaiser window
Afficher commentaires plus anciens

After reading the documentation I tried this. Is the implementation correct?
Fs = 31.830988655;
Fn = Fs/2;
Wp = [3.1830988655 6.366197731 9.5492965964 12.732395462];
fsamp = Fs;
fcuts = Wp;
mags = [0 10 0];
devs = [0.05 0.01 0.05];
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
[H,f] = freqz(hh, 1, 2^nextpow2(n), fsamp);
figure(1)
plot(f, 20*log10(abs(H)))
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude (dB)')
Réponses (1)
Gehan
thanks for voting my answer to your previous question
This question is the BPF variant.
While the way manual you code the filter is important to understand how filter building works MATLAB already has a class called digitalFilter precisely to make it easier to build filters:
BpFilt = designfilt('bandpassfir', ...
'StopbandFrequency1',20, ...
'PassbandFrequency1',40, ...
'PassbandFrequency2',60, ...
'StopbandFrequency2',80, ...
'DesignMethod','kaiserwin',...
'PassbandRipple',0.5, ...
'StopbandAttenuation1',35, ...
'StopbandAttenuation2',35, ...
'SampleRate',200);
figure(1);fv1=fvtool(BpFilt)

another disadvantage of the manual coding is that it not enough points, the side lobes lose frequency resolutions. Kaiser windowing is precisely the find of window that allows a sharp main beam while keeping low the side lobes, a characteristic important in reception, when listening looking on a particular direction we don't really want interference from other directions overlapped. do we?
your code doesn't show how Kaiser time windowing shapes the frequency side lobes


. Ignore the double graph

dataIn = rand(1000,1);
dataOut = filter(BpFilt,dataIn);
subplot(2,1,1);plot(dataIn);title('input noise')
subplot(2,1,2);plot(dataOut);title('BPF Kai filtered noise')
.
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help, please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG
1 commentaire
Zobaed Ullah
le 17 Déc 2020
what's the order of the filter and coefficient values?
Catégories
En savoir plus sur Kaiser dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!