Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function[y]=myfilterdesign(typ_filtra,Fs,Fc,M,w)
- N=2*M+1;
- fn=(Fc/Fs)/2;
- t1=-M:-1;
- t2=0;
- t3=1:M;
- switch typ_filtra
- case 1
- y1=sin(2*pi*fn.*t1)./(pi.*t1);
- y2=2*fn;
- y3=sin(2*pi*fn.*t3)./(pi.*t3);
- case 2
- y1=-sin(2*pi*fn.*t1)./(pi.*t1);
- y2=1-2*fn;
- y3=-sin(2*pi*fn.*t3)./(pi.*t3);
- end
- h=[y1, y2, y3];
- switch w
- case 1
- w1=rectwin(N);
- h1=h.*w1';
- case 2
- w2=bartlett(N);
- h2=h.*w2';
- case 3
- w3=hamming(N);
- h3=h.*w3';
- case 4
- w4=blackman(N);
- h4=h.*w4';
- end
- y=h.*w';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement