Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. clear;
  2. N=100;
  3.  
  4. for k = 1:N
  5. w(k) = 1*pi/N*k;
  6. H(k) = 1/3 * (1a+ exp(-j*w(k)) + exp(-j*2*w(k)));
  7. %H2(k) = 1/3 * (1+ exp(j*w(k)) + exp(j*2*w(k)))/exp(j*2*w(k));
  8. Habs(k) = (1+2*exp(-j*1.5*w(k))*cos(w(k)/2))/3;
  9. Pangle(k) = -1.5*j*w(k);
  10. end
  11.  
  12. figure
  13. subplot (2,2,1)
  14. plot(w,abs(H))
  15. grid on
  16. title('Magnitude of Transfer function by Matlab');
  17. xlabel('w');
  18. ylabel('Magnitude');
  19.  
  20. subplot (2,2,2)
  21. plot(w,angle(H))
  22. grid on
  23. title('Phase of Transfer function by Matlab');
  24. xlabel('w');
  25. ylabel('Phase');
  26.  
  27. subplot (2,2,3)
  28. plot(w,Habs)
  29. grid on
  30. title('Magnitude of Transfer function by hand');
  31. xlabel('w');
  32. ylabel('Magnitude');
  33.  
  34. subplot (2,2,4)
  35. plot(w,Pangle)
  36. grid on
  37. title('Phase of Transfer function by hand');
  38. xlabel('w');
  39. ylabel('Phase');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement