bit error rate calculation of qpsk signal in awgn channel ,getting ber of agc is more than ber of noise (Implementing QPSK Transmitter and Receiver in Simulink in matlab)
12 views (last 30 days)
Show older comments
clc;
clear all;
close all;
data=randi([0 1],1,10000);
data_NZR=2*data-1; % Data Represented at NZR form for QPSK modulation
s_p_data=reshape(data_NZR,2,length(data)/2);
br=10.^6; %Let us transmission bit rate 1000000
f=br; % minimum carrier frequency
T=1/br; % bit duration
t=T/99:T/99:T; % Time vector for one bit information
% XXXXXXXXXXXXXXXXXXXXXXX QPSK modulation XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
y=[];
y_in=[];
y_qd=[];
for(i=1:length(data)/2)
y1=s_p_data(1,i)*cos(2*pi*f*t); % inphase component
y2=s_p_data(2,i)*sin(2*pi*f*t) ;% Quadrature component
y_in=[y_in y1]; % inphase signal vector
y_qd=[y_qd y2]; %quadrature signal vector
y=[y y1+y2]; % modulated signal vector
end
Tx_sig=y;
rolloff = 0.5; % Filter rolloff
span = 10; % Filter span
sps = 2; % Samples per symbol
rrcFilter = rcosdesign(rolloff,span,sps);
txSig = upfirdn(Tx_sig,rrcFilter,sps);
%%%%%%%%%%%%%%Adding AWGN Noise to the modulated signal%%%%%%%%%%%%%
SNR_db=-10;
noise_sig=awgn(txSig,SNR_db);
data1=demodulation(noise_sig,data);
agc = comm.AGC('MaxPowerGain',30);
agc_op = agc(noise_sig.');
data2=demodulation(agc_op,data);
rxFilt = upfirdn(agc_op,rrcFilter,1,sps);
rxFilt = rxFilt(span+1:end-span);
data3=demodulation(rxFilt,data);
beragc=biterr(data,data2);
bernoise=biterr(data,data1);
berrrc=biterr(data,data3);
function [y] = demodulation(fdata, data)
br = 10^6; % Transmission bit rate = 1000000
f = br; % Minimum carrier frequency
T = 1 / br; % Bit duration
t = T / 99 : T / 99 : T; % Time vector for one bit information
y = [];
Rx_sig = fdata; % Received signal
for i = 1 : 1 : length(data) / 2
% In-phase coherent detector
Z_in = Rx_sig((i - 1) * length(t) + 1 : i * length(t)) .* cos(2 * pi * f * t);
Z_in_intg = trapz(t, Z_in) * (2 / T); % Integration using the trapezoidal rule
if (Z_in_intg > 0) % Decision Maker
Rx_in_data = 1;
else
Rx_in_data = 0;
end
% Quadrature coherent detector
Z_qd = Rx_sig((i - 1) * length(t) + 1 : i * length(t)) .* sin(2 * pi * f * t);
Z_qd_intg = trapz(t, Z_qd) * (2 / T); % Integration using the trapezoidal rule
if (Z_qd_intg > 0) % Decision Maker
Rx_qd_data = 1;
else
Rx_qd_data = 0;
end
y = [y, Rx_in_data, Rx_qd_data]; % Received Data vector
end
end
0 Comments
Answers (1)
Binaya
on 27 Nov 2023
Hi Pavan,
Based on my understanding, you would like to know why the ber (bit error rate) value of agc is more than that of ber of noise while implementing the QPSK transmitter-reciever pair in MATLAB.
While executing the provided code, it can be observed that “beragc”, “bernoise” and “berrrc” have values around 0.5. This is a clear indicator that the decoding of the transmitted signal is not done correctly.
You can verify the decoding algorithm used in the provided code to resolve the underlying error.
I hope this helps.
Regards ,
Binaya
0 Comments
See Also
Categories
Find more on QPSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!