Advertisement
Stybyk

BPSK

Dec 11th, 2016
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.49 KB | None | 0 0
  1. clc;
  2. clear all;
  3. close all;
  4.  
  5.  
  6. x=[ 1 0 0 1 1 0 1];                                    % Binary Information
  7. bp=.000001;                                                    % bit period
  8. disp(' Binary information at Trans mitter :');
  9. disp(x);
  10.  
  11. %XX representation of transmitting binary information as digital signal XXX
  12. bit=[];
  13. for n=1:1:length(x)
  14.     if x(n)==1;
  15.        se=ones(1,100);
  16.     else x(n)==0;
  17.         se=zeros(1,100);
  18.     end
  19.      bit=[bit se];
  20.  
  21. end
  22. t1=bp/100:bp/100:100*length(x)*(bp/100);
  23. subplot(3,1,1);
  24. plot(t1,bit,'lineWidth',2.5);grid on;
  25. axis([ 0 bp*length(x) -.5 1.5]);
  26. ylabel('amplitude(volt)');
  27. xlabel(' time(sec)');
  28. title('transmitting information as digital signal');
  29.  
  30.  
  31.  
  32. %XXXXXXXXXXXXXXXXXXXXXXX Binary-FSK modulation XXXXXXXXXXXXXXXXXXXXXXXXXXX%
  33. A=5;                                          % Amplitude of carrier signal
  34. br=1/bp;                                                         % bit rate
  35. f1=br*8;                           % carrier frequency for information as 1
  36. f2=br*2;                           % carrier frequency for information as 0
  37. f3=br*1;
  38. f4=br*20;
  39. t2=bp/99:bp/99:bp;                
  40. ss=length(t2);
  41. m=[];
  42. for (i=1:1:length(x))
  43.     if (x(i)==1)
  44.         y=A*cos(2*pi*f1*t2);
  45.     else
  46.         y=A*cos(2*pi*f2*t2);        
  47.     end
  48.     m=[m y];
  49. end
  50. t3=bp/99:bp/99:bp*length(x);
  51. subplot(3,1,2);
  52. plot(t3,m);
  53. xlabel('time(sec)');
  54. ylabel('amplitude(volt)');
  55. title('waveform for binary FSK modulation coresponding binary information');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement