Advertisement
domdealm

DJAVAN2

Nov 22nd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.93 KB | None | 0 0
  1. ws1 = 0.2*pi;
  2. wp1 = 0.35*pi;
  3. wp2 = 0.65*pi;
  4. ws2 = 0.8*pi;
  5. As = 60;
  6. tr_width = min((wp1-ws1), (ws2-wp2));
  7. M = ceil(11*pi/tr_width) + 1
  8. n = [0:M-1];
  9. wc1 = (ws1 + wp1)/2;
  10. wc2 = (ws2 + wp2)/2;
  11. hd = ideal_lp(wc2, M) - ideal_lp(wc1, M);
  12. w_bla = (blackman(M))';
  13. h = hd.*w_bla;
  14. [db, mag, pha, w] = freqz_m(h, [1]);
  15. delta_w = 2*pi/1000;
  16. Rp = -(min(db(wp1/delta_w+1:wp2/delta_w)))
  17. As = -round(max(db(ws2/delta_w+1:501)))
  18. subplot (2, 2, 1);
  19. stem(n,hd); title('Resposta ao Impulso Ideal');
  20. axis([0 M-1 -0.4 0.5]); xlabel('n'); ylabel ('hd[n]');
  21. subplot (2, 2, 2); stem (n, w_bla); title ('Janela de Blackman');
  22. axis ([0 M-1 0 1.1]); xlabel('n'); ylabel('w[n]');
  23. subplot (2, 2, 3);stem(n, h); title('Resposta ao Impulso Atual');
  24. axis([0 M-1 -0.4 0.5]);xlabel('n');ylabel('h[n]');
  25. subplot(2,2,4);plot(w/pi,db);title('Magnitude em dB');grid
  26. axis([0 1 -150 10]);xlabel('frequencia em pi unidades');ylabel('Decibeis');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement