Você está na página 1de 34

RSRP and RSRQ

Measurement in LTE
In cellular networks, when a mobile moves from cell to cell and performs cell
selection/reselection and handover, it has to measure the signal
strength/quality of the neighbor cells. In LTE network, a UE measures two
parameters on reference signal: RSRP (Reference Signal Received Power) and
RSRQ (Reference Signal Received Quality).
In LTE network, a UE measures:

RSSI Received Signal Strength Indicator: The carrier RSSI (Receive


Strength Signal Indicator) measures the average total received power
observed only in OFDM symbols containing reference symbols for antenna
port 0 (i.e., OFDM symbol 0 & 4 in a slot) in the measurement bandwidth
over N resource blocks.
The total received power of the carrier RSSI includes the power from cochannel serving & non-serving cells, adjacent channel interference, thermal
noise, etc. Total measured over 12-subcarriers including RS from Serving
Cell, Traffic in the Serving Cell

RSRP Reference Signal Received Power: RSRP is a RSSI type of


measurement; as follows there are some definition of it and some details as
well.
It is the power of the LTE Reference Signals spread over the full bandwidth
(RSSI) and narrow-band (RSRP).
A minimum of -20 dB SINR (of the S-Synch channel) is needed to detect
RSRP/RSRQ

RSRQ Reference Signal Received Quality: Quality considering also


RSSI and the number of used Resource Blocks (N) RSRQ = (N * RSRP) / RSSI
measured over the same bandwidth. RSRQ is a C/I type of measurement
and it indicates the quality of the received reference signal.
The RSRQ measurement provides additional information when RSRP is not
sufficient to make a reliable handover or cell re-selection decision.
In the procedure of handover, the LTE specification provides the flexibility of
using RSRP, RSRQ, or both.
Of course, it must to be measured over the same bandwidth:

Narrow-band N = 62 Sub Carriers (6 Resource Blocks)

Wide-band N = full bandwidth (up to 100 Resource Blocks / 20 MHz)

RSRP 3GPP Definition


Reference Signal Received Power (RSRP), is defined as the linear
average over the power contributions (in [W]) of the resource
elements (REs) that carry cell-specific reference signals within the considered
measurement frequency bandwidth. For RSRP determination the cell-specific
reference signals R0 according TS 36.211 [3] shall be used. If the UE can
reliably detect that R1 is available it may use R1 in addition to R0 to
determine RSRP.
The reference point for the RSRP shall be the antenna connector of the UE.
If receiver diversity is in use by the UE, the reported value shall not be lower
than the corresponding RSRP of any of the individual diversity branches.
RSRP measurement, normally expressed in dBm, is utilized mainly to make
ranking among different candidate cells in accordance with their signal
strength. Generally, the reference signals on the first antenna port are used
to determine RSRP, however, the reference signals sent on the second port
can also be used in addition to the RSs on the first port if UE can detect that
they are being transmitted.

Applicable for: RRC_IDLE intra-frequency, RRC_IDLE interfrequency, RRC_CONNECTED intra-frequency, RRC_CONNECTED interfrequency
o

Note 1: The number of resource elements within the considered


measurement frequency bandwidth and within the measurement
period that are used by the UE to determine RSRP is left up to the UE
implementation with the limitation that corresponding measurement
accuracy requirements have to be fulfilled.

Note 2: The power per resource element is determined from the


energy received during the useful part of the symbol, excluding the
CP.

In other words RSRP (Reference Signal Receive Power) is the average


power of Resource Elements (RE) that carry cell specific Reference
Signals (RS) over the entire bandwidth, so RSRP is only measured in
the symbols carrying RS.

RSRP is the average received power of a single RS resource element

RSRP
UE measures the power of multiple resource elements used to transfer
the reference signal but then takes an average of them rather than
summing them.
The reporting range of RSRP is defined from -140 dBm to 44 dBm
with 1 dB resolution. The mapping of measured quantity is defined in the
table RSRP mapping 3GPP TS 36.133 V8.9.0 (2010-03)
RSRP does a better job of measuring signal power from a specific sector
while potentially excluding noise and interference from other sectors
RSRP levels for usable signal typically range from about -75 dBm close in
to an LTE cell site to -120 dBm at the edge of LTE coverage.

Reference Signals recap: OFDMA


Channel Estimation
In simple terms the Reference Signal (RS) is mapped to Resource Elements
(RE). This mapping follows a specific pattern (see to below).

So at any point in time the UE will measure all the REs that carry the
RS and average the measurements to obtain an RSRP reading.

Channel estimation in LTE is based on reference signals (like CPICH


functionality in WCDMA)

Reference signals position in time domain is fixed (0 and 4 for Type 1


Frame) whereas in frequency domain it depends on the Cell ID

In case more than one antenna is used (e.g. MIMO) the Resource
elements allocated to reference signals on one antenna are DTX on the
other antennas

Reference signals are modulated to identify the cell to which they


belong

RSSI (Received Signal Strength Indicator) is a parameter which provides


information about total received wide-band power (measure in all symbols)
including all interference and thermal noise. RSSI is not reported to e-NodeB
by UE. It can simply be computed from RSRQ and RSRP that are, instead,
reported by UE.

RSSI = wideband power = noise +


serving cell power + interference
power
So, without noise and interference, we have that 100% DL PRB
activity: RSSI=12*N*RSRP
Where:

RSRP is the received power of 1 RE (3GPP definition) average of


power levels received across all Reference Signal symbols within the
considered measurement frequency bandwidth

RSSI is measured over the entire bandwidth

N, number of RBs across the RSSI, is measured and depends on


the BW
Based on the above, under full load and high SNR:

RSRP (dBm) = RSSI (dBm) 10*log


(12*N)

RSRQ 3GPP Definition


Reference Signal Received Quality (RSRQ) is defined as the ratio
NRSRP/(E-UTRA carrier RSSI), where N is the number of RBs of the EUTRA carrier RSSI measurement bandwidth. The measurements in the
numerator and denominator shall be made over the same set of
resource blocks.

In formula:

Where:

N is the number of Physical Resource Blocks (PRBs) over which the

RSSI is measured, typically equal to system bandwidth


RSSI is pure wide band power measurement, including intra-cell power,
interference and noise (noise + serving cell power + interference power
during RS symbol)
The reporting range of RSRQ is defined from -3-19.5dB

So we have that RSRQ depends on serving cell power and the


number of Tx antennas
E-UTRA RSSI (Carrier Received Signal Strength Indicator), comprises
the linear average of the total received power (in [W]) observed only in
OFDM symbols containing reference symbols for antenna port, in the
measurement bandwidth, over N number of resource blocks by the UE from
all sources, including co-channel serving and non-serving cells, adjacent
channel interference, thermal noise etc.
The reference point for the RSRQ shall be the antenna connector of the UE. If
receiver diversity is in use by the UE, the reported value shall not be lower
than the corresponding RSRQ of any of the individual diversity branches.

Applicable for: RRC_CONNECTED intra-frequency, RRC_CONNECTED


inter-frequency

e.g. Impact of serving cell


power to RSRQ:
Example for noise limited case (no interference): If all resource elements are
active and are transmitted with equal power, then

RSRQ = N / 12N = -10.8 dB for 1Tx

RSRQ = N / 20N = -13 dB for 2Tx taking DTX into account


(Because RSRP is measured over 1 resource element and RSSI per resource
block is measured over 12 resource elements).
Remember that RSSI is only measured at those symbol times during
which RS REs are transmitted We do not have to take into the count
DTx!!!

So, when there is no traffic, and assuming only the reference symbols are
transmitted (there are 2 of them within the same symbol of a resource block)
from a single Tx antenna then the RSSI is generated by only the 2 reference
symbols so the result becomes

RSRQ = N / 2N = -3 dB for 1Tx

RSRQ = -6dB for 2Tx

SINR Definition
SINR is the reference value used in the system simulation and can be
defined:
1.
Wide band SINR
2.
SINR for a specific sub-carriers (or for a specific resource elements)

All measured over the same bandwidth!

SNR vs. RSRP


RSRP is measured for a single subcarrier, noise power for

15 KHz=125.2dBm
1.
Noise figure = 7 dB
2.
Temperature = 290 K
Assumption: RSRP doesnt contain noise power

Update May 2016

Power Calculation Example


Lets try to calculate RSRP, RSSI and RSRQ for one very simple case of one
resource block with 12 sub carriers and 0.5 ms in time domain. Lets assume
the power of reference symbols (shown by red square) and power of other
symbols carrying other data channels (shown by blue square) is same i.e.
0.021 watt
Since RSRP is linear average of downlink reference signal for given channel
bandwidth therefore,
RSRP = 10*log (0.021*1000) = 13.2 dBm
While RSSI is total received wide-band power. Therefore we have to add
power of all 12 carriers in the given resource block
RSSI = 10*log (0.021*1000) +10*log (12) = 24 dBm

RSRQ is now simple ratio of RSRP to RSSI with N=1


RSRQ = 10*log (0.021/ (12*0.021)) = -10.79 dB

dBm vs dB
dB is ratio between two power values while dBm is used to express an absolute
value of power. So when we mention RSRP and RSSI we shall always use dBm
since we are talking about absolute power values but we need to use dB with
RSRQ since it is the ratio of RSRP to RSSI

Digital communication,
Digital Communication:
how to simulate code matlab for BPSK, QPSK and 8 QAM, then apply it to Rectangular pulse
shaping (RPS) then simulate code matlab for Square Root Raised Cosine (SQRC) filter as
pulse shaping filter and matched filter, and apply it to the system, and we found minimum
number of coefficient that the loss did not exceed 0.5 dB, then we evaluate the coded
performance of BPSK and QPSK and 8-QAM with SQRC pulse shaping

Code MATLAB, Simulated, QPSK, BPSK, 8 QAM, coded, un-coded, SQRC,

Simulated
BPSK MATLAB code
clc;
clear all;
bits=1000000;
data=randint(1,bits)>0.5;
ebno=0:10;
BER=zeros(1,length(ebno));
for i=1:length(ebno)
%---Transmitter--------%mapping of bits into symbols
symb=2.*data-1;
%----Filter
psf=ones(1,1);
M=length(psf);
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits);

%Passing the symbols from PSF


tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebnos=10.^(ebno(i)/10);
n_var=1/sqrt(2.*ebnos);
rx_symb=tx_symb+n_var*randn(1,length(tx_symb));
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(M:M:length(rx_match));
rx=rx(1:1:bits);
recv_bits=(sign(rx)+1)./2;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx

end
fs=1;
n_pt=2^9;

tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with Rectangular Pulse Shaping for BPSK');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure
semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for BPSK')
legend('simulation','theory')
grid on

QPSK MATLAB code


clc
clear all
bits=1000000;
data=randint(1,bits)>0.5;
%---debugging--%data=[1 1 1]
%xxxxxxxxxx
ebno=0:10;

BER=zeros(1,length(ebno));
%---Transmitter--------%Gray mapping of bits into symbols
col=length(data)/2;
I=zeros(1,col);
Q=I;
I=data(1:2:bits-1);
Q=data(2:2:bits);
I= -2.*I+1;
Q= -2.*Q+1;
symb=I+j.*Q;
%----Filter
psf=ones(1,1);
%---M=length(psf);
for i=1:length(ebno)
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/2);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/2);
%Passing the symbols from PSF
%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
npsd=10.^(ebno(i)/10);
n_var=1/sqrt(2.*npsd);
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(M:M:length(rx_match));
rx=rx(1:1:bits/2);
recv_bits=zeros(1,bits);
%demapping
k=1;
for ii=1:bits/2
recv_bits(k)= -( sign( real(
recv_bits(k+1)=-( sign( imag(
k=k+2;
end
%sign(
%sign(

real( rx )
imag( rx )

)
)

rx(ii)
rx(ii)

)
)

)
)

-1)/2;
-1)/2;

%data
%tx_symb
%rx_symb
%recv_bits
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
end
fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with Rectangular Pulse Shaping for QPSK');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure
semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for QPSK')
legend('Simulation','Theory')
grid on

8 QAM MATLAB CODE


clc
clear all
bits=3000000;
data=randint(1,bits)>0.5;
%---debugging--%data=[1 1 1]
%xxxxxxxxxx
ebno=0:10;
BER=zeros(1,length(ebno));
thr=BER;
%---Transmitter--------%Gray mapping of bits into symbols
col=length(data)/3;
I=zeros(1,col);
Q=I;

k=1;
for i=1:3:length(data)
if(data(i:i+2)==[0 0 0])
I(k)=1;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 0 1])
I(k)=3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 1 0])
I(k)=-1;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 1 1])
I(k)=-3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[1 0 0])
I(k)=1;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 0 1])
I(k)=3;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 1 0])
I(k)=-1;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 1 1])

end
end
symb=I+j*Q;
%real(symb)
%imag(symb)

I(k)=-3;
Q(k)=-1;
k=k+1;

%----Filter
psf=ones(1,1);
Es=sum(psf.^2);
eb=Es/3;
eb=2;
%---M=length(psf);
for i=1:length(ebno)
% inserting zeros between the bits

% w.r.t number of coefficients of


% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/3);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/3);
%Passing the symbols from PSF
%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10.^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(M:M:length(rx_match));
rx=rx(1:1:bits/3);
recv_bits=zeros(1,bits);
%demapping
k=1;
for n=1:bits/3
I=real(rx(n));
Q=imag(rx(n));
if (I > 0) && (I < 2) && (Q > 0)
recv_bits(k:k+2)=[0 0 0];
elseif (I > 0) && (I < 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 0];
elseif (I > 2) && (Q >0)
recv_bits(k:k+2)=[0 0 1];
elseif (I > 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 1];
elseif (I < 0) && (I > -2) && (Q > 0)
recv_bits(k:k+2)=[0 1 0];
elseif (I < 0) && (I > -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 0];
elseif (I < -2) && (Q > 0)
recv_bits(k:k+2)=[0 1 1];
elseif (I < -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 1];
end
k=k+3;
end
tx_symb;
rx_symb;
data;
recv_bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE----

errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
ebno_lin=(10^(ebno(i)/10))
thr(i)=(5/12)*erfc(sqrt(ebno_lin/2));
end

%xxxxxxxxxxxxxxxxxxxxxxxxxxx

fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with Rectangular Pulse Shaping for 8QAM');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure
semilogy(ebno,BER,'b.-');
hold on
%ebno2=(10.^(ebno/10));
%thr=(5/12).*erfc(sqrt((10.^(ebno/10))./2));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for 8-QAM')
legend('Simulation','Theory')
grid on

BPSK With SQRC MATLAB code :


clc;
clear all;
bits=1000000;
data=randint(1,bits)>0.5;
ebno=0:11;
BER=zeros(1,length(ebno));

%---Transmitter--------%mapping of bits into symbols


symb=2.*data-1;
%----Filter
interval=3;
T=4;
num_coff=2*interval*T+1
%num_coff=10;

hn=zeros(1,num_coff);
beta=0.2;
PI=22/7;
k=1;
for n=-interval : 1/T : interval
if(n==0)
hn(k)=1-beta+4*beta/PI;
elseif( n==1/(4*beta) || n==-1/(4*beta) )
hn(k)=beta*cos( 0.25*PI*(1-1/beta) ) - (2*beta/PI)*
cos( 0.25*PI*(1+1/beta) );
else
hn(k)=( sin(PI*n*(1-beta)) +
4*beta*n*cos(PI*n*(1+beta)) )/(PI*n*(1-16*beta^2*n^2));
end
k=k+1;
end
n=-interval : 1/T : interval ;
%hn=ones(1,1)
psf=hn(1:1:length(n));
psf=psf/sqrt(sum(psf.^2));
%psf=ones(1,1);
figure
stem(n,psf)
%xxxxxxxx
%Energy of bit
Es=sum(psf.^2);
eb=Es;
%xxxxxxxxxxxxxxxxxxx
%M=length(psf);
M=4;
for i=1:length(ebno)
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits);
%Passing the symbols from PSF
tx_symb=conv(upsamp2,psf);
%tx_symb=tx_symb(1:length(upsamp2));
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));

rx_symb=tx_symb+(n_var*randn(1,length(tx_symb)));
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(num_coff:T:length(rx_match)-num_coff);
rx=rx(1:1:bits);
recv_bits=(sign(rx)+1)./2;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
end
fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with SQRC Pulse Shaping for BPSK');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure

data;
upsamp2;
recv_bits;
%stem(tx_symb)
figure
semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate of BPSK With SQRC')
legend('Simulation','Theory')
grid on

QPSK With SQRC MATLAB code:


clc
clear all
bits=1000000;
data=randint(1,bits)>0.5;
%---debugging--%data=[1 1 1]
%xxxxxxxxxx

ebno=0:11;
BER=zeros(1,length(ebno));
%---Transmitter--------%Gray mapping of bits into symbols
col=length(data)/2;
I=zeros(1,col);
Q=I;
I=data(1:2:bits-1);
Q=data(2:2:bits);
I= -2.*I+1;
Q= -2.*Q+1;
symb=I+j.*Q;
%----Filter
interval=3;
T=4;
num_coff=2*interval*T+1
%num_coff=1;
hn=zeros(1,num_coff);
beta=0.2;
PI=22/7;
k=1;
for n=-interval : 1/T : interval
if(n==0)
hn(k)=1-beta+4*beta/PI;
elseif( n==1/(4*beta) || n==-1/(4*beta) )
hn(k)=beta*cos( 0.25*PI*(1-1/beta) ) - (2*beta/PI)*
cos( 0.25*PI*(1+1/beta) );
else
hn(k)=( sin(PI*n*(1-beta)) +
4*beta*n*cos(PI*n*(1+beta)) )/(PI*n*(1-16*beta^2*n^2));
end
k=k+1;
end
n=-interval : 1/T : interval ;
%hn=ones(1,1)
psf=hn(1:1:length(n));
psf=psf/sqrt(sum(psf.^2));
%psf=ones(1,1);
%

figure
stem(n,psf)
%xxxxxxxx
%Energy of bit
Es=sum(psf.^2);
eb=Es;

%---M=4;
for i=1:length(ebno)

% inserting zeros between the bits


% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/2);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/2);
%Passing the symbols from PSF
%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(num_coff:T:length(rx_match)-num_coff);
%rx=rx(1:1:bits/2);
recv_bits=zeros(1,bits);
%demapping
k=1;
for ii=1:bits/2
recv_bits(k)= -( sign( real( rx(ii) ) ) -1)/2;
recv_bits(k+1)=-( sign( imag( rx(ii) ) ) -1)/2;
k=k+2;
end
%sign(
real( rx )
%sign( imag( rx )
%data
%tx_symb
%rx_symb

)
)

%recv_bits
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx

end

fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure

plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with SQRC Pulse Shaping for QPSK');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure

semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for QPSK with SQRC')
legend('simulation','theory')
grid on

