adiee

Untitled

Jul 22nd, 2021 (edited)
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.80 KB | None | 0 0
  1. clc
  2. clear all
  3. close all
  4.  
  5. t=-100:01:100;
  6. fm=0.02;
  7. x=cos(2*pi*t*fm);
  8. subplot(2,2,1);
  9. plot(t, x);
  10. xlabel('time in sec');
  11. ylabel('x(t)');
  12. title('continuous time signal');
  13.  
  14. fs1=0.02;
  15. n=-2:2;
  16. x1=cos(2*pi*fm*n/fs1);
  17. subplot(2,2,2);
  18. stem(n,x1);
  19. hold on
  20. subplot(2,2,2);
  21. plot(n,x1,':');
  22. title('discrete time signal x(n) with fs<2fm');
  23. xlabel('n');
  24. ylabel('x(n)');
  25.  
  26. fs2=0.04;
  27. nl=-4:4;
  28. x2=cos(2*pi*fm*n1/fs2);
  29. subplot(2,2,3);
  30. stem(nl,x2);
  31. hold on
  32. subplot(2,2,3);
  33. plot(n1,x2,':');
  34. title('discrete time signal x(n) with fs>2fm');
  35. xlabel('n');
  36. ylabel('x(n)');
  37.  
  38. n2=-50:50;
  39. fs3=0.5;
  40. x3=cos(2*pi*fm*n2/fs3);
  41. subplot(2,2,4);
  42. stem(n2,x3);
  43. hold on
  44. subplot(2,2,4);
  45. plot(n2,x3,':');
  46. xlabel('n');
  47. ylabel('x(n)');
  48. title('discrete time signal x(n) with fs=2fm');
  49.  
  50.  
Add Comment
Please, Sign In to add comment