0% found this document useful (0 votes)
385 views25 pages

Experiment No. 1 AIM: MATLAB Code To Perform ASK (Amplitude Shift Keying) Modulation and Demodulation

The document describes MATLAB code to perform various digital modulation and demodulation techniques including: 1. ASK, PSK, and FSK modulation and demodulation. The code generates modulated signals, demodulates them, and recovers the transmitted binary data. 2. Pulse code modulation (PCM) including sampling, quantization, encoding, and decoding of an analog signal. 3. Adaptive delta modulation and demodulation of input signals. 4. Calculation of bit error rate (BER) for digital communication systems by comparing transmitted and received bit sequences.
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)
385 views25 pages

Experiment No. 1 AIM: MATLAB Code To Perform ASK (Amplitude Shift Keying) Modulation and Demodulation

The document describes MATLAB code to perform various digital modulation and demodulation techniques including: 1. ASK, PSK, and FSK modulation and demodulation. The code generates modulated signals, demodulates them, and recovers the transmitted binary data. 2. Pulse code modulation (PCM) including sampling, quantization, encoding, and decoding of an analog signal. 3. Adaptive delta modulation and demodulation of input signals. 4. Calculation of bit error rate (BER) for digital communication systems by comparing transmitted and received bit sequences.
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/ 25

EXPERIMENT NO.

1
AIM: MATLAB Code to perform ASK (Amplitude Shift Keying) modulation and demodulation

