Sunteți pe pagina 1din 32

A Lab Project Report

On
QUADRATURE PHASE SHIFT KEYING MODULATION AND
DEMODULATION

Submitted as a part of
ANALOG COMMUNICATIONS
Submitted by
S. No. Roll No. Name of the Student
1 17311A04P2 ARUN KUMAR
2 17311A04P3 T.MANASWINI PATEL
3 17311A04P5 JAIESH REDDY

Under the Supervision of

Mr. R MADHUSUDHAN sir

(Signature)

Department of Electronics & Communication Engineering

Sreenidhi Institute of Science & Technology


(An Autonomous Institution affiliated to JNTUH)
Yamnampet , Ghatkesar , Hyderabad – 501 301.
Contents

• ABSTRACT

• INTRODUCTION

• EQUIPMENTS

• CODE

• THEORY & PROOFS

• BLOCK DIAGRM

• WORKING

• RESULTS

• REFERENCE
http://www.gaussianwaves.com/2010/10/qpsk-modulation-and-
demodulation-2
https://www.caeaccess.org/archives/volume2/number3/378-1692

ABSTRACT
Quadrature Phase Shift Keying (QPSK) is a modulation scheme commonly used in
wireless communication system and it's because of its ability to transmit twice the
data rate for a given bandwidth. In most cases, the QPSK modulator consumes less
power and bandwidth in a modern devices but for a system like satellite and
mobile devices where their operations are power limited, this is a problem that
needs to be fixed. The objective is to design the QPSK modulator that uses less
power for operation and it should be bandwidth efficient. The proposed technique
uses data stored inside a memory block to produce a symbol according to the given
input data. The QPSK modulation process requires a Direct Digital Synthesizer
(DDS) to produce sine and cosine wave which are used as carrier signal with the
data signal to produce QPSK/BPSK output signal. The proposed modulator
successfully modeled with Verilog Hardware Description Language (HDL),
simulated with Xilinx Integrated Software Environment (ISE) version 14. 5
software. QPSK modulation is also performed on MATLAB tool, which gives
three types of waveforms. 1) In-phase component, 2) Quadrature phase, and 3)
Composite of both. After that the QPSK demodulator has been developed using
MATLAB tool in order to verify the functionality of the modulator.

Since the early days of electronics, as advances in technology


were taking place, the boundaries of both local and global communication began
eroding, resulting in a world that is smaller and hence more easily accessible for
the sharing of knowledge and information. The pioneering work by Bell and
Marconi formed the cornerstone of the information age that exists today and paved
the way for the future of telecommunications.

Traditionally, local communication was done over wires, as this presented a cost-
effective way of ensuring a reliable transfer of information. However, for long-
distance communications, transmission of information over radio waves was
needed. Although this was convenient from a hardware standpoint, radio-waves
transmission raised doubts about the corruption of the information; transmission
was often dependent on high-power transmitters to overcome weather conditions,
large buildings, and interference from other sources of electromagnetics.

The various modulation techniques offered different solutions in terms of cost-


effectiveness and quality of received signals but until recently were still largely
analog. Frequency modulation and phase modulation presented a certain immunity
to noise, whereas amplitude modulation was simpler to demodulate. However,
more recently with the advent of low-cost microcontrollers and the introduction of
domestic mobile telephones and satellite communications, digital modulation has
gained in popularity. With digital modulation techniques come all the advantages
that traditional microprocessor circuits have over their analog counterparts. Any
shortfalls in the communications link can be eradicated using software.
Information can now be encrypted, error correction can ensure more confidence in
received data, and the use of DSP can reduce the limited bandwidth allocated to
each service.

As with traditional analog systems, digital modulation can use amplitude,


frequency, or phase modulation with different advantages. As frequency and phase
modulation techniques offer more immunity to noise, they are the preferred
scheme for the majority of services in use today.
INTRODUCTION :
QPSK MODULATION AND
DEMODULATION

QPSK Modulation:

In digital modulation techniques a set of basis functions are chosen for a particular
modulation scheme. Generally the basis functions are orthogonal to each other.
Basis functions can be derived using ‘Gram Schmidt orthogonalization’ procedure
.Once the basis function are chosen, any vector in the signal space can be
represented as a linear combination of the basis functions. In Quadrature Phase
Shift Keying (QPSK) two sinusoids (sin and cos) are taken as basis functions for
modulation. Modulation is achieved by varying the phase of the basis functions
depending on the message symbols. In QPSK, modulation is symbol based,where
one symbol contains 2 bits. The following equation outlines QPSK modulation
technique.

si(t)=2EsT−−−−√cos(2πfct+(2n−1)π4),n=1,2,3,4

When n=1, the phase shift is 45 degrees. This is called pi/4 QPSK. The
constellation diagram of QPSK will show the constellation points lying on both x
and y axes.This means that the QPSK modulated signal will have an in-phase
component (I) and also a quadrature component (Q). This is because it has only
two basis functions.A QPSK modulator can be implemented as follows. A
demultiplexer (or serial to parallel converter) is used to separate odd and even bits
from the generated information bits. Each of the odd bits (quadrature arm) and
even bits(in-phasearm) are converted toNRZ formatin a parallel manner.

The signal on the in-phase arm is multiplied by cosine component and the signal
on the quadrature arm is multiplied by sine component. QPSK modulated signal is
obtained by adding the signal from both in-phase and quadrature arm.

QPSK Demodulation:
For QPSK demodulator , a coherent demodulator is taken as an example. In
coherent detection technique the knowledge of the carrier frequency and phase
must be known to the receiver. This can be achieved by using a PLL (phase lock
loop) at the receiver. A PLL essentially locks to the incoming carrier frequency
and tracks the variations in frequency and phase. For the following simulation , a
PLL is not used but instead we simple use the output of the PLL.

For demonstration purposes we simply assume that the carrier phase recovery is
done and simply use the generated reference frequencies at the receiver (cos(ωt))
and (sin(ωt)).

In the demodulator the received signal is multiplied by a refer


ence frequency generators (cos(ωt)) and (sin(ωt)) on separate arms (in-phase and
quadrature arms). The multiplied output
on each arm is integrated over one bit period using an integrator. A threshold
detector makes a decision on each integrated bit based on a threshold. Finally the
bits on the in-phase arm (even bits) and on the quadrature arm (odd bits) are
remapped to form detected information stream. Detector for in-phase arm is shown
below. For quadrature arm the below architecture remains same but sin(ωt) basis
function must be used instead.

EQUIPMENTS:

 MATLAB SOFTWARE

CODE FOR QPSK MODULATION AND DEMODULATION

%Run from editor debug(F5)-DPSK UWB system analysis


%This m file simulates a differential phase shift keyed (DPSK) ultra wide
bandwidth(UWB) system using
%a fifth derivative waveform equation of a Gaussian pulse. I thought the setup for
DPSK
%would be apparent to configure from my other fifth drivative m files but several
emails
%convinced me otherwise so here it is. This system should be fairly easy to
breadboard in
%the lab assuming an appropriately starting pulse can be realized along with the
required
%delay line in the receuver. I have to keep reminding myself we are only talking
one to
%five meters, not miles. One could walk in front of the antennas and flip and move
the antennas to
%observe multipath, etc. Another interesting problem for test equipment vendors
%is how to measure and characterize the spectrum of the waveform coming off the
%transmitting antenna in the far field. Anyway, good luck to those who like to
tinker and
%play in new areas of wireless.
%The receiver section uses a squaring %circuit(mixer) with a delay in one leg and
a low pass filter
%is used to integrate the waveforms to recover the voltage levels(a radiometer
and/or correlaton receiver).
%A one bit flash ADC is simulated via a comparator routine to show the
demodulated
%output bits from the integrator. Various plots of time and frequency waveforms
are shown at
%different positions in the file so the user can observe and analyze the
%operation of the simulated system. The transmitter is simulated assuming
%the fifth order waveforms are being sent from an appropriate antenna. The
receiving antenna
%in a real system would distort the original and delayed signal equally.
%The fifth derivative waveform equation is obtained by use of the Matlab
symbolic processor in
%matlab.You would actually use the fourth derivative of the gaussian
%monocycle 1st derivative which is t/pw*exp(-t^2/pw^2).Procedure as follows:
%syms t pw
%t/pw*exp(-t^2/pw^2)enter
%diff(ans,t,4)
%ans=60/pw^5*t*exp(-t^2/pw^2)-80/pw^7*t^3*exp(-
t^2/pw^2)+16*t^5/pw^9*exp(-t^2/pw^2)
%set pw=1 to normalize and do an ezplot(ans) and you should get a plot of the
fifth order
%derivative which has 5 zero crossings.It is apparent from my previous files that
the 1st and
%second derivative pulses will not meet the FCC spectral mask without
%reducing the transmitter power. The fifth order derivative pulse meets the FCC
%mask without a reduction in power. It also retains a wide 3DB and 10DB
bandwidth.
%One may ask how to generate these pulses at the transmitter. One possible
%method might be to take a high speed differentially encoded digital bit stream
and process it
%thru highpass or bandpass filters(the pulse would ring on the leading edge
%and would ring and be inverted on the trailing edge) with the output being a close
match to a
%fourth derivative waveform and use a TX antenna that differentiates the pulse
%once for fifth order. DPSK does not require a template at the receiver and any
%distortions caused by the receiving antenna or the channel path would be reduced
%and possibly balanced out. It may be possible to improve the system (for short
distances
%and very high bit rates), to use direct sequence spread spectrum(DSSS) (for
smoothing and
%multiple access-may not be required since UWB is already a spread spectrum
process) and forward
%error correction(FEC) coding with the DPSK scheme. Not needing to synch up
the receiver with a templet
%solves a lot of design problems. You would only lose several DB of Eb/No(1e-3)
%and as stated before would not require generation of a template at
%the receiver for syncronization assuming timing jitter can be held to a minimum.
%The characteristics of the fifth order waveform are as follows and which you can
verify are:
%pw(tail to tail)=~.5e-9
%fc=~7Ghz
%3DB fl to fh=~3GHz
%10DB fl to fh=~6GHz
%You might wish to review my other files published under UWB or author(C,J) to
get
%additional information on UWB analysis.
%================================================
clear
Fs=100e9;%sample frequency
Fn=Fs/2;%Nyquist frequency
t=-1e-9:1/Fs:46e-9;%time vector sampled at Fs Hertz. zoom in/out using (-1e-
9:1/Fs:xxxx)-set for
%6e-9 to see first pulse.
%================================================
% EQUATIONS
%================================================
%y=A*(t/pw).*exp(-(t/pw).^2);%1st derivative of Gaussian pulse=Gaussian
monocycle
%y =1*(1 - 4*pi.*((t)/pw).^2).* exp(-2*pi.*((t)/pw).^2);%2nd derivative of
Gaussian
%pulse=doublet(two zero crossings)
pw=75e-12;%value sets pulse width of fifth derivative looking at figure 1
y=((60./pw.^5).*(t-0).*exp(-(t-0).^2./pw.^2)-(80./pw.^7).*(t-0).^3.*exp(-(t-
0).^2./pw.^2)+ ...
(16.*(t-0).^5./pw.^9.*exp(-(t-0).^2/pw.^2)));%Fifth derivative of Gaussian pulse.(5
zero crossings)

