Advertisement
szymcio93

2

Oct 6th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. close all;
  2.  
  3. clear all;
  4.  
  5.  
  6.  
  7. A=230;
  8.  
  9. f=50;
  10.  
  11. t=0.1;
  12.  
  13.  
  14. fs1=10000;
  15.  
  16. fs2=500;
  17.  
  18. fs3=200;
  19.  
  20.  
  21. counter=1;
  22.  
  23.  
  24. w=2*pi*f;
  25.  
  26.  
  27. for i=0:1/fs1:t
  28.  
  29. x1(counter)=i;
  30.  
  31. y1(counter)=sin(w*i);
  32.  
  33. counter=counter+1;
  34.  
  35. end
  36.  
  37.  
  38.  
  39. counter=1;
  40.  
  41.  
  42. for i=0:1/fs2:t
  43.  
  44. x2(counter)=i;
  45.  
  46. y2(counter)=sin(w*i);
  47.  
  48. counter=counter+1;
  49.  
  50. end
  51.  
  52.  
  53.  
  54. counter=1;
  55.  
  56.  
  57. for i=0:1/fs3:t
  58.  
  59. x3(counter)=i;
  60. y3(counter)=sin(w*i);
  61.  
  62. counter=counter+1;
  63.  
  64. end
  65.  
  66.  
  67.  
  68.  
  69. %hold on
  70.  
  71.  
  72. %plot(x1,A*y1,'b-')
  73.  
  74. %xlabel('second')
  75.  
  76. %ylabel('Volt')
  77.  
  78. %plot(x2,A*y2,'ro')
  79.  
  80. %plot(x3,A*y3,'kx')
  81.  
  82.  
  83.  
  84. %rekonstrukcja sygnału dla fs3
  85.  
  86. xs=zeros(size(x1));
  87.  
  88. for k=1:length(x3),
  89. st = y3(k)*sinc(fs3*(x1-x3(k)));
  90.  
  91. xs = xs + st;
  92.  
  93. end;
  94.  
  95. figure(2)
  96.  
  97. hold on;
  98.  
  99. plot(x1,y1,'b-');
  100.  
  101. plot(x1,xs,'g-');
  102.  
  103. blad=y1-xs;
  104.  
  105. plot(x1,blad,'r');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement