Advertisement
fellpz

[PDS]código filtro

Nov 22nd, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.92 KB | None | 0 0
  1. wp = 0.2*pi; ws = 0.3*pi;
  2. tr_width = ws - wp;
  3. M = ceil(6.6*pi/tr_width) + 1
  4. n = [0:M-1];
  5. wc = (ws + wp)/2;
  6. hd = ideal_lp (wc, M);
  7. w_ham = (hamming(M))';
  8. h = hd.*w_ham; %Multiplia filtro ideal por Hamming - dominio do tempo
  9. [db, mag, pha, w] = freqz_m(h, [1]); %Transformada Fourier - dominio da frequência
  10. delta_w = 2*pi/1000;
  11. Rp = -(min(db(1:wp/delta_w+1)))
  12. As = -round(max(db(ws/delta_w+1:501)))
  13.  
  14.  
  15. subplot(1, 1, 1)
  16. subplot (2, 2, 1); stem(n, hd); title('Resposta ao Impulso Ideal');
  17. axis([0 M-1 -0.1 0.3]);xlabel('n');ylabel('hd[n]');
  18. subplot (2, 2, 2); stem(n, w_ham); title('Janela de Hamming');
  19. axis([0 M-1 0 1.1]);xlabel('n');ylabel('w[n]');
  20. subplot (2, 2, 3); stem(n, h); title('Resposta ao Impulso Atual');
  21. axis([0 M-1 -0.1 0.3]);xlabel('n');ylabel('h[n]');
  22. subplot (2, 2, 4); plot(w/pi, db); title('Magnitude em dB');grid
  23. axis([0 1 -100 10]);xlabel('frequencia em pi unidades');ylabel('Decibeis');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement