Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.96 KB | None | 0 0
  1. plot_rows = 2;
  2. plot_cols = 2;
  3. t = 0:0.001:1500;
  4. A = 1;
  5. fc = 30;
  6.  
  7. %carrier
  8. carrier = cos(2*pi*fc*t);
  9. subplot(plot_rows,plot_cols,1);
  10. plot(t,carrier);
  11. xlim([0 20]);
  12. ylabel('cos(t)');
  13. xlabel('t');
  14. title(sprintf('fc = %d',fc))
  15.  
  16.  
  17. %m(t)
  18. m =cos(pi*2*t);
  19. subplot(plot_rows,plot_cols,2);
  20. plot(t,m);
  21. xlim([0 20]);
  22. ylabel('m(t)');
  23. xlabel('t');
  24.  
  25.  
  26. %f_m
  27. f_m = (A+m).*carrier;
  28. subplot(plot_rows,plot_cols,3);
  29. plot(t,f_m);
  30. xlim([0 20]);
  31. ylabel('f_m(t)');
  32. xlabel('t');
  33.  
  34.  
  35. %f_r
  36. f_r = abs(f_m);
  37. subplot(plot_rows,plot_cols,4);
  38. plot(t,f_r);
  39. xlim([0 20]);
  40. ylabel('f_r(t)');
  41. xlabel('t');
  42.  
  43. figure;
  44. first = 25;
  45. last = 37;
  46. step = 1;
  47. cols = 2;
  48. rows = (last-first)/cols;
  49.  
  50. for RC = first:1:last;
  51.   %h
  52.   h = (1/RC).*(exp(-t./RC)).*(t>=0);
  53.  
  54.   %f_d
  55.   f_d = (ifft(fft(h) .* fft(f_r))) - A;
  56.   subplot(rows,cols,RC-first+1);
  57.   plot(t,f_d - max(f_d)+3);
  58.   xlim([0 20]);
  59.   ylabel('f_d(t)');
  60.   xlabel('t');
  61.   title(sprintf('RC = %d',RC));
  62.  
  63.  
  64.  
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement