SHARE
TWEET

Untitled

a guest Nov 12th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. close all;
  2. N=10000;
  3. data=(round(rand(1,N)));
  4. N_dane=2000;
  5. bitrate=250;
  6. UF=N_dane/bitrate;
  7. % tu se odkomentuj cos co ci trzeba (bi = manchester)
  8. % nrz=upsample(data,UF);
  9. % nrz=conv(nrz,ones(1,UF));
  10. %
  11. % rz=upsample(data,UF);
  12. % rz=conv(rz,ones(1,UF/2));
  13.  
  14. bi=upsample(data-0.5, UF);
  15. bi=conv(bi, [ones(1,UF/2)  -ones(1,UF/2)]);
  16.  
  17. s=1;
  18. ami=zeros(1,N);
  19.  
  20. for n=1:N
  21.     if(data(n)==1)
  22.         s=s*(-1);
  23.         ami(n)=s;
  24.     elseif(data(n)==0)
  25.         ami(n)=0;
  26.     end
  27. end
  28.  
  29. ami=upsample(ami,UF);
  30. ami=conv(ami,ones(1,UF));
  31.  
  32. %s=ami;
  33. s=bi-0.5;
  34. %s=rz-0.25;
  35. figure
  36. plot(s(1:200))
  37.  
  38. figure
  39. per=periodogram(s,hamming(length(s)));
  40. plot(per)
  41. title('periodogram');
  42.  
  43. figure
  44. WIN=200;
  45. %pwelch - estymator welcha(sygna l, okno,ilosc probek overalp, wymiar fft)
  46. pw=pwelch(s,hann(WIN), 0, WIN);
  47. plot(pw)
  48. title('Bartletta');
  49.  
  50. figure
  51. WIN=200;
  52. %pwelch - estymator welcha(sygna l, okno,ilosc probek overalp, wymiar fft)
  53. pw=pwelch(s,hann(WIN),UF/2, WIN);
  54. plot(pw)
  55. title('Welcha');
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