Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.86 KB | None | 0 0
  1. load('h.mat');
  2. h=h';%odwrocenie macierzy
  3. u1 = zeros(32,1);
  4. u1(1) = 1;
  5. u2 = zeros (32,1);
  6. u2(1:1:7) = [0,1,1,0.5,0.5,-1,-1];
  7. u3 = zeros(32,1);
  8. for i=0:31
  9.     u3(i+1)= sin(2*pi*2*i/32) + sin(2*pi*6*i/32);
  10. end
  11.  
  12. r1 = zeros(1,32);
  13. r2 = zeros(1,32);
  14. r3 = zeros(1,32);
  15. r1(1) = u1(1);
  16. r2(1) = u2(1);
  17. r3(1) = u3(1);
  18.  
  19. U1 = toeplitz(u1,r1);
  20. U2 = toeplitz(u2,r2);
  21. U3 = toeplitz(u3,r3);
  22.  
  23. y1=U1*h;
  24.  
  25. if (y1 == h)
  26.     disp('takie same');
  27. else
  28.     disp('rozne');
  29. end
  30.  
  31.  
  32. y2=U2*h;
  33. P=pinv(h);
  34. P=toeplitz(P);
  35. y2c=P*y2;
  36.  
  37. figure(1);
  38. subplot(2,1,1);
  39. hold on;
  40. stem(u2, 'filled', 'b');
  41. plot(y2,'r');
  42. title('niebieski - nadany; czerwony - odebrany');
  43. subplot(2,1,2);
  44. hold on;
  45. plot(y2c,'r');
  46. title('odebrany po korekcji');
  47.  
  48.  
  49. y3=U3*h;
  50.  
  51. figure(2);
  52. hold on;
  53. subplot(1,1,1);
  54. plot(u3, 'b');
  55. plot(y3,'r');
  56. title('niebieski - nadany; czerwony - odebrany');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement