Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. clear all;
  2. close all;
  3.  
  4. %wpisanie sygnalu
  5. n = 0:4;
  6. x1 = [0 0.5 1 0 0];
  7. x2 = [0 1 0.5 0 0];
  8. h = 2.^(n);
  9. s = x1 + x2;
  10. X1 = fftshift(fft(x1));
  11. X2 = fftshift(fft(x2));
  12. H = fftshift(fft(h));
  13.  
  14. %odpowiedz systemu nieprzesunieta
  15. Y1 = X1 .* H;
  16. y1 = ifft(Y1);
  17. Y2 = X2 .* H;
  18. y2 = ifft(Y2);
  19.  
  20. %sygnal x1
  21. figure(1);
  22. subplot(6,1,1);
  23. stem(n,x1);
  24. xlabel('n');
  25. ylabel('x1(n)');
  26. %sygnal x2
  27. figure(1);
  28. subplot(6,1,2);
  29. stem(n,x2);
  30. xlabel('n');
  31. ylabel('x2(n)');
  32.  
  33. %sygnal h
  34. subplot(6,1,3);
  35. stem(n,h);
  36. xlabel('n');
  37. ylabel('h(n)');
  38. %transfortmata X1
  39. subplot(6,1,4);
  40. stem(abs(X1));
  41. xlabel('f');
  42. ylabel('X1(f)');
  43. %transfortmata X2
  44. subplot(6,1,5);
  45. stem(abs(X2));
  46. xlabel('f');
  47. ylabel('X2(f)');
  48. %transfortmata H
  49. %suma sygna這w x1 i x2
  50. subplot(6,1,6);
  51. stem(s);
  52. xlabel('n');
  53. ylabel('x1 + x2');
  54.  
  55. %suma sygnalow
  56.  
  57. y4 = y1 + y2
  58.  
  59. S1 = fftshift(fft(s));
  60. Y3 = S1 .* H;
  61. y3 = ifft(Y3);
  62. figure(2);
  63. %suma sygna這w x1 i x2
  64. subplot(5,1,1);
  65. stem(s);
  66. xlabel('n');
  67. ylabel('x1 + x2');
  68. %wyjscie sumy
  69. subplot(5,1,2);
  70. stem(y3);
  71. xlabel('n');
  72. ylabel('y3');
  73.  
  74. %wyjscie x1
  75. subplot(5,1,3);
  76. stem(y1);
  77. xlabel('n');
  78. ylabel('y1');
  79.  
  80. %wyjscie x1
  81. subplot(5,1,4);
  82. stem(y2);
  83. xlabel('n');
  84. ylabel('y2');
  85.  
  86. %wyjscie y4
  87. subplot(5,1,5);
  88. stem(y4);
  89. xlabel('n');
  90. ylabel('y4');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement