Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. N=1;
  6.  
  7. xk = [0:1/100:1];
  8.  
  9. % I funkcja rosnaca
  10. x = [0:N/100:N/4-0.01];
  11. x1=(4/N)*x;
  12.  
  13. % II funkcja malejaca
  14. x = [N/4:N/100:3*N/4-0.01];
  15. x2 = (-4/N)*x+2;
  16.  
  17. %III funkcja rosnaca
  18. x = [3*N/4:N/100:N];
  19. x3 = (4/N)*x-4;
  20.  
  21. %wektor
  22. xn = [x1,x2,x3];
  23.  
  24. subplot(3,1,1);
  25. plot(xk, xn)
  26. hold on
  27. grid on
  28. %wspolczynniki ak
  29. f = fft(xn);
  30.  
  31. %podpunkt b
  32. fabs = abs(f);
  33. f_ampl=abs(f);
  34.  
  35. f_faz=angle(f);
  36. %f_faz=angle(f).*(f_ampl>10^-10);
  37.  
  38. subplot(3,1,2);
  39. bar(f_ampl);
  40. title('Widmo amplitudowe')
  41.  
  42. subplot(3,1,3);
  43. bar(f_faz);
  44. title('Widmo fazowe sygnalu')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement