Advertisement
Madotsuki

:)

Mar 17th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. % Homework 7
  2. % ECE107
  3. % What do you call a music school's admissions?
  4. % A BANDPASS filter.
  5.  
  6. %% Problem 1 (First Attempt)
  7. o = -pi:0.00001:pi;
  8. t = -pi:0.00001:pi;
  9.  
  10. nl = 0.4.*pi;
  11. nu = 0.5.*pi;
  12. narrow_ass = 2.*(nl-nu).*sinc((nl-nu).*t).*cos( o .* t );
  13. %narrow_ass = (0.797885.*exp(-0.45.*i.*t) .*(1 + exp(0.9.*i)).*sin(0.05.*t))./t;
  14.  
  15. figure(1);
  16. plot(t,narrow_ass);
  17. title('Narrow Assignment Filter');
  18.  
  19. wl = 0.3.*pi;
  20. wu = 0.7.*pi;
  21. wide_ass = 2.*(wl-wu).*sinc((wl-wu).*t).*cos( o .* t );
  22. figure(2);
  23. plot(t,wide_ass);
  24. title('Wideband Assignment Filter');
  25.  
  26. %% Problem 1 (Second Attempt)
  27. %
  28. % nl = 0.4.*pi;
  29. % nu = 0.5.*pi;
  30. % LUV = (nu-nl)./2; % Lower Upper aVerage
  31. % MUV = (nu-nl); % Difference of the two
  32. % t = -pi:0.00001:pi;
  33. %
  34. % narrow_ass = exp(2.*pi.*j.*-LUV.*t)./(MUV) .* sinc( (t - (-LUV) ) ./MUV ) + exp(2.*pi.*j.*LUV.*t)./(MUV) .* sinc( (t - (LUV) ) ./MUV );
  35. %
  36. % figure(1);
  37. % plot(t,narrow_ass);
  38. % title('Narrow Assignment Filter');
  39.  
  40. %% Problem 2
  41.  
  42. % Make a windowed filtered etc.
  43.  
  44. N = 1;
  45. Wn = [0.4 0.5];
  46. Nw = 25;
  47. w_vista = fir1((2*Nw),Wn,'bandpass',rectwin(2.*Nw+1));
  48. figure(3);
  49. plot(w_vista);
  50. title('Bandpass frequency');
  51.  
  52. %for n = 1:Nw;
  53. disp('The DTFT of this... a little bit more difficult...');
  54. disp('It needs to be the summation of this function over the interval -NW to NW');
  55.  
  56. %
  57. %for n = 1:Nw;
  58. % for o = -pi:pi;
  59. % dtft_vista(n) = w_vista.*(cos(o.*n) - j.*sin(o.*n));
  60. % end
  61. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement