0% found this document useful (0 votes)
78 views5 pages

BPSK

The document describes generating and analyzing digital communication signals including BPSK, QPSK, and raised cosine filtering. It generates random binary data, BPSK modulates the data using cosine carrier, filters the data using raised cosine filter, and analyzes the signal spectra using PSD. It then generates in-phase and quadrature components from the data, filters them, and quadrature modulates the carrier to create a QPSK signal for analysis.

Uploaded by

Kimberly Wilson
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)
78 views5 pages

BPSK

The document describes generating and analyzing digital communication signals including BPSK, QPSK, and raised cosine filtering. It generates random binary data, BPSK modulates the data using cosine carrier, filters the data using raised cosine filter, and analyzes the signal spectra using PSD. It then generates in-phase and quadrature components from the data, filters them, and quadrature modulates the carrier to create a QPSK signal for analysis.

Uploaded by

Kimberly Wilson
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/ 5

fb=1000;

fc=4e3;

% bit rate, Hz 1 bps


% carrier frequency, Hz here is 4kHz

T=20;

% length of waveform, seconds

fs=10*fc; % sampling rate, Hz


nb=fb*T; % number of bits here we can set number of bits (you can change T
to 8 or you can change fb to 8 kbps and set time to 20 seconds).
ns=fs*T;

% number of samples

% one way: b=randsrc(nb,1);


% more general: generate nb-bit column vector of +/-1
b = (rand(nb,1)>0.5)*2 - 1 ;

% one way: s=rectpulse(b,fs/fb); better way: generate indices that select


% which bit goes into which sample and copy the bits to the samples; this
% works for any ratio of sampling rate to bit rate.
k = floor(cumsum(ones(ns,1)*fb/fs))+1 ;
s = zeros(size(k)) ;
s = b(k) ;

% To get an accurate estimate of the signal spectrum we need to use a


% window whose spectral sidelobes are significantly lower than those of the
% signal we are measuring and whose frequency resolution (inverse of the
% FFT duration times the window width in the frequency domain) is
% significantly narrower than the width of the spectral features we are
% examining.

% A good choice to examine sidelobe levels is the Hamming window because


% the first sidelobe is >40dB below the peak.

% To examine the shape of the modulation sidelobes the frequency resolution


% of the spectral estimator should be on the order of fb/20 (or fb/40 to
% account for reduced resolution due to windowing).

The FFT length should

% thus be 40/fb or 40*fs/fb samples.

nfft = 40*fs/fb ;

hs = spectrum.welch('Hamming',nfft,50);
hso=psdopts(hs);
set(hso, 'Fs', fs, 'SpectrumType','twosided','CenterDC',true);
figure(1);
psd(hs, s, hso);

% time index
t

=[0:length(s)-1].'/fs ;

% BPSK modulated signal


sm = s.*cos(2*pi*fc*t) ;

figure(2);
psd(hs, sm, hso);

% the rcosflt() function computes the raised-cosine filter over the range
% (1-alpha)Fd to (1+alpha)Fd where Fd is the input (data) sampling rate.

% Thus the input is limited to one data value per sample.

% filter the data signal with a raised-cosine filter with alpha=0.5


% excess bandwidth

sf = rcosflt(b,fb,fs,'',0.5) ;

% plot in the time domain to see smoothing of the waveform

figure(3);
plot(sf(1:10*fs/fb));

% plot the spectrum of the filtered baseband signal

figure(4);
psd(hs, sf, hso);

% % BPSK modulated signal


t

=[0:length(sf)-1].'/fs ;

sfm = sf.*cos(2*pi*fc*t) ;

figure(5);
psd(hs, sfm, hso);

% plot the filtered and unfiltered time-domain signals together to compare


% their envelopes

figure(6);
plot([sm(1000:2000),sfm(1000:2000)]);

% generate the real and imaginary components of the QPSK (actually 4-QAM)
% signal

% number of complex data values


nc = floor(nb/2) ;

% use half of the bits for the real and half for the imaginary components

br=b(1:nc) ;
bi=b(nc+1:2*nc);

% raised-cosine filter

sr = rcosflt(br,fb,fs,'',0.5) ;
si = rcosflt(bi,fb,fs,'',0.5) ;

% generate the QPSK signal by quadrature modulating the carrier using the
% real and imaginary components

=[0:length(sr)-1].'/fs ;

sq = sr.*cos(2*pi*fc*t) + si.*sin(2*pi*fc*t) ;

figure(7);
psd(hs, sq, hso);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy