Facebook
From Bartek, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 200
  1. clc;
  2. % clear all;
  3. Dane = importdata('GAE_S03_PAM.mat');
  4. Ua=Dane;
  5.  
  6. % plot(Ua)
  7. fs=2000000;
  8. for(i=1:length(Ua))
  9.    if(Ua(i)>1)
  10.        Ua(i)=75;
  11.    end
  12.    if(Ua(i)<-1)
  13.        Ua(i)=-75;
  14.    end  
  15. end
  16. z=Ua.*Dane;
  17. %g= plot(z);
  18. FIR=Numbers;
  19.  
  20.  
  21. bits=11;
  22. FIR1 = round(FIR*2^(bits-1)-1)/(2^(bits-1)-1);
  23.  
  24. y=conv(z,FIR);
  25. j=conv(z,FIR1);
  26. k = y;
  27. x =abs(fft(y));
  28.  
  29. for(i=1:length(y))   %
  30.    if(y(i)>6500)
  31.        y(i)=25;  
  32.    else
  33.        y(i)=-25;
  34.    end  
  35. end
  36. q=y;
  37.  
  38. subplot(1,3,1)
  39. title('fir');
  40. plot(k)
  41. subplot(1,3,2)
  42. title('fft')
  43. plot(x)
  44. subplot(1,3,3)
  45. plot(y)
  46.  
  47.  
  48.  
  49.  
  50.  
  51. Message = RS232(y,9600,2000000);
  52. char(Message')