yd=((60./pw.^5).*(t-5e-9).*exp(-(t-5e-9).^2./pw.^2)-(80./pw.^7).*(t-5e-
9).^3.*exp(-(t-5e-9).^2./pw.^2)+ ...
(16.*(t-5e-9).^5./pw.^9.*exp(-(t-5e-9).^2/pw.^2)));%(one) fifth derivative pulse
delayed by 5e-9 sec
%================================================
%NOISE SETUP FOR BER AND SNR
%================================================

noise=1e-50*(randn(size(t)));%(Noise-AWGN)Set to 1e-50 to disable(set to~3e-5


for Eb/No=9DB BER @1e-3)

%================================================
%DPSK
%================================================
%The following series of equations sets the pulse recurring frequency(PRF)
%at 200MHz(waveform repeats every 5e-9 sec and a
%modulated bit stream(bit rate=200Mb/s)of 1001101 (differentially encoded to a
value of 01110110)
%where a phase change (0to1 or 1to0)=0 and no phase change (0to0 or 1to1)=1
%==================================================
% FIFTH DERIVATIVE(DPSK) WITH 5 PULSES)
%==================================================

%DPSK modulated fifth(ydiff)


A=.6e-45;%sets voltage level out of TX or input to mixer(.6e-45 for .6mv volt
peak to peak)
ydiff=-A*y+ ...
A*((60./pw.^5).*(t-5e-9).*exp(-(t-5e-9).^2./pw.^2)-(80./pw.^7).*(t-5e-9).^3.*exp(-
(t-5e-9).^2./pw.^2)+ ...
(16.*(t-5e-9).^5./pw.^9.*exp(-(t-5e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-10e-9).*exp(-(t-10e-9).^2./pw.^2)-(80./pw.^7).*(t-10e-
9).^3.*exp(-(t-10e-9).^2./pw.^2)+ ...
(16.*(t-10e-9).^5./pw.^9.*exp(-(t-10e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-15e-9).*exp(-(t-15e-9).^2./pw.^2)-(80./pw.^7).*(t-15e-
9).^3.*exp(-(t-15e-9).^2./pw.^2)+ ...
(16.*(t-15e-9).^5./pw.^9.*exp(-(t-15e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-20e-9).*exp(-(t-20e-9).^2./pw.^2)-(80./pw.^7).*(t-20e-
9).^3.*exp(-(t-20e-9).^2./pw.^2)+ ...
(16.*(t-20e-9).^5./pw.^9.*exp(-(t-20e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-25e-9).*exp(-(t-25e-9).^2./pw.^2)-(80./pw.^7).*(t-25e-
9).^3.*exp(-(t-25e-9).^2./pw.^2)+ ...
(16.*(t-25e-9).^5./pw.^9.*exp(-(t-25e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-30e-9).*exp(-(t-30e-9).^2./pw.^2)-(80./pw.^7).*(t-30e-
9).^3.*exp(-(t-30e-9).^2./pw.^2)+ ...
(16.*(t-30e-9).^5./pw.^9.*exp(-(t-30e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-35e-9).*exp(-(t-35e-9).^2./pw.^2)-(80./pw.^7).*(t-35e-
9).^3.*exp(-(t-35e-9).^2./pw.^2)+ ...
(16.*(t-35e-9).^5./pw.^9.*exp(-(t-35e-9).^2/pw.^2)));

%-A inverts waveform

%DPSK delayed(5e-9) fifth(ydelayed)(notice inversion from ydiff-keeps ADC


%(comparator) output correct). This is acceptable under differential
%encoding PSK phase ambiguity rules.
ydelayed=A*yd+ ...
-A*((60./pw.^5).*(t-10e-9).*exp(-(t-10e-9).^2./pw.^2)-(80./pw.^7).*(t-10e-
9).^3.*exp(-(t-10e-9).^2./pw.^2)+ ...
(16.*(t-10e-9).^5./pw.^9.*exp(-(t-10e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-15e-9).*exp(-(t-15e-9).^2./pw.^2)-(80./pw.^7).*(t-15e-
9).^3.*exp(-(t-15e-9).^2./pw.^2)+ ...
(16.*(t-15e-9).^5./pw.^9.*exp(-(t-15e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-20e-9).*exp(-(t-20e-9).^2./pw.^2)-(80./pw.^7).*(t-20e-
9).^3.*exp(-(t-20e-9).^2./pw.^2)+ ...
(16.*(t-20e-9).^5./pw.^9.*exp(-(t-20e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-25e-9).*exp(-(t-25e-9).^2./pw.^2)-(80./pw.^7).*(t-25e-
9).^3.*exp(-(t-25e-9).^2./pw.^2)+ ...
(16.*(t-25e-9).^5./pw.^9.*exp(-(t-25e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-30e-9).*exp(-(t-30e-9).^2./pw.^2)-(80./pw.^7).*(t-30e-
9).^3.*exp(-(t-30e-9).^2./pw.^2)+ ...
(16.*(t-30e-9).^5./pw.^9.*exp(-(t-30e-9).^2/pw.^2)))+ ...
-A*((60./pw.^5).*(t-35e-9).*exp(-(t-35e-9).^2./pw.^2)-(80./pw.^7).*(t-35e-
9).^3.*exp(-(t-35e-9).^2./pw.^2)+ ...
(16.*(t-35e-9).^5./pw.^9.*exp(-(t-35e-9).^2/pw.^2)))+ ...
A*((60./pw.^5).*(t-40e-9).*exp(-(t-40e-9).^2./pw.^2)-(80./pw.^7).*(t-40e-
9).^3.*exp(-(t-40e-9).^2./pw.^2)+ ...
(16.*(t-40e-9).^5./pw.^9.*exp(-(t-40e-9).^2/pw.^2)));

ydiff=ydiff+noise;%DPSK modulated fifth with noise


ydelayed=ydelayed+noise;%delayed DPSK fifth with noise

yc=ydelayed.*ydiff;
%yc=ydiff.*ydelayed;%This is where the correlation occurs in the receiver and
would be the
%mixer in the receiver. You are multipling the DPSK fifth with a .5e-9 delayed
replecia
%==================================================
% FFT
%==================================================
%new FFT for DPSK modulated fifth(ydiff)
NFFYDIFF=2.^(ceil(log(length(ydiff))/log(2)));
FFTYDIFF=fft(ydiff,NFFYDIFF);%pad with zeros
NumUniquePts=ceil((NFFYDIFF+1)/2);
FFTYDIFF=FFTYDIFF(1:NumUniquePts);
MYDIFF=abs(FFTYDIFF);
MYDIFF=MYDIFF*2;
MYDIFF(1)=MYDIFF(1)/2;
MYDIFF(length(MYDIFF))=MYDIFF(length(MYDIFF))/2;
MYDIFF=MYDIFF/length(ydiff);
f=(0:NumUniquePts-1)*2*Fn/NFFYDIFF;

%new FFT for correlated pulses(yc)


%yc is the time domain signal output of the multiplier
%(modulated times delayed) in the correlation receiver. Plots
%in the time domain show that a simple comparator and clocked flip flop instead
of a multibit high speed flash ADC
%may be used to recover the 1001101 signal depending on integrator design and
level of
%peak voltage into mixer.
NFFYC=2.^(ceil(log(length(yc))/log(2)));
FFTYC=fft(yc,NFFYC);%pad with zeros
NumUniquePts=ceil((NFFYC+1)/2);
FFTYC=FFTYC(1:NumUniquePts);
MYC=abs(FFTYC);
MYC=MYC*2;
MYC(1)=MYC(1)/2;
MYC(length(MYC))=MYC(length(MYC))/2;
MYC=MYC/length(yc);
f=(0:NumUniquePts-1)*2*Fn/NFFYC;

%===================================================
% PLOTS
%===================================================
%plots for DPSK modulated fifth(ydiff)
figure(1)
subplot(2,2,1); plot(t,ydiff);xlabel('TIME');ylabel('AMPLITUDE');
title('DPSK modulated pulse train(01110110)');
grid on;
%axis([-1e-9,27e-9 -1 2]);
subplot(2,2,2); plot(f,MYDIFF);xlabel('FREQUENCY');ylabel('AMPLITUDE');
grid on;
%axis([0 20e9 0 .0001]);%zoom in/out
subplot(2,2,3); plot(t,ydelayed);xlabel('TIME');ylabel('AMPLITUDE');
title('DPSK delayed pulse train(01110110)');
grid on;
%axis([-1e-9,27e-9 -1 2]);
subplot(2,2,4);
plot(f,20*log10(MYDIFF));xlabel('FREQUENCY');ylabel('20LOG10=DB');
grid on;
%axis([0 15e9 -200 5]);

%plots for correlated pulses(yc)


figure(2)
subplot(2,2,1); plot(t,yc);xlabel('TIME');ylabel('AMPLITUDE');
title('Receiver correlator output-no LPF');
grid on;
%axis([-1e-9,27e-9 -1 1]);
subplot(2,2,2); plot(f,MYC);xlabel('FREQUENCY');ylabel('AMPLITUDE');
grid on;
%axis([0 7e9 0 .025]);%zoom in/out
subplot(2,2,3);
plot(f,20*log10(MYC));xlabel('FREQUENCY');ylabel('20LOG10=DB');
grid on;
%axis([0 20e9 -120 0]);

%=========================================================
==
%CORRELATION RECEIVER COMPARATOR[ADC](before lowpass filter)
%=========================================================
==
pt=.1e-8%sets level where threshhold device comparator triggers
H=5;%(volts)
L=0;%(volts)
LEN=length(yc);
for ii=1:LEN;
if yc(ii)>=pt;%correlated output(yc) going above pt threshold setting
pv(ii)=H;%pulse voltage
else;
pv(ii)=L;
end;
end ;
po=pv;%pulse out=pulse voltage
%figure(3)
subplot(2,2,4);plot(t,po);
axis([-1e-9 27e-9 -1 6])
title('Comparator output');xlabel('FREQUENCY');ylabel('VOLTAGE');
grid on;
%===================================================
%SETUP and INFO
%===================================================
%Check axis settings on plots.
%Change t=-1e-9:1/Fs:(xxxx) to 1e-9 or proper value for viewing
%Press F5 or run.
%With waveform in plot 2,2,1(Figure 1), set pulse width to
%.5e-9(tail to tail).
%Change t=-1e-9:1/Fs:(xxx) to something like 46e-9.Zoom out. I would
%comment in all plot axis and use them for zooming in and out.
%Press F5 and observe waveforms. Print or observe waveforms to compare with
next set of
%wave forms.
%=========================================================
==========
% CORRELATION RECEIVER LOW PASS FILTER(INTEGRATOR)
%=========================================================
==============
rc=.5e-9;%time constant
ht=(1/rc).*exp(-t/rc);%impulse response
ycfo=filter(yc,1,ht)/Fs;%use this instead of ycfo=conv(yc,ht)/Fs for proper
dimension.
%The #=1 allows this. The LPF RC time constant(integrates over this time).
%Theory states that it should be set to the pulse width but should be set
%to a value that gives the best error free operation at the highest noise
%levels. Different filter types(butterworth,etc) may give different
%results.
%The 3DB or 1/2 power bandwidth on the RC LPF is f=1/(2*pi*RC). The noise
%bandwith is f=1/(4*rc).
yn=filter(noise,1,ht)/Fs;%looks at filtered noise only(Figure 4)

%new FFT for filtered correlated pulses(ycfo)


NFFYCFO=2.^(ceil(log(length(ycfo))/log(2)));
FFTYCFO=fft(ycfo,NFFYCFO);%pad with zeros
NumUniquePts=ceil((NFFYCFO+1)/2);
FFTYCFO=FFTYCFO(1:NumUniquePts);
MYCFO=abs(FFTYCFO);
MYCFO=MYCFO*2;
MYCFO(1)=MYCFO(1)/2;
MYCFO(length(MYCFO))=MYCFO(length(MYCFO))/2;
MYCFO=MYCFO/length(ycfo);
f=(0:NumUniquePts-1)*2*Fn/NFFYCFO;

%new FFT for filtered noise(yn)


NFFYN=2.^(ceil(log(length(yn))/log(2)));
FFTYN=fft(yn,NFFYN);%pad with zeros
NumUniquePts=ceil((NFFYN+1)/2);
FFTYN=FFTYN(1:NumUniquePts);
MYN=abs(FFTYN);
MYN=MYN*2;
MYN(1)=MYN(1)/2;
MYN(length(MYN))=MYN(length(MYN))/2;
MYN=MYN/length(yn);
f=(0:NumUniquePts-1)*2*Fn/NFFYN;

%plots for filtered correlated pulses(ycfo)


figure(3)
subplot(2,2,1); plot(t,ycfo);xlabel('TIME');ylabel('AMPLITUDE');
title('Receiver filtered correlator output');
grid on;
%axis([-1e-9,27e-9 -1 1]);
subplot(2,2,2); plot(f,MYCFO);xlabel('FREQUENCY');ylabel('AMPLITUDE');
grid on;
%axis([0 5e9 0 .35]);%zoom in/out
subplot(2,2,3);
plot(f,20*log10(MYCFO));xlabel('FREQUENCY');ylabel('20LOG10=DB');
grid on;
%axis([0 20e9 -120 0]);

%=========================================================
% CORRELATION RECEIVER COMPARATOR[ADC](after low pass filter)
%=========================================================
pt1=1.7e-8%sets level where threshhold device comparator triggers
H=5;%(volts)
L=0;%(volts)
LEN=length(ycfo);
for ii=1:LEN;
if ycfo(ii)>=pt1;%correlated output(ycfo) going above pt threshold setting
pv1(ii)=H;%pulse voltage
else;
pv1(ii)=L;
end;
end ;
po1=pv1;%pulse out=pulse voltage

subplot(2,2,4);plot(t,po1);xlabel('FREQUENCY');ylabel('VOLTAGE');
axis([-1e-9 50e-9 -1 6]);
title('Comparator output (filtered) 1001101');
grid on;

%plots for filtered noise(yn) and impulse response of filter


figure(4)
subplot(2,2,1);plot(t,yn);xlabel('TIME');ylabel('AMPLITUDE');
title('Receiver filtered noise output');
grid on;
%axis([-1e-9,27e-9 -1 1]);
subplot(2,2,2); plot(f,MYN);xlabel('FREQUENCY');ylabel('AMPLITUDE');
grid on;
%axis([0 5e9 0 .25]);%zoom in/out
subplot(2,2,3);
plot(f,20*log10(MYN));xlabel('FREQUENCY');ylabel('20LOG10=DB');
grid on;
%axis([0 20e9 -120 0]);
subplot(2,2,4);plot(t,ht);xlabel('TIME');ylabel('AMPLITUDE');
title('Filter impulse response(ht)');
grid on;
%axis([0,1e-9 0 1]);

%=========================================================
%BER CALCULATIONS
%=========================================================

%I'm going to calibrate the noise generator and roughly determine the Eb/No or
SNR in DB
%that allows the system to operate almost error free(1e-3) in a noise environment.
%This value of Eb/No is the number in DB that can be used in link
%calculations. The calibration is required because in an actual TX-RX the received
%voltage into the correlation receiver at the mixer will be in the low millivolt
%region due to the FCC spectral mask at -41.3dBm/MHz and low transmitter
power.
%It will not be the 2 volt peak-peak BPSK used here and must be recalibrated if
%different than 2 volt peak-peak.

%The Eb/No value in DB is calculated as follows. Doing numerous runs by hand


and
%observing the LPF comparator output in figure 4, determine the proper
%setting of the comparator threshold setting, RC filter time constant and
%level of multiplier in the AWGN noise generator that gives almost error
%free operation. This will be considered Eb/No in DB.For DPSK theory this value
is ~9DB for BER of 1e-3.
%For a SNR of 9 DB, 20*LOG10(ratio of Vsigp-p/Vnoisep-
p=9DB=20*LOG(0.6e-3/0.213e-3)
%You can try a different calibration method if you don't think
%this is correct. Remember to recalibrate for new pulse widths and amplitude
changes
%into the mixer and pay attention to axis settings. There are a few to keep track of.

%I did some preliminary link caculations with this set up and determined that
approx 0.6mv p-p
%would be present on the mixer input at Eb/No=9DB.
%========================================================
%FCC spectral mask -41.3dBm/MHz+10LOG10(~4000)=~-5dBm(aver TX power
Pt)
%antenna gains 0DBi(50 ohms)
%lna 20DB gain
%NF 10 DB
%distance 1 meter
%(PL)path loss~45DB
%200Mbit rate(Rb)
%BW~318Mhz 3DB BW(LPF)(RC=.5e-9)
%Pn(receiver noise level)=KTB=-114dBm+NF+10log10(Rb)=-
114dBm+10DB+23DB=-81dBm
%3DB to 10DB spread of pulse ~3 to 6GHz(use 4GHz)
%pw=.5e-9 fifth derevative
%fc=~7Ghz
%Eb/No=9DB(1e-3)
%power received(Pr)@ant=-5dBm-45DB(PL)=-50dBm over ~4GHz.
%Link margin=Pr-Pn-Eb/No
%Link margin@ 1 meter=-50dBm-(-81dBm)-(9DB)=22DB
%Emixerp-p=sqrt(1e-5mw*50)=2.23e-
2mvrms*1.41=0.03mvpeak*20DB(lna)gain=0.3mvpeak or 0.6mvp-p

THEORY &PROOFS:

Digital Frequency Modulation:

A simple variation from traditional analog frequency modulation (FM) can be


implemented by applying a digital signal to the modulation input. Thus, the output
takes the form of a sine wave at two distint frequencies. To demodulate this
waveform, it is a simple matter of passing the signal through two filtersand
translating the resultant back into logic levels. Traditionally, this form of
modulation has been called frequency-shift keying (FSK).

Digital Phase Modulation:

Spectrally, digital phase modulation, or phase-shift keying (PSK), is very similar to


frequency modulation. It involves changing the phase of the transmitted waveform
instead of the frequency, and these finite phase changes represent digital data. In its
simplest form, a phase-modulated waveform can be generated by using the digital
data to switch between two signals of equal frequency but opposing phase. If the
resultant waveform is multiplied by a sine wave of equal frequency, two
components are generated: one cosine waveform of double the received frequency
and one frequency-independent term whose amplitude is proportional to the cosine
of the phase shift. Thus, filtering out the higher-frequency term yields the original
modulating data prior to transmission. This is difficult to picture conceptually, but
mathematical proof will be shown later.
Quadraphase-Shift Modulation:

Taking the above concept of PSK a stage further, it can be assumed that the
number of phase shifts is not limited to only two states. The transmitted "carrier"
can undergo any number of phase changes and,by multiplying the received signal
by a sine wave of equal frequency, will demodulate the phase shifts into
frequency-independent voltage levels.This is indeed the case in quadraphase-shift
keying (QPSK). With QPSK, the carrier undergoes four changes in phase (four
symbols) and can thus represent 2 binary bits of data per symbol. Although this
may seem insignificant initially, a modulation scheme has now been supposed that
enables a carrier to transmit 2 bits of information instead of 1, thus effectively
doubling the bandwidth of the carrier.The proof of how phase modulation, and
hence QPSK, is demodulated is shown below. The proof begins by defining Euler's
relations, from which all the trigonometric identities can be derived.

Euler's relations state the following:

Now consider multiplying two sine waves together, thus:

From Equation 1, it can be seen that multiplying two sine waves together
(one sine is the incoming signal, the other is the local oscillator at the

receiver mixer) results in an output frequency double that of


the input (at half the amplitude)superimposed on a DC offset of half the
input amplitude.

Similarly, multiplying sin ωt by cos ωt gives

Which gives an output frequency (sin 2ωt) double that of the input, with no DC
offset.It is now fair to make the assumption that multiplying sin ωt by any phase-
shifted sine wave (sin ωt + ø)yields a "demodulated" waveform with an output
frequency double that of the input frequency, whose DC offset varies according to
the phase shift, ø.
To prove this:

Thus, the above proves the supposition that the phase shift on a carrier can
be demodulated into a varying output voltage by multiplying the carrier with
a sine-wave local oscillator and filtering out the high-frequency term.
Unfortunately, the phase shift is limited to two quadrants; a phase shift of
π/2cannot be distinguished from a phase shift of -π/2. Therefore, to
accurately decode phase shifts present in all four quadrants, the input signal
needs to be multiplied by both sinusoidal and cosinusoidal waveforms, the
high frequency filtered out, and the data reconstructed. The proof of this,
expanding on the above mathematics, is shown below.
Thus:

A SPICE simulation verifies the above theory. Figure 1 shows a block diagram of
a simple demodulator circuit. The input voltage, QPSK IN, is a 1MHz sine wave
whose phase is shifted by 45°, 135°, 225°, and then 315° every 5μs.

Figures 2 and 3 show the "in-phase" waveform, VI, and the "quadrature"
waveform, VQ, respectively.Both have a frequency of 2MHz with a DC offset
proportional to the phase shift, confirming the above mathematics.
Figure 4 is the phasor diagram showing the phase shift of QPSK IN and the

demodulated data.
The above theory is perfectly acceptable, and it would appear that removing the
data from the carrier is a simple process of lowpass filtering the output of the mixer
and reconstructing the four voltages back into logic levels. In practice, getting a
receiver local oscillator exactly synchronized with the incoming signal is not easy.
If the local oscillator varies in phase with the incoming signal, the signals on the
phasor diagram will undergo a phase rotation with its magnitude directly
proportional to the phase difference. Moreover, if the phase and frequency of the
local oscillator are not fixed with respect to the incoming signal, there will be a
continuing rotation on the phasor diagram. Therefore, the output of the front-end
demodulator is normally fed into an ADC and any rotation resulting from errors in
the phase or frequency of the local oscillator are removed in DSP.An effective way
of converting directly to baseband is using a direct-conversion tuner IC.The above
devices are part of the rapidly expanding RF chipsets from Maxim Integrated
Products. With five high-speed processes, more than 70 high-frequency standard
products, and 52 ASICs in development, Maxim is committed to being a major
player in the RF/wireless, fiber/cable, and instrumentation markets.

BLOCKDIAGRAM:

QPSK Modulator
QPSK demodulator

WORKING OF QPSK IN MATLAB:

Quardrature Phase Shift Key Phase shift key modulation


is a technique in which phase of carrier wave is varied in accordance with the
modulating signal. QPSK(Quardrature phase shift key) or sometimes called as 4-
PSK is a digital modulation technique. Here 4 represents 4 phase (45,135,225,315),
in which carrier is send (fig 1). QPSK has 4 possible states i.e. QPSK can encode 2
bit per symbol. It provide phase shift of Pi/2 (90°)multiple times.

Fig.1 Shows constellation view of QPSK signal showing 4 possible phase i.e. 45°, 135°, 225°
and 315°. Each symbol contains 2 bit as shown in above figure.
QPSK signal is generated using a binary bit stream; this stream is then given into
demultiplexer which then gives two outputs
(Fig 2)
.

Fig.2 Shows block diagram


of QPSK modulation technique with each blocks shown clearly.

These outputs from demultiplexer undergo NRZ coding and get shifted by pi/2
phase shift and are finally added to give QPSK signal.

Quardrature amplitude modulation


Amplitude modulation is a technique in which amplitude of
the carrier signal is varied in accordance with the modulating
signal. QAM (Quardrature amplitude modulation) is both
analog and digital modulation technique.

It is called quadrature because of two carrier wave that are out of phase with each
other by 90° (Fig 3) .Thus after modulation, the signal that we get varies by both
amplitude and phase. As shown in fig 3. I and Q inputs individually are mixed with
out of phase waves and then are finally added to give output QAM signal.
DIGITAL MODULATION TECHNIQUES
In digital modulation the modulated signal is a digital signal. It can be said as
digital to analog conversion method. Various digital modulation schemes are:

A. ASK
In ASK (Amplitude shift key) amplitude of the carrier wave is varied in
accordance with the modulating signal. As shown in figure 4 a digital data
1011010 is to be transmitted which is represented by a modulating signal, after
modulating carrier signal according to the data given an ASK modulated signal is
generated.
Fig.3 shows block diagram of QAM modulation technique. I and Q inputs individually are mixed
with out of phase waves and then are finally added to give output QAM

B. FSK

In FSK (Frequency shift key) frequency of carrier wave is varied in accordance


with the modulating signal. Figure 5 shows a carrier wave and a digital data
1011010 which is modulated to give frequency modulated wave.

Fig.4 Shows ASK modulation technique in which a digital data 1011010 is to be transmitted
using ASK modulation
Fig.5 shows FSK modulation technique. A digital data 1011010 is to be transmitted using FSK
modulation

C. PSK
In PSK (Phase shift key) phase of the carrier wave is varied in accordance with the
modulating signal. Figure 6 shows a signal 1011010 and a carrier signal which
after modulation gives a PSK modulated signal. A PSK further includes QPSK,
BPSK and DPSK techniques.

Fig.6 Shows PSK modulation technique. A digital data 1011010 and a carrier signal which after
modulation gives a PSK modulated signal.
RESULT:

FIGURE-1
REFERENCE:

http://www.gaussianwaves.com/2010/10/qpsk-modulation-and-
demodulation-2

https://www.caeaccess.org/archives/volume2/number3/378-1692
www.pudn.com

S-ar putea să vă placă și