You are on page 1of 30

INDEX

S.NO EXPERIMENT DATE SIGNATURE


1. MATLAB Code to generate Amplitude Shift
Key (ASK) Modulation and Demodulation
signal
2. MATLAB Code to generate Phase Shift
Keying ( Modulation and Demodulation signal
3. MATLAB Code to generate Frequency Shift
Keying (FSK) Modulation and Demodulation
signal

4. MATLAB Code to perform Pulse Code


modulati demodulation (PCM) signal

5. MATLAB Code to generate Adaptive Delta


Modulation and Demodulation signal
6. MATLAB Code to perform Number of bit
errors and bit error rate (BER)
7. MATLAB Code to Configure Eb/No for
AWGN Channels with Coding
8. MATLAB Code to perform MSK Signal
Recovery
9. MATLAB Code to perform DQPSK Signal in
AWGN
10. MATLAB Code to perform OQPSK Signal in
AWGN
EXPERIMENT 1
AIM:To write a code in MATLAB to generate modulated and demodulated ASK wave.
CODE:
bitStream=input(
'Enter bit stream: )';%defining a bit stream
length_bitStream=length(bitStream);if
(bitStream(length_bitStream)==1)
bitStream(length_bitStream+1)=1;else
bitStream(length_bitStream+1)=0;end
Amplitude=5;
time=0:0.001:length_bitStream/10;
frequency_carrier1=50;%carrier
wave
carrier1=Amplitude*sin(2*pi*frequency_carrier1*time);
%ASK Modulation Partfor
i=1:length_bitStreamfor
j=(i-1)*100:(i*100)if
bitStream(i)==1
y(j+1)=carrier1(j+1);
else y(j+1)=0;end end
end
%ASK Demodulation Part
for i=1:(length(y)
-1)/100
for j=(i-1)*100:i*100if
y(j+1)==0 g(j+1)=0;else
g(j+1)=1;end end end
%ASK Plottingsubplot(4,1,1)
stairs(bitStream)
axis([1 length_bitStream+1-5 5])
title('Given Sequence'
);
subplot(4,1,2)
plot(time,carrier1)
title('Carrier Signal'
);
subplot(4,1,3) plot(y)
title('ASK Modulated Wave'
);
axis([0 length_bitStream*100-5 5])
subplot(4,1,4) plot(g)
title('ASK Demodulated Wave'
);
axis([0 length_bitStream*100-5 5])

OUTPUT:

:
COMMAND WINDOW
x=input('Enter input bit stream: '); % Binary Information bp=.000001;
% bit period
% representation of transmitting binary information as digital signal
bit=[]; for n=1:1:length(x) if x(n)==1; se=ones(1,100); else x(n)==0;
se=zeros(1,100); end bit=[bit se]; end
t1=bp/100:bp/100:100*length(x)*(bp/100);
FIGURE WINDOW:
subplot(4,1,1);
plot(t1,bit,'lineWidth',1.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)'); xlabel(' time(sec)');
title('transmission sequence');
%XXXXXXXXXXXXXXXXXXXXXXX Binary-PSK modulation XXXXXXXXXXXXXXXXXXXXXXXXXXX%
A=5; % Amplitude of carrier signal
br=1/bp; % bit rate f=br*2; %
carrier frequency
t2=bp/99:bp/99:bp; ss=length(t2); m=[];
for (i=1:1:length(x)) if
(x(i)==1) y=A*sin(2*pi*f*t2);
else
y=A*sin(2*pi*f*t2+pi); %A*sin(2*pi*f*t+pi) means -A*sin(2*pi*f*t)
end m=[m y]; end
t3=bp/99:bp/99:bp*length(x);
%plotting carrier signal
subplot(4,1,2);
plot(t3,A*sin(2*pi*f*t3));
xlabel('t(sec)');
ylabel('A(volt)');
title('Carrier Wave'); %plotting
modulated wave subplot(4,1,3);
plot(t3,m);
xlabel('t(sec)'); ylabel('A(volt)');
RESULT:
title('Modulated ASK Signal');
We observed the modulatedBinary
%XXXXXXXXXXXXXXXXXXXX and demodulated ASK(Amplitude
PSK demodulation Shift Keying) Wave on MATLAB.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=sin(2*pi*f*t); % carrier signal
mm=y.*m((n-(ss-1)):n); t4=bp/99:bp/99:bp;
z=trapz(t4,mm); % integration
zz=round((2*z/bp)) ; if(zz>0)
% logic level = (A+A)/2=0
%because A*sin(2*pi*f*t+pi) means -A*sin(2*pi*f*t) a=1; else a=0;
end mn=[mn a]; end
disp(' Binary information at Receiver :'); disp(mn);
%XXXXX Representation of binary information as digital signal which achived
%after PSK demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX bit=[]; for
n=1:length(mn); if mn(n)==1; se=ones(1,100); else mn(n)==0;
se=zeros(1,100); end bit=[bit se]; end
EXPERIMENT 2
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(4,1,4)

AIM:To write a code in MATLAB to generate modulated and demodulated PSK wave.
CODE:
clc; clear
all;
plot(t4,bit,'LineWidth',1.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('A(volt)'); xlabel(' t(sec)');
title('Demodulated PSK Wave');
%>>>>>>>>>>>>>>>>>>>>>>>>>> end of program >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%

OUTPUT:

COMMAND WINDOW:
FIGURE WINDOW:
RESULT:
We observed the modulated and demodulated PSK (Phase Shift Keying) Wave on MATLAB.

EXPERIMENT 3
AIM: To write a code in MATLAB to generate modulated and demodulated FSK wave.
CODE:
%>>>>>>>>> MATLAB code for binary FSK modulation and de-modulation >>>>>>>%
clc; clear all;
x=input('Enter input bit stream: '); % Binary Information bp=.000001;
% bit period
%XX representation of transmitting binary information as digital signal XXX
bit=[]; for n=1:1:length(x) if x(n)==1; se=ones(1,100); else x(n)==0;
se=zeros(1,100); end bit=[bit se]; end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(5,1,1);
plot(t1,bit,'lineWidth',1.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('A(volt)'); xlabel(' t(sec)');
title('transmission Sequence');
%XXXXXXXXXXXXXXXXXXXXXXX Binary-FSK modulation XXXXXXXXXXXXXXXXXXXXXXXXXXX%
A=5; % Amplitude of carrier signal br=1/bp;
% bit rate f1=br*6; % carrier frequency for
information as 1
f2=br*2; % carrier frequency for information as 0
t2=bp/99:bp/99:bp; ss=length(t2); m=[];
for (i=1:1:length(x)) if
(x(i)==1)
y=A*cos(2*pi*f1*t2);
else
y=A*cos(2*pi*f2*t2);
end m=[m y]; end
t3=bp/99:bp/99:bp*length(x);
subplot(5,1,2);
plot(t3,A*cos(2*pi*f1*t3));
xlabel('t(sec)');
ylabel('A(volt)'); title('Carrier
Signal 1'); subplot(5,1,3);
plot(t3,A*cos(2*pi*f2*t3));
xlabel('t(sec)');
ylabel('A(volt)'); title('Carrier
Signal 2'); subplot(5,1,4); plot(t3,m);
xlabel('t(sec)'); ylabel('A(volt)');
title('Modulated FSK Signal');
%XXXXXXXXXXXXXXXXXXXX Binary FSK demodulation XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t); % carrier signal for information 1
y2=cos(2*pi*f2*t); % carrier signal for information 0
mm=y1.*m((n-(ss-1)):n); mmm=y2.*m((n-(ss-1)):n); t4=bp/99:bp/99:bp;
z1=trapz(t4,mm) ; % integration
z2=trapz(t4,mmm); % integration
zz1=round(2*z1/bp); zz2= round(2*z2/bp);
if(zz1>A/2) % logic level= (0+A)/2 or (A+0)/2 or 2.5 ( in this case)
a=1; else(zz2>A/2) a=0; end mn=[mn a]; end
disp(' Binary information at Receiver :'); disp(mn);
%XXXXX Representation of binary information as digital signal which achived
%after demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX bit=[]; for
n=1:length(mn); if mn(n)==1; se=ones(1,100); else mn(n)==0;
se=zeros(1,100); end bit=[bit se]; end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(5,1,5)
plot(t4,bit,'LineWidth',1.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('A(volt)'); xlabel(' t(sec)');
title('Demodulated FSK Signal');
%>>>>>>>>>>>>>>>>>>>>>>>>>> end of program >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%

OUTPUT:
COMMAND WINDOW:
FIGURE WINDOW:
RESULT:
We observed the modulated and demodulated FSK (Frequency Shift Keying) Wave on MATLAB.

EXPERIMENT 4
AIM: To write a code in MATLAB to generate modulated and demodulated PCM Wave.
CODE:

clc; close all; clear all; n=input('Enter n value for n-


bit PCM system : '); %n=8; n1=input('Enter number of samples in a period : '); %s=10;
L=2^n;
% Sampling Operation x=0:2*pi/n1:4*pi; % n1 nuber of samples have tobe
selected s=8*sin(x); subplot(3,1,1); plot(s); title('Analog Signal'); ylabel('Amplitude--
>'); xlabel('Time--->'); subplot(3,1,2); stem(s);grid on; title('Sampled Sinal');
ylabel('Amplitude--->'); xlabel('Time--->');
% Quantization Process vmax=8; vmin=-vmax; del=(vmax-vmin)/L; part=vmin:del:vmax;
% level are between vmin and vmax with difference of del code=vmin-(del/2):del:vmax+
(del/2); % Contaion Quantized valuses [ind,q]=quantiz(s,part,code);
% Quantization process
% ind contain index
number and q contain quantized values l1=length(ind); l2=length(q);
for i=1:l1 if(ind(i)~=0) % To make
index as binary decimal so started from 0 to N ind(i)=ind(i)-1; end i=i+1;
end for i=1:l2
if(q(i)==vmin-(del/2)) % To make quantize value inbetween
the levels q(i)=vmin+(del/2); end end
subplot(3,1,3); stem(q);grid on; % Display
the Quantize values title('Quantized Signal'); ylabel('Amplitude--->'); xlabel('Time---
>');
% Encoding Process figure code=de2bi(ind,'left-msb'); % Convert the decimal
to binary k=1; for i=1:l1 for j=1:n coded(k)=code(i,j); %
convert code matrix to a coded row vector j=j+1; k=k+1; end i=i+1;
end subplot(2,1,1); grid on; stairs(coded); % Display the
encoded signal axis([0 100 -2 3]); title('Encoded Signal'); ylabel('Amplitude-->');
xlabel('Time--->');
% Demodulation Of PCM signal qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Getback the index in decimal form
q=del*index+vmin+(del/2); %
getback Quantized values subplot(2,1,2); grid on; plot(q);
% Plot Demodulated signal title('Demodulated Signal'); ylabel('Amplitude--->');
xlabel('Time--->');
OUTPUT:
FIGURE WINDOW:

RESULT:
We observed the modulated and demodulated PCM(Pulse Code Modulation) Wave on MATLAB.
EXPERIMENT 5
AIM: To write a code in MATLAB to generate modulated and demodulated Adaptive
Delta Modulation Wave.
CODE:

FUNCTION DEFINITION
function [ADMout] = adeltamod(sig_in, Delta, td, ts)

if (round(ts/td) >= 2)
Nfac = round(ts/td); %Nearest integer
xsig = downsample(sig_in,Nfac);
Lxsig = length(xsig);
Lsig_in = length(sig_in);
ADMout = zeros(Lsig_in); %Initialising output cnt1 = 0;
%Counters for no. of previous consecutively increasing cnt2 = 0; %steps
sum = 0; for i=1:Lxsig if (xsig(i) ==
sum) elseif (xsig(i) > sum) if (cnt1 < 2)
sum = sum + Delta; %Step up by Delta, same as in DM
elseif (cnt1 == 2) sum = sum + 2*Delta; %Double the
step size after %first two
increase elseif (cnt1 == 3) sum = sum
+ 4*Delta; %Double step size else
sum = sum + 8*Delta; %Still double and then stop
%doubling thereon
end if (sum < xsig(i))
cnt1 = cnt1 + 1; else cnt1
= 0; end else if
(cnt2 < 2) sum = sum - Delta;
elseif (cnt2 == 2) sum = sum - 2*Delta;
elseif (cnt2 == 3) sum = sum - 4*Delta;
else sum = sum - 8*Delta;
end
if (sum > xsig(i)) cnt2
= cnt2 + 1;
else cnt2 = 0; end
end
ADMout(((i-1)*Nfac + 1):(i*Nfac)) = sum;
end end end

FUNCTION CALL- % define the


input signal
t=0:2*pi/100:2*pi; A=10;
x=A*sin(t);

%plot the original signal plot(x)


hold on

% calling the adaptive delta modulation function


ADMout = adeltamod(x, 1, 0.1,0.3); plot(ADMout);
\

OUTPUT:
FIGURE WINDOW:

RESULT:
We observed the modulated and demodulated ADM(Amplitude Code MOdulation) Wave on MATLAB.
EXPERIMENT 6
AIM:
MATLAB Code to perform Number of bit errors and bit error rate (BER)

MATLAB CODE:
%Number of bit errors %Create
two binary matrices.
x = [0 0; 0 0; 0 0; 0 0] y = [0 0; 0 0; 0 0; 1 1] numerrs = biterr(x,y)%Determine
the number of bit errors. numerrs = biterr(x,y,[],'column-wise')%Compute the
number of column-wise errors . numerrs = biterr(x,y,[],'row-wise')%Compute the
number of row-wise errors. numerrs = biterr(x,y,[],'overall')%Compute the number
of overall errors.

%bit error rate (BER


M = 64; % Modulation order
k = log2(M); % Bits per symbol
EbNoVec = (5:15)'; % Eb/No values (dB)
numSymPerFrame = 100; % Number of QAM symbols per frame
berEst = zeros(size(EbNoVec)); for n = 1:length(EbNoVec)
% Convert Eb/No to SNR snrdB = EbNoVec(n)
+ 10*log10(k); % Reset
the error and bit counters
numErrs = 0; numBits = 0;

while numErrs < 200 && numBits < 1e7 %


Generate binary data and convert to symbols
dataIn = randi([0 1],numSymPerFrame,k); dataSym
= bi2de(dataIn);
% QAM modulate using 'Gray' symbol mapping
txSig = qammod(dataSym,M);

% Pass through AWGN channel


rxSig = awgn(txSig,snrdB,'measured');
% Demodulate the noisy signal
rxSym = qamdemod(rxSig,M); %
Convert received symbols to bits
dataOut = de2bi(rxSym,k);

% Calculate the number of bit errors


nErrors = biterr(dataIn,dataOut);

% Increment the error and bit counters


numErrs = numErrs + nErrors; numBits = numBits
+ numSymPerFrame*k;
end

% Estimate the BER


berEst(n) = numErrs/numBits; end
berTheory = berawgn(EbNoVec,'qam',M);
semilogy(EbNoVec,berEst,'*') hold on
semilogy(EbNoVec,berTheory) grid
legend('Estimated BER','Theoretical
BER') xlabel('Eb/No (dB)') ylabel('Bit
Error
Rate')
OUTPUT:

COMMAND WINDOW
>> BitErrorRateComputationExample x
=
0 0
0 0
0 0
0 0y
=
0 0
0 0
0 0
1 1

numerrs =

numerrs =

1 1
numerrs =

0
0
0
2

numerrs =

FIGURE WINDOW
BitsPerSymbol: 4

SignalPower: 1

SamplesPerSymbol: 1

RandomStream: 'Global stream'

EXPERIMENT 8
AIM:
EXPERIMENT 7
MATLAB Code to perform MSK Signal Recovery

MATLAB
AIM: CODE:
MATLAB Code to Configure Eb/No for AWGN Channels with Coding
%% MSK Signal Recovery
% Model channel impairments such as timing phase offset, carrier frequency
MATLAB
% offset, and CODE :
carrier phase offset for a minimum shift keying (MSK) signal.
N% =Use
15;|comm.MSKTimingSynchronizer|
% R-S codeword length in symbols
and |comm.CarrierSynchronizer| System
K% =objects
9; to
% R-S
synchronize
message length
such signals
in symbols
at the
M = receiver.
16; % Modulation
The MSK timing
order
% synchronizer
rsEncoder recovers
= the timing offset, while a carrier synchronizer
comm.RSEncoder(
% recovers the 'CodewordLength'
carrier frequency,N,'MessageLength' ,K, ...
and phase offsets.
%% 'BitInput',true);
pskModulator
% Initialize =system
comm.PSKModulator(
variables by'ModulationOrder'
running the MATLAB
,M,'BitInput',true);
script rsDecoder
=% comm.RSDecoder ('CodewordLength',N,'MessageLength'
|configureMSKSignalRecoveryEx|. ,K, ...
Define the logical control variable
'BitInput',true); to enable timing phase recovery, and % |
% |recoverTimingPhase|
pskDemodulator
recoverCarrier|= to comm.PSKDemodulator( 'ModulationOrder'
enable carrier frequency ,M,'BitOutput'
and phase recovery. ,true);
codeRate = K/N; bitsPerSymbol recoverTimingPhase
configureMSKSignalRecoveryEx; = log2(M); = true; recoverCarrier
UncodedEbNo
= true; = 6;
CodedEbNo
%% Modeling = UncodedEbNo + 10*
log10(codeRate); channel =
Channel Impairments
comm.AWGNChannel(
% Specify the sample 'BitsPerSymbol' ,bitsPerSymbol);
delay, |timingOffset|, that the channel model applies.
channel.EbNo = CodedEbNo
% Create a variable fractional delay object to introduce the timing delay %
to the transmitted signal.
OUTPUT:
%%
timingOffset = 0.2; varDelay =
COMMAND WINDOW
dsp.VariableFractionalDelay;
%%
>> AWGN a |comm.PhaseFrequencyOffset| System object to introduce carrier
% Create
% phase and frequency offsets to a modulated signal. Because the MSK
channel = comm.AWGNChannel with
% modulator upsamples the transmitted symbols, set the |SampleRate|
% property to the ratio of the |samplesPerSymbol| and the sample time,
properties:

NoiseMethod: 'Signal to noise ratio (Eb/No)'

EbNo: 3.7815
% |Ts|. %% freqOffset = 50;
phaseOffset = 30; pfo =
comm.PhaseFrequencyOffset(...
'FrequencyOffset',freqOffset, ...
'PhaseOffset',phaseOffset, ...
'SampleRate',samplesPerSymbol/Ts);
%%
% Create a |comm.AWGNChannel| System object to add white Gaussian noise to
% the modulated signal. The noise power is determined by the |EbNo| %
property, that is the bit energy to noise power spectral density ratio. %
Because the MSK modulator generates symbols with 1 Watt of power, set the
% signal power property of the AWGN channel System object to 1.
%%
EbNo = 20 + 10*log10(samplesPerSymbol); chAWGN =
comm.AWGNChannel(...
'NoiseMethod','Signal to noise ratio (Eb/No)', ...
'EbNo',EbNo,...
'SignalPower',1, ...
'SamplesPerSymbol',samplesPerSymbol);
%% Timing Phase, Carrier Frequency, and Carrier Phase Synchronization %
Create an MSK timing synchronizer to recover symbol timing phase using a %
fourth-order nonlinearity method.
%% timeSync = comm.MSKTimingSynchronizer(...
'SamplesPerSymbol',samplesPerSymbol, ...
'ErrorUpdateGain',0.02);
%%
% Create a carrier synchronizer to recover both carrier frequency and
% phase. Because the MSK constellation is QPSK with a 0-degree phase %
offset, set the |comm.CarrierSynchronizer| accordingly.
%% phaseSync = comm.CarrierSynchronizer(...
'Modulation','QPSK', ...
'ModulationPhaseOffset','Custom', ...
'CustomPhaseOffset',0, ...
'SamplesPerSymbol',1);
%% Stream Processing Loop
% The simulation modulates data using MSK modulation. The modulated symbols
% pass through the channel model, which applies timing delay, carrier
% frequency and phase shift, and additive white Gaussian noise. The
% receiver performs timing phase and carrier frequency and phase recovery.
% Finally, the signal symbols are demodulated and the bit error rate is %
calculated. The |plotResultsMSKSignalRecoveryEx| script generates scatter %
plots in this order to show these effects:
%
% # Channel impairments
% # Timing synchronization
% # Carrier synchronization
%
% At the end of the simulation, the example displays the timing phase,
% frequency, and phase estimates as a function of simulation time.
%%
for p = 1:numFrames
%------------------------------------------------------------------------
% Generate and modulate data
%------------------------------------------------------------------------
txBits = randi([0 1],samplesPerFrame,1);
txSym = modem(txBits);
%------------------------------------------------------------------------
% Transmit through channel
%------------------------------------------------------------------------
%
% Add timing offset rxSigTimingOff =
varDelay(txSym,timingOffset*samplesPerSymbol);
%
% Add carrier frequency and phase offset
rxSigCFO = pfo(rxSigTimingOff);
%
% Pass the signal through an AWGN channel
rxSig = chAWGN(rxSigCFO);
%
% Save the transmitted signal for plotting
plot_rx = rxSig;
%
%------------------------------------------------------------------------
% Timing recovery
%------------------------------------------------------------------------
if recoverTimingPhase
% Recover symbol timing phase using fourth-order nonlinearity
% method
[rxSym,timEst] = timeSync(rxSig);
% Calculate the timing delay estimate for each sample
timEst = timEst(1)/samplesPerSymbol;
else
% Do not apply timing recovery and simply downsample the received
% signal rxSym =
downsample(rxSig,samplesPerSymbol);
timEst = 0;
end

% Save the timing synchronized received signal for plotting


plot_rxTimeSync = rxSym;

%------------------------------------------------------------------------
% Carrier frequency and phase recovery
%------------------------------------------------------------------------ if
recoverCarrier
% The following script applies carrier frequency and phase recovery
% using a second order phase-locked loop (PLL), and removes phase ambiguity
[rxSym,phEst] = phaseSync(rxSym);
removePhaseAmbiguityMSKSignalRecoveryEx; freqShiftEst
= mean(diff(phEst)/(Ts*2*pi));
phEst = mod(mean(phEst),360); % in degrees
else
freqShiftEst = 0;
phEst = 0;
end

% Save the phase synchronized received signal for plotting


plot_rxPhSync = rxSym;
%------------------------------------------------------------------------
% Demodulate the received symbols
%------------------------------------------------------------------------
rxBits = demod(rxSym);
%------------------------------------------------------------------------
% Calculate the bit error rate
%------------------------------------------------------------------------
errorStats = BERCalc(txBits,rxBits);
%------------------------------------------------------------------------
% Plot results
%-----------------------------------------------------------------------
plotResultsMSKSignalRecoveryEx; end
%%
% Display the bit error rate and the total number of symbols processed by
% the error rate calculator.
%%
BitErrorRate = errorStats(1)
TotalNumberOfSymbols = errorStats(3)
%% Conclusion and Further Experimentation
% The recovery algorithms are demonstrated by using constellation plots %
taken after timing, carrier frequency, and carrier phase synchronization.
%
% Open the script to create a writable copy of this example and its
% supporting files. Then, to show the effects of the recovery algorithms,
% you can enable and disable the logical control variables |recoverTimingPhase| and % |
recoverCarrier| and rerun the simulation.

OUTPUT:

COMMAND WINDOW
>> MSKSignalRecoveryExample

BitErrorRate =
2.0001e-06

TotalNumberOfSymbols =
499982

FIGURE WINDOW
EXPERIMENT NO. 9
AIM:
MATLAB Code to perform DQPSK Signal in AWGN

MATLAB CODE:

dqpskmod = comm.DQPSKModulator('BitInput',true);
dqpskdemod = comm.DQPSKDemodulator('BitOutput',true);
channel = comm.AWGNChannel('EbNo',6,'BitsPerSymbol',2);
errorRate = comm.ErrorRate('ComputationDelay',1); for
counter = 1:100 txData = randi([0 1],100,1); modSig
= dqpskmod(txData); rxSig = channel(modSig); rxData
= dqpskdemod(rxSig); errorStats =
errorRate(txData,rxData); end ber = errorStats(1)
numErrors = errorStats(2) numBits = errorStats(3)

OUTPUT:
COMMAND WINDOW
>> DQPSK

ber =
0.0174

numErrors =
174

numBits =
9999

EXPERIMENT 10
AIM:
MATLAB Code to perform OQPSK Signal in AWGN

MATLAB CODE:
oqpskmod = comm.OQPSKModulator('BitInput',true);
oqpskdemod = comm.OQPSKDemodulator('BitOutput',true);
channel = comm.AWGNChannel('EbNo',4,'BitsPerSymbol',2);
errorRate = comm.ErrorRate('ReceiveDelay',2); for
counter = 1:300 txData = randi([0 1],100,1); modSig
= oqpskmod(txData); rxSig = channel(modSig); rxData
= oqpskdemod(rxSig); errorStats =
errorRate(txData,rxData); end ber = errorStats(1)
numErrors = errorStats(2) numBits = errorStats(3)

OUTPUT:
COMMAND WINDOW
>> OQPSK

ber =
0

numErrors =
0

numBits =
29998

You might also like