MATLAB CODE:
clc;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Transmitter :');
disp(x);
% 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);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Transmitting information as digital signal');
%Binary-ASK modulation
A1=10; % Amplitude of carrier signal for information 1
A2=5; % Amplitude of carrier signal for information 0
br=1/bp; % bit rate
f=br*10; % carrier frequency
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A1*cos(2*pi*f*t2);
else
y=A2*cos(2*pi*f*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Waveform for Binary ASK Modulation');
% Binary ASK demodulation
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t); % carrier siignal
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>7.5) % logic level = (A1+A2)/2=7.5
a=1;
else
a=0;
end
mn=[mn a];
end
disp(' Binary information at Receiver :');
disp(mn);
% Representation of binary information as digital signal achieved after ASK
% demodulation
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(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Received information as digital signal after Binary ASK Demodulation');

OUTPUT
EXPERIMENT NO. 2

AIM: MATLAB Code to perform PSK (Phase Shift Keying) modulation and demodulation
MATLAB CODE:
clc;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Transmitter :');
disp(x);
% 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);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Transmitting information as digital signal');
% Binary-PSK modulation
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*cos(2*pi*f*t2);
else
y=A*cos(2*pi*f*t2+pi); %A*cos(2*pi*f*t+pi) means -A*cos(2*pi*f*t)
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Waveform for Binary PSK Modulation');
% Binary PSK demodulation
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t); % carrier siignal
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*cos(2*pi*f*t+pi)=-A*cos(2*pi*f*t)
a=1;
else
a=0;
end
mn=[mn a];
end
disp(' Binary information at Receiver :');
disp(mn);
% Representation of Binary information as digital signal achieved after PSK
% demodulation
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(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Received information as digital signal after Binary PSK Demodulation');

OUTPUT
EXPERIMENT NO. 3

AIM: MATLAB Code to perform FSK (Frequency Shift Keying) modulation and demodulation
MATLAB CODE:
clc;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Transmitter :');
disp(x);
% 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);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Transmitting information as digital signal');
% Binary-FSK modulation
A=5; % Amplitude of carrier signal
br=1/bp; % bit rate
f1=br*8; % 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(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Waveform for Binary FSK Modulation');
% Binary FSK demodulation
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t); % carrier siignal for information 1
y2=cos(2*pi*f2*t); % carrier siignal 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
a=1;
else(zz2>A/2)
a=0;
end
mn=[mn a];
end
disp(' Binary information at Receiver :');
disp(mn);
%Representation of binary information as digital signal achieved after
%demodulation
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(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Received information as digital signal after Binary FSK Demodulation');
EXPERIMENT NO. 4

AIM: MATLAB Code to perform Pulse Code modulation and demodulation (PCM)
MATLAB CODE:
clc;
n=input('Enter n value for n-bit PCM system : ');
n1=input('Enter number of samples in a period : ');
L=2^n;
% % Signal Generation
% x=0:1/100:4*pi;
% y=8*sin(x); % Amplitude Of signal is 8v
% subplot(2,2,1);
% plot(x,y);grid on;
% Sampling Operation
x=0:2*pi/n1:4*pi; % n1 number of samples have to be 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 Signal'); 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); % Contain Quantized values
[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 in between 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');

EXPERIMENT NO. 5

AIM: MATLAB Code to perform Adaptive Delta modulation and demodulation


MATLAB CODE:
clc;
%% Input Signals, m(t).
t = 0 : 2*pi/100 : 2*pi;
mt = sin(t); % Sine wave.
mt = sin(t) + 2; % Sine wave with non-zero DC value.
%% Step Size, S.
quantizationLevels = 16;
S = (max(mt) - min(mt)) / quantizationLevels;
%% Modulate.
totalSamples = length(mt) - 1;
mqt = zeros(1, totalSamples); % Quantized Signal, mq(t).
dk = zeros(1, totalSamples); % Output Binary Sequence, d[k].
dt = 0; % Difference, d(t) = m(t) - mq(t).
Sk = zeros(1, totalSamples); % Step Size, S[k].
for n = 2 : totalSamples
dt = mt(n) - mqt(n);
if(dt>= 0)
dk(n) = 1;
else
dk(n) = -1;
end
Sk(n) = abs(Sk(n-1))*dk(n) + S*dk(n-1);
mqt(n+1) = mqt(n) + Sk(n);
end
%% Display Modulation Result.
plot(t, mt,'r','LineWidth',2), grid on
hold on;
stairs(t, mqt,'k','LineWidth',2);
axis([t(1) t(end) (min(min(mqt), min(mt)) - 0.5) (max(max(mqt), max(mt)) + 0.5)]);
title('Adaptive Delta Modulation', 'Fontsize', 14);
xlabel('Time');
ylabel('Amplitude');
legend('Input Signal, m(t)', 'Modulated Signal, m_q(t)');

EXPERIMENT NO.6
AIM: MATLAB Code to perform Number of bit errors and bit error rate (BER)

%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
>> BitErrorRateComputationExample

x=

0 0

0 0

0 0

0 0

y=

0 0

0 0

0 0

1 1
numerrs =

numerrs =

1 1

numerrs =

numerrs =
2

EXPERIMENT NO. 7
AIM: MATLAB Code to Configure Eb/No for AWGN Channels with Coding
N = 15; % R-S codeword length in symbols
K = 9; % R-S message length in symbols
M = 16; % Modulation order
rsEncoder = comm.RSEncoder('CodewordLength',N,'MessageLength',K, ...
'BitInput',true);
pskModulator = comm.PSKModulator('ModulationOrder',M,'BitInput',true);
rsDecoder = comm.RSDecoder('CodewordLength',N,'MessageLength',K, ...
'BitInput',true);
pskDemodulator = comm.PSKDemodulator('ModulationOrder',M,'BitOutput',true);
codeRate = K/N;
bitsPerSymbol = log2(M);
UncodedEbNo = 6;
CodedEbNo = UncodedEbNo + 10*log10(codeRate);
channel = comm.AWGNChannel('BitsPerSymbol',bitsPerSymbol);
channel.EbNo = CodedEbNo

output
>> AWGN

channel =

comm.AWGNChannel with properties:

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

EbNo: 3.7815

BitsPerSymbol: 4

SignalPower: 1

SamplesPerSymbol: 1

RandomStream: 'Global stream'

EXPERIMENT NO. 8
AIM: MATLAB Code to perform MSK Signal Recovery
%% MSK Signal Recovery
% Model channel impairments such as timing phase offset, carrier frequency
% offset, and carrier phase offset for a minimum shift keying (MSK) signal.
% Use |comm.MSKTimingSynchronizer| and |comm.CarrierSynchronizer| System
% objects to synchronize such signals at the receiver. The MSK timing
% synchronizer recovers the timing offset, while a carrier synchronizer
% recovers the carrier frequency and phase offsets.
%%
% Initialize system variables by running the MATLAB script
% |configureMSKSignalRecoveryEx|. Define the logical control variable
% |recoverTimingPhase| to enable timing phase recovery, and
% |recoverCarrier| to enable carrier frequency and phase recovery.
configureMSKSignalRecoveryEx;
recoverTimingPhase = true;
recoverCarrier = true;
%% Modeling Channel Impairments
% Specify the sample delay, |timingOffset|, that the channel model applies.
% Create a variable fractional delay object to introduce the timing delay
% to the transmitted signal.
%%
timingOffset = 0.2;
varDelay = dsp.VariableFractionalDelay;
%%
% Create a |comm.PhaseFrequencyOffset| System object to introduce carrier
% phase and frequency offsets to a modulated signal. Because the MSK
% modulator upsamples the transmitted symbols, set the |SampleRate|
% property to the ratio of the |samplesPerSymbol| and the sample time,
% |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
>> MSKSignalRecoveryExample

BitErrorRate =

2.0001e-06
TotalNumberOfSymbols =

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

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
>> DQPSK

ber =

0.0174

numErrors =

174

numBits =

9999

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

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

>> OQPSK

ber =

numErrors =

numBits =

29998

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