8 QAM with SQRC MATLAB code


clc
clear all
bits=3000000;
data=randint(1,bits)>0.5;
%---debugging--%data=[1 1 1]
%xxxxxxxxxx
ebno=0:.5:14.5;
BER=zeros(1,length(ebno));
thr=BER;

%---Transmitter--------%Gray mapping of bits into symbols


col=length(data)/3;
I=zeros(1,col);
Q=I;
k=1;
for i=1:3:length(data)
if(data(i:i+2)==[0 0 0])
I(k)=1;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 0 1])
I(k)=3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 1 0])
I(k)=-1;
Q(k)=1;
k=k+1;

elseif(data(i:i+2)==[0 1 1])
I(k)=-3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[1 0 0])
I(k)=1;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 0 1])
I(k)=3;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 1 0])
I(k)=-1;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 1 1])

end
end
symb=I+j*Q;
%real(symb)
%imag(symb)

I(k)=-3;
Q(k)=-1;
k=k+1;

%----Filter
interval=3;
T=4;
num_coff=2*interval*T+1
%num_coff=1;
hn=zeros(1,num_coff);
beta=0.2;
PI=22/7;
k=1;
for n=-interval : 1/T : interval
if(n==0)
hn(k)=1-beta+4*beta/PI;
elseif( n==1/(4*beta) || n==-1/(4*beta) )
hn(k)=beta*cos( 0.25*PI*(1-1/beta) ) - (2*beta/PI)*
cos( 0.25*PI*(1+1/beta) );
else
hn(k)=( sin(PI*n*(1-beta)) +
4*beta*n*cos(PI*n*(1+beta)) )/(PI*n*(1-16*beta^2*n^2));
end
k=k+1;
end
n=-interval : 1/T : interval ;
%hn=ones(1,1)
psf=hn(1:1:length(n));

%psf=ones(1,1);
psf=psf./sqrt((sum(psf.^2)));
Es=sum(psf.^2);
eb=Es;
%we need to remove this
eb=2;
%xxxxxxxxxxxxxxx
%---M=4;
for i=1:length(ebno)
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/3);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/3);
%Passing the symbols from PSF
%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10.^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(num_coff:T:length(rx_match)-num_coff);
%rx=rx(1:1:bits/3);
recv_bits=zeros(1,bits);
%demapping
k=1;
for n=1:bits/3
I=real(rx(n));
Q=imag(rx(n));
if (I > 0) && (I < 2) && (Q > 0)
recv_bits(k:k+2)=[0 0 0];
elseif (I > 0) && (I < 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 0];
elseif (I > 2) && (Q >0)
recv_bits(k:k+2)=[0 0 1];
elseif (I > 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 1];
elseif (I < 0) && (I > -2) && (Q > 0)
recv_bits(k:k+2)=[0 1 0];
elseif (I < 0) && (I > -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 0];
elseif (I < -2) && (Q > 0)

end

recv_bits(k:k+2)=[0 1 1];
elseif (I < -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 1];
end
k=k+3;

tx_symb;
rx_symb;
data;
recv_bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data));
errors=size(errors,2);
BER(i)=errors/bits;
ebno_lin=(10^(ebno(i)/10))
thr(i)=(5/12)*erfc(sqrt(ebno_lin/2));
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
end
fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal with SQRC Pulse Shaping for 8QAM');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure

semilogy(ebno,BER,'b.-');
hold on
%ebno2=(10.^(ebno/10));
%thr=(5/12).*erfc(sqrt((10.^(ebno/10))./2));
semilogy(ebno,thr,'rx-');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for 8-QAM with SQRC')
legend('simulation','theory')
grid on

BPSK

Coded matlab code

clc;
clear all;
bits=4000000;
gen_data=randint(1,bits)>0.5;
uncoded_data = gen_data;

bits=bits*7/4;
%coding
n=7;
k=4;
P=[0 1 1;1 0 1;1 1 0;1 1 1];
G=[P eye(4)];
H=[eye(n-k) P.'];
Ht=H.';
e=[zeros(1,7);diag(ones(1,7))];
synd_table=[ mod(e*Ht,2) e];
U=zeros(1,length(gen_data)*7/4);
kk=1;
for ii=1:4:length(gen_data)
U(kk:kk+6)=mod(gen_data(ii:ii+3)*G,2);
kk=kk+7;
end
%xxxxxxxx
%coded data
data=U;
%xxxxx
ebno=0:10;
BER=zeros(1,length(ebno));
for i=1:length(ebno)
%---Transmitter--------%mapping of bits into symbols
symb=2.*data-1;
%----Filter
psf=ones(1,1);
M=length(psf);
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits);
%Passing the symbols from PSF
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
eb=1.6;
ebno2=10.^(ebno(i)/10);
%no=eb/ebno2;

