Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. //najlepiej zrobić funkcje generującą, aby pamietała sinusoide
  2.  
  3. x=linspace(0,2*pi,64);
  4. y=sin(x);
  5. subplot(5,1,1);
  6. stem(y)
  7. z=fft(y);
  8. subplot(5,1,2);
  9. stem (abs(z))
  10. subplot(5,1,3);
  11. stem(real(z));
  12. subplot(5,1,4);
  13. stem(imag(z));
  14. subplot(5,1,5);
  15. stem(angle(z));
  16.  
  17.  
  18. //2
  19.  
  20. N = 64;
  21. n = 0:1:N-1;
  22. y1 = cos((2*pi*n/N) + (pi/4));
  23. y2 = 0.5*cos((4*pi*n)/N);
  24. y3 = 0.25*cos((8*pi*n/N) + (pi/2));
  25. y4 = y1 + y2 + y3;
  26.  
  27. subplot(4,2,1)
  28. plot(y1);
  29. ylabel('Amplituda');
  30. xlabel('Numer próbki')
  31.  
  32. subplot(4,2,2)
  33. plot(y2);
  34. ylabel('Amplituda');
  35. xlabel('Numer próbki')
  36.  
  37. subplot(4,2,3)
  38. plot(y3);
  39. ylabel('Amplituda');
  40. xlabel('Numer próbki')
  41.  
  42. subplot(4,2,4)
  43. plot(y4);
  44. ylabel('Amplituda');
  45. xlabel('Numer próbki')
  46.  
  47. subplot(4,2,5)
  48. stem(abs(fft(y1)));
  49. ylabel('Amplituda');
  50. xlabel('Numer próbki')
  51.  
  52. subplot(4,2,6)
  53. stem(abs(fft(y2)));
  54. ylabel('Amplituda');
  55. xlabel('Numer próbki')
  56.  
  57. subplot(4,2,7)
  58. stem(abs(fft(y3)));
  59. ylabel('Amplituda');
  60. xlabel('Numer próbki')
  61.  
  62. subplot(4,2,8)
  63. stem(abs(fft(y4)));
  64. ylabel('Amplituda');
  65. xlabel('Numer próbki')
  66.  
  67. //3
  68. zrobić tak dla każdej z zadania 2
  69. x=linspace(0,2*pi,64);
  70. y=sin(x);
  71. fourier=fft(y);
  72. ifourier=ifft(fourier);
  73. stem(ifourier)
  74.  
  75. //4
  76.  
  77. N = 64;
  78. n = [0:1:N];
  79. k = 2;
  80. o = 2*pi*k/N;
  81. fi = 0;
  82. nawias=i*o*n + fi;
  83. funkcja=exp(nawias);
  84. fourier=fft(funkcja)
  85. rzeczywista=real(fourier)...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement