SHARE
TWEET

myfliterdesign.m

a guest May 27th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function[y]=myfilterdesign(typ_filtra,Fs,Fc,M,w)
  2.  
  3. N=2*M+1;
  4. fn=(Fc/Fs)/2;
  5.  
  6. t1=-M:-1;
  7. t2=0;
  8. t3=1:M;
  9.  
  10. switch typ_filtra
  11.     case 1
  12.     y1=sin(2*pi*fn.*t1)./(pi.*t1);
  13.     y2=2*fn;
  14.     y3=sin(2*pi*fn.*t3)./(pi.*t3);
  15.     case 2
  16.     y1=-sin(2*pi*fn.*t1)./(pi.*t1);
  17.     y2=1-2*fn;
  18.     y3=-sin(2*pi*fn.*t3)./(pi.*t3);
  19. end
  20.  
  21. h=[y1, y2, y3];
  22.  
  23. switch w
  24.     case 1
  25.     w1=rectwin(N);
  26.     h1=h.*w1';
  27.     case 2
  28.     w2=bartlett(N);
  29.     h2=h.*w2';
  30.     case 3
  31.     w3=hamming(N);
  32.     h3=h.*w3';
  33.     case 4
  34.     w4=blackman(N);
  35.     h4=h.*w4';
  36. end
  37.  
  38. y=h.*w';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top