%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+ n_var*randn(1,length(tx_symb))
%xxxxxxxxxxxxxxxxxxxxxxxxxx

%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(M:M:length(rx_match));
rx=rx(1:1:bits);
recv_bits=(sign(rx)+1)./2;
recvd_coded_bits=recv_bits;
%decoding
corrected_coded_bits=zeros(1,length(recvd_coded_bits));
uncoded_bits=zeros(1,length(gen_data));
length(gen_data)
c=1;
for kkk=1:7:length(recvd_coded_bits)
S=mod(recvd_coded_bits(kkk:kkk+6)*Ht,2);
for iii=1:8
if S==[synd_table(iii,1) synd_table(iii,2) synd_table(iii,3)]
ed=[synd_table(iii,4) synd_table(iii,5) synd_table(iii,6) ...
synd_table(iii,7) synd_table(iii,8) synd_table(iii,9) ...
synd_table(iii,10) ];

end
end
corrected_coded_bits(kkk:kkk+6)=xor(recvd_coded_bits(kkk:kkk+6),ed);
uncoded_bits(c:c+3)=corrected_coded_bits(kkk+3:kkk+6);
c=c+4;
end
corrected_coded_bits;
uncoded_bits;
length(uncoded_bits);
length(gen_data);
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
%---SIMULATED BIT ERROR RATE---errors=find(xor(uncoded_bits,gen_data));
errors=size(errors,2);
BER(i)=errors/length(gen_data);

Pc(i)=0.5*erfc(sqrt((4/7)*10.^(ebno(i)/10)));
PC2(i)=0;
for ii=2:7
PC2(i)=PC2(i)+ii*nchoosek(7,ii)*Pc(i)^ii*(1-Pc(i))^(7-ii);
end
Pb_th(i)=PC2(i)/7;

end

%xxxxxxxxxxxxxxxxxxxxxxxxxxx

fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal for Coded BPSK with SQRC');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure

uncoded_data;
S;
ed;
corrected_coded_bits;
uncoded_bits;
semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
hold on
semilogy(ebno,Pb_th,'-ok');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate for Coded BPSK')
legend('Simulation','Theory Uncoded','Theory Coded')
grid on

QPSK with coded matlab code:


clc
clear all
bits=4000000;
gen_data=randint(1,bits)>0.5;
uncoded_data = gen_data;
bits=bits*7/4;
%coding
n=7;
k=4;
P=[0 1 1;1 0 1;1 1 0;1 1 1];

G=[P eye(4)];
H=[eye(n-k) P.'];
Ht=H.';
e=[zeros(1,7);diag(ones(1,7))];
synd_table=[ mod(e*Ht,2) e];
U=zeros(1,length(gen_data)*7/4);
kk=1;
for ii=1:4:length(gen_data)
U(kk:kk+6)=mod(gen_data(ii:ii+3)*G,2);
kk=kk+7;
end
%xxxxxxxx
%coded data
data=U;
%xxxxx
%---debugging--%data=[1 1 1]
%xxxxxxxxxx
ebno=0:10;
BER=zeros(1,length(ebno));
%---Transmitter--------%Gray mapping of bits into symbols
col=length(data)/2;
I=zeros(1,col);
Q=I;
I=data(1:2:bits-1);
Q=data(2:2:bits);
I= -2.*I+1;
Q= -2.*Q+1;
symb=I+j.*Q;
%----Filter
interval=3;
T=4;
num_coff=2*interval*T+1
%num_coff=1;
hn=zeros(1,num_coff);
beta=0.2;
PI=22/7;
k=1;
for n=-interval : 1/T : interval
if(n==0)
hn(k)=1-beta+4*beta/PI;
elseif( n==1/(4*beta) || n==-1/(4*beta) )
hn(k)=beta*cos( 0.25*PI*(1-1/beta) ) - (2*beta/PI)*
cos( 0.25*PI*(1+1/beta) );
else

hn(k)=( sin(PI*n*(1-beta)) +
4*beta*n*cos(PI*n*(1+beta)) )/(PI*n*(1-16*beta^2*n^2));
end
k=k+1;
end
n=-interval : 1/T : interval ;
%hn=ones(1,1)
psf=hn(1:1:length(n));
psf=psf/sqrt(sum(psf.^2));
%psf=ones(1,1);
%

figure
stem(n,psf)
%xxxxxxxx
%Energy of bit
Es=sum(psf.^2);
eb=Es;
eb=1.55

%---M=4;
for i=1:length(ebno)
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/2);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/2);
%Passing the symbols from PSF
%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(num_coff:T:length(rx_match)-num_coff);
%rx=rx(1:1:bits/2);
recv_bits=zeros(1,bits);
%demapping
k=1;
for ii=1:bits/2
recv_bits(k)= -( sign( real( rx(ii) ) ) -1)/2;

