0% found this document useful (0 votes)
108 views1 page

BPSK

This document contains code to generate a BPSK modulated signal from a binary data sequence. It defines the data sequence, converts it to bipolar format, replicates it over multiple samples per bit, generates a carrier waveform, and plots the original data, bipolar data, carrier, and modulated signal.

Uploaded by

tariq76
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views1 page

BPSK

This document contains code to generate a BPSK modulated signal from a binary data sequence. It defines the data sequence, converts it to bipolar format, replicates it over multiple samples per bit, generates a carrier waveform, and plots the original data, bipolar data, carrier, and modulated signal.

Uploaded by

tariq76
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

d=[1 0 1 1 0]; % Data sequence

b=2*d-1; % Convert unipolar to bipolar


T=1; % Bit duration
Eb=T/2; % This will result in unit amplitude waveforms
fc=3/T; % Carrier frequency
t=linspace(0,5,1000); % discrete time sequence between 0 and 5*T (1000
samples)
N=length(t); % Number of samples
Nsb=N/length(d); % Number of samples per bit
dd=repmat(d',1,Nsb); % replicate each bit Nsb times
bb=repmat(b',1,Nsb); dw=dd'; % Transpose the rows and columns
dw=dw(:)';
% Convert dw to a column vector (colum by column) and convert to a row vector
bw=bb';
bw=bw(:)'; % Data sequence samples
w=sqrt(2*Eb/T)*cos(2*pi*fc*t); % carrier waveform
bpsk_w=bw.*w; % modulated waveform
% plotting commands follow
subplot(4,1,1);
plot(t,dw); axis([0 5 -1.5 1.5])
subplot(4,1,2);
plot(t,bw); axis([0 5 -1.5 1.5])
subplot(4,1,3);
plot(t,w); axis([0 5 -1.5 1.5])
subplot(4,1,4);
plot(t,bpsk_w,'.'); axis([0 5 -1.5 1.5])
xlabel('time')

You might also like