SHARE
TWEET

Untitled

a guest Oct 17th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear all;
  2. close all;
  3. N = 32
  4. load("h.mat")
  5. h = h'
  6. freq1 = 2
  7. freq2 = 6
  8. u3 = zeros(32,1);
  9. for i = 1:1:32
  10.     u3(i) = (sin(2*pi*freq1*i/32) + sin(2*pi*freq2*i/32));
  11. end
  12. u3
  13. U3 = toeplitz(u3)
  14. y3 = U3 * h
  15. %Sposob wykladniczy u3
  16. F1 = zeros(N);
  17. for n = 1:1:32
  18.     for m = 1:1:32
  19.         F1(n,m) = (1/sqrt(N))*exp(-j*((2*pi)/N)*n*m);
  20.     end
  21. end
  22. F1
  23. X1 = F1 * u3
  24. new_X1 = 20*log10(abs(X1))
  25. figure(1)
  26. plot(new_X1, 'g');
  27. title("Sygnal w dziedzinie czestotliwosci - exponenta")
  28. x1_1 = F1' * X1
  29. x2_1 = inv(F1) * X1
  30. %Sposob trygonometryczny u3
  31. F2 = zeros(N);
  32. for n = 1:1:32
  33.     for m = 1:1:32
  34.         F2(n,m) = (1/sqrt(N))*cos((2*pi/N)*n*m) -j*(1/sqrt(N))*sin((2*pi/N)*n*m);
  35.     end
  36. end
  37. F2
  38. X2 = F2 * u3
  39. new_X2 = 20*log10(abs(X2))
  40. figure(2)
  41. plot(new_X2, 'r');
  42. title("Sygnal w dziedzinie czestotliwosci - trygonometria")
  43. x1_2 = F2' * X2
  44. x2_2 = inv(F2) * X2
  45. %Analiza sygnalu y
  46. F1y = zeros(N);
  47. for n = 1:1:63
  48.     for m = 1:1:63
  49.         F1y(n,m) = (1/sqrt(N))*exp(-j*((2*pi)/N)*n*m);
  50.     end
  51. end
  52. F1y
  53. y = conv(h, u3)
  54. Y = F1y * y
  55. figure(3)
  56. plot(Y)
  57. title("Analiza dla sygnalu Y")
  58. %Random signal
  59. signal = randn(32,1)
  60. Signal = F1 * signal
  61. signal1 = F1' * Signal
  62. signal2 = inv(F1) * Signal
  63. figure(4)
  64. plot(Signal)
  65. title("Random signal")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top