recv_bits(k+1)=-( sign(
k=k+2;

imag(

rx(ii)

-1)/2;

end
recvd_coded_bits=recv_bits;
%decoding
corrected_coded_bits=zeros(1,length(recvd_coded_bits));
uncoded_bits=zeros(1,length(gen_data));
length(gen_data)
c=1;
for kkk=1:7:length(recvd_coded_bits)
S=mod(recvd_coded_bits(kkk:kkk+6)*Ht,2);
for iii=1:8
if S==[synd_table(iii,1) synd_table(iii,2) synd_table(iii,3)]
ed=[synd_table(iii,4) synd_table(iii,5) synd_table(iii,6) ...
synd_table(iii,7) synd_table(iii,8) synd_table(iii,9) ...
synd_table(iii,10) ];
end
end
corrected_coded_bits(kkk:kkk+6)=xor(recvd_coded_bits(kkk:kkk+6),ed);
uncoded_bits(c:c+3)=corrected_coded_bits(kkk+3:kkk+6);
c=c+4;
end
corrected_coded_bits;
uncoded_bits;
length(uncoded_bits);
length(gen_data);

%---SIMULATED BIT ERROR RATE---errors=find(xor(uncoded_bits,gen_data));


errors=size(errors,2);
BER(i)=errors/length(gen_data);
Pc(i)=0.5*erfc(sqrt((4/7)*10.^(ebno(i)/10)));
PC2(i)=0;
for ii=2:7
PC2(i)=PC2(i)+ii*nchoosek(7,ii)*Pc(i)^ii*(1-Pc(i))^(7-ii);
end
Pb_th(i)=PC2(i)/7;

%xxxxxxxxxxxxxxxxxxxxxxxxxxx
end

fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal for Coded QPSK with SQRC');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure

semilogy(ebno,BER,'b.-');
hold on
thr=0.5*erfc(sqrt(10.^(ebno/10)));
semilogy(ebno,thr,'rx-');
hold on
semilogy(ebno,Pb_th,'-ok');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate (Coded QPSK)')
legend('Simulation','Theory Uncoded','Theory Coded')
grid on

8 QAM Coded matlab code:


clc
clear all
bits=3000000;
gen_data=randint(1,bits)>0.5;
uncoded_data = gen_data;
bits=bits*7/4;
%coding
n=7;
k=4;
P=[0 1 1;1 0 1;1 1 0;1 1 1];
G=[P eye(4)];
H=[eye(n-k) P.'];
Ht=H.';
e=[zeros(1,7);diag(ones(1,7))];
synd_table=[ mod(e*Ht,2) e];
U=zeros(1,length(gen_data)*7/4);
kk=1;
for ii=1:4:length(gen_data)
U(kk:kk+6)=mod(gen_data(ii:ii+3)*G,2);

end

kk=kk+7;

%xxxxxxxx
%coded data
data=U;
%xxxxx
%---debugging--%data=[1 1 1]
%xxxxxxxxxx
ebno=0:14;
BER=zeros(1,length(ebno));
thr=BER;
%---Transmitter--------%Gray mapping of bits into symbols
col=length(data)/3;
I=zeros(1,col);
Q=I;
k=1;
for i=1:3:length(data)
if(data(i:i+2)==[0 0 0])
I(k)=1;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 0 1])
I(k)=3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 1 0])
I(k)=-1;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[0 1 1])
I(k)=-3;
Q(k)=1;
k=k+1;
elseif(data(i:i+2)==[1 0 0])
I(k)=1;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 0 1])
I(k)=3;
Q(k)=-1;
k=k+1;
elseif(data(i:i+2)==[1 1 0])
I(k)=-1;
Q(k)=-1;

k=k+1;
elseif(data(i:i+2)==[1 1 1])
I(k)=-3;
Q(k)=-1;
k=k+1;
end
end
symb=I+j*Q;
%real(symb)
%imag(symb)
%----Filter
interval=3;
T=4;
num_coff=2*interval*T+1
%num_coff=1;
hn=zeros(1,num_coff);
beta=0.2;
PI=22/7;
k=1;
for n=-interval : 1/T : interval
if(n==0)
hn(k)=1-beta+4*beta/PI;
elseif( n==1/(4*beta) || n==-1/(4*beta) )
hn(k)=beta*cos( 0.25*PI*(1-1/beta) ) - (2*beta/PI)*
cos( 0.25*PI*(1+1/beta) );
else
hn(k)=( sin(PI*n*(1-beta)) +
4*beta*n*cos(PI*n*(1+beta)) )/(PI*n*(1-16*beta^2*n^2));
end
k=k+1;
end
n=-interval : 1/T : interval ;
%hn=ones(1,1)
psf=hn(1:1:length(n));
%psf=ones(1,1);
psf=psf./sqrt((sum(psf.^2)));
Es=sum(psf.^2);
eb=Es;
%we need to remove this
eb=2.9;
%xxxxxxxxxxxxxxx
%---M=4;
for i=1:length(ebno)
% inserting zeros between the bits
% w.r.t number of coefficients of
% PSF to pass the bit stream from the PSF
z=zeros(M-1,bits/3);
upsamp=[symb;z];
upsamp2=reshape(upsamp,1,(M)*bits/3);

%Passing the symbols from PSF


%tx_symb=conv(real(upsamp2),psf)+j*conv(imag(upsamp2),psf);
tx_symb=conv(upsamp2,psf);
%--------CHANNEL----------%Random noise generation and addition to the signal
ebno2=10.^(ebno(i)/10);
%no=eb/ebno2;
%n_var=sqrt(no/2);
n_var=sqrt(eb/(2*ebno2));
rx_symb=tx_symb+(n_var*randn(1,length(tx_symb))
+j*n_var*randn(1,length(tx_symb)) );
%xxxxxxxxxxxxxxxxxxxxxxxxxx
%-------RECEIVER----------rx_match=conv(rx_symb,psf);
rx=rx_match(num_coff:T:length(rx_match)-num_coff);
%rx=rx(1:1:bits/3);
recv_bits=zeros(1,bits);
%demapping
k=1;
for n=1:bits/3
I=real(rx(n));
Q=imag(rx(n));
if (I > 0) && (I < 2) && (Q > 0)
recv_bits(k:k+2)=[0 0 0];
elseif (I > 0) && (I < 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 0];
elseif (I > 2) && (Q >0)
recv_bits(k:k+2)=[0 0 1];
elseif (I > 2) && (Q < 0)
recv_bits(k:k+2)=[1 0 1];
elseif (I < 0) && (I > -2) && (Q > 0)
recv_bits(k:k+2)=[0 1 0];
elseif (I < 0) && (I > -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 0];
elseif (I < -2) && (Q > 0)
recv_bits(k:k+2)=[0 1 1];
elseif (I < -2) && (Q < 0)
recv_bits(k:k+2)=[1 1 1];
end
k=k+3;
end
tx_symb;
rx_symb;
data;
recv_bits;
%xxxxxxxxxxxxxxxxxxxxxxxxxxx
recvd_coded_bits=recv_bits;
%decoded matlab code
corrected_coded_bits=zeros(1,length(recvd_coded_bits));
uncoded_bits=zeros(1,length(gen_data));
length(gen_data)

c=1;
for kkk=1:7:length(recvd_coded_bits)
S=mod(recvd_coded_bits(kkk:kkk+6)*Ht,2);
for iii=1:8
if S==[synd_table(iii,1) synd_table(iii,2) synd_table(iii,3)]
ed=[synd_table(iii,4) synd_table(iii,5) synd_table(iii,6) ...
synd_table(iii,7) synd_table(iii,8) synd_table(iii,9) ...
synd_table(iii,10) ];

end
end
corrected_coded_bits(kkk:kkk+6)=xor(recvd_coded_bits(kkk:kkk+6),ed);
uncoded_bits(c:c+3)=corrected_coded_bits(kkk+3:kkk+6);
c=c+4;
end
corrected_coded_bits;
uncoded_bits;
length(uncoded_bits);
length(gen_data);
%---SIMULATED BIT ERROR RATE---errors=find(xor(uncoded_bits,gen_data));
errors=size(errors,2);
BER(i)=errors/length(gen_data);
ebno_lin=(10^(ebno(i)/10))
thr(i)=(5/12)*erfc(sqrt(ebno_lin/2));
Pc(i)=(5/12)*erfc(sqrt((4/14)*10.^(ebno(i)/10)));
PC2(i)=0;
for ii=2:7
PC2(i)=PC2(i)+ii*nchoosek(7,ii)*Pc(i)^ii*(1-Pc(i))^(7-ii);
end
Pb_th(i)=PC2(i)/7;

%xxxxxxxxxxxxxxxxxxxxxxxxxxx
end
fs=1;
n_pt=2^9;
tx_spec=fft(tx_symb,n_pt);
f= -fs/2:fs/n_pt:fs/2-fs/n_pt;
figure
plot(f,abs(fftshift(tx_spec)));
title('Signal Spectrum for Signal for Coded 8-QAM with SQRC');
xlabel('Frequency [Hz]');
ylabel('x(F)');
figure
semilogy(ebno,BER,'b.-');
hold on
%ebno2=(10.^(ebno/10));

%thr=(5/12).*erfc(sqrt((10.^(ebno/10))./2));
semilogy(ebno,thr,'rx-');
hold on
semilogy(ebno,Pb_th,'-ok');
xlabel('Eb/No (dB)')
ylabel('Bit Error rate')
title('Simulated Vs Theoritical Bit Error Rate of Coded 8QAM')
legend('simulation','Theory Uncoded','Theory Coded')
grid on

Você também pode gostar