# Shannon Capacity CDMA vs OFDMA

We have previously discussed Shannon Capacity of CDMA and OFMDA, here we will discuss it again in a bit more detail. Let us assume that we have 20 MHz bandwidth for both the systems which is divided amongst 20 users. For OFDMA we assume that each user gets 1 MHz bandwidth and there are no guard bands or pilot carriers. For CDMA we assume that each user utilizes full 20 MHz bandwidth. We can say that for OFDMA each user has a dedicated channel whereas for CDMA the channel is shared between 20 simultaneous users.

We know that Shannon Capacity is given as

C=B*log2(1+SNR)

or in the case of CDMA

C=B*log2(1+SINR)

where ‘B’ is the bandwidth and SINR is the signal to noise plus interference ratio. For OFDMA the SNR is given as

SNR=Pu/(B*No)

where ‘Pu’ is the signal power of a single user and ‘No’ is the Noise Power Spectral Density. For CDMA the calculation of SINR is a bit more complicated as we have to take into account the Multiple Access Interference. If the total number of users is ‘u’ the SINR is calculated as

SINR=Pu/(B*No+(u-1)*Pu)

The code given below plots the capacity of CDMA and OFDMA as a function of Noise Power Spectral Density ‘No’.

```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CAPACITY OF CDMA and OFDMA
% u - Number of users
% Pu - Power of a single user
% No - Noise Power Spectral Density
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all
close all

u=20;
Pu=1;
No=1e-8:1e-8:1e-6;

B=20e6;
C_CDMA=u*B*log2(1+Pu./(B*No+(u-1)*Pu));

B=1e6;
C_OFDMA=u*B*log2(1+Pu./(B*No));

plot(No,C_CDMA/1e6);hold on
plot(No,C_OFDMA/1e6,'r');hold off
xlabel('Noise Power Spectral Density (No)')
ylabel('Capacity (Mbps)')
legend('CDMA','OFDMA')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
```

We see that the capacity of OFDMA is much more sensitive to noise than CDMA. Within the low noise region the capacity of OFDMA is much better than CDMA but as the noise increases the capacity of the two schemes converges. In fact it was seen that as the noise PSD is further increased the two curves completely overlap each other. Therefore it can be concluded that OFDMA is the preferred technique when we are operating in the high SNR regime.

# Does Shannon Capacity Increase by Dividing a Frequency Band into Narrow Bins

Somebody recently asked me this question “Does Shannon Capacity Increase by Dividing a Frequency Band into Narrow Bins”. To be honest I was momentarily confused and thought that this may be the case since many of the modern Digital Communication Systems do use narrow frequency bins e.g. LTE. But on closer inspection I found that the Shannon Capacity does not change, in fact it remains exactly the same. Following is the reasoning for that.

Shannon Capacity is calculated as:

C=B*log2(1+SNR)

or

C=B*log2(1+P/(B*No))

Now if the bandwidth ‘B’ is divided into 10 equal blocks then the transmit power ‘P’ for each block would also be divided by 10 to keep the total transmit power for the entire band to be constant. This means that the factor P/(B*No) remains constant. So the total capacity for the 10 blocks would be calculated as:

C=10*(B/10)*log2(1+P/(B*No))

So the Shannon Capacity for the entire band remains the same.

PS: The reason for the narrower channels is that for a narrow channel the channel appears relatively flat in the frequency domain and the process of equilization is thus simplified (a simple multiplication/division would do).

Note: ‘No’ is the Noise Power Spectral Density and ‘B*No’ is the Noise Power.

# MIMO Capacity in a Fading Environment

The Shannon Capacity of a channel is the data rate that can be achieved over a given bandwidth (BW) and at a particular signal to noise ratio (SNR) with diminishing bit error rate (BER). This has been discussed in an earlier post for the case of SISO channel and additive white Gaussian noise (AWGN). For a MIMO fading channel the capacity with channel not known to the transmitter is given as (both sides have been normalized by the bandwidth [1]):

Shannon Capacity of a MIMO Channel

where NT is the number of transmit antennas, NR is the number of receive antennas, γ is the signal to interference plus noise ratio (SINR), INR is the NRxNR identity matrix and H is the NRxNT channel matrix. Furthermore, hij, an element of the matrix H defines the complex channel coefficient between the ith receive antenna and jth transmit antenna. It is quite obvious that the channel capacity (in bits/sec/Hz) is highly dependent on the structure of matrix H. Let us explore the effect of H on the channel capacity.

Let us first consider a 4×4 case (NT=4, NR=4) where the channel is a simple AWGN channel and there is no fading. For this case hij=1 for all values of i and j. It is found that channel capacity of this simple channel for an SINR of 10 dB is 5.36bits/sec/Hz. It is further observed that the channel capacity does not change with number of transmit antennas and increases logarithmically with increase in number of receive antennas. Thus it can be concluded that in an AWGN channel no multiplexing gain is obtained by increasing the number of transmit antennas.

We next consider a more realistic scenario where the channel coefficients hij are complex with real and imaginary parts having a Gaussian distribution with zero mean and variance 0.5. Since the channel H is random the capacity is also a random variable with a certain distribution. An important metric to quantify the capacity of such a channel is the Complimentary Cumulative Distribution Function (CCDF). This curve basically gives the probability that the MIMO capacity is above a certain threshold.

It is obvious (see figure above) that there is a very high probability that the capacity obtained for the MIMO channel is significantly higher than that obtained for an AWGN channel e.g. for an SINR of 9 dB there is 90% probability that the capacity is greater than 8 bps/Hz. Similarly for an SINR of 12 dB there is a 90% probability that the capacity is greater than 11 bps/Hz. For a stricter threshold of 99% the above capacities are reduced to 7.2 bps/Hz and 9.6 bps/Hz.

In a practical system the channel coefficients hij would have some correlation which would depend upon the antenna spacing. Lower the antenna spacing higher would be the antenna correlation and lower would be the MIMO system capacity. This would be discussed in a future post.

The MATLAB code for calculating the CCDF of channel capacity of a MIMO channel is given below.

```clear all
close all

Nr=4;
Nt=4;
I=eye(Nr);
g=15.8489;

for n=1:10000
H=sqrt(1/2)*randn(Nr,Nt)+j*sqrt(1/2)*randn(Nr,Nt);
C(n)=log2(det(I+(g/Nt)*(H*H')));
end

[a,b]=hist(real(C),100);
a=a/sum(a);
plot(b,1-cumsum(a));
xlabel('Capacity (bps/Hz)')
ylabel('Probability (Capacity > Abcissa)')
grid on```

[1] G. J. Foschini and M. J. Gans,”On limits of Wireless Communications in a Fading Environment when Using Multiple Antennas”, Wireless Personal Communications 6, pp 311-335, 1998.

# Shannon Capacity of LTE (Ideal)

Shannon Capacity of LTE in AWGN can be calculated by using the Shannon Capacity formula:

C=B*log2(1+SNR)

or

C=B*log2(1+P/(B*No))

The signal power P is set at -90dBm, the Noise Power Spectral Density No is set at 4.04e-21 W/Hz (-174dBm/Hz) and the bandwidth is varied from 1.25MHz to 20MHz.

It is seen that the capacity increases from about 10Mbps to above 70Mbps as the bandwidth is varied from 1.25MHz to 20MHz (keeping the signal power constant). It must be noted that this is the capacity with a single transmit and single receive antenna (MIMO capacity would obviously be higher).

# Shannon Capacity of a GSM Channel in Fading Environment

In the previous post we calculated the Shannon Capacity of a 200kHz GSM channel in AWGN (Additive White Gaussian Noise). However, in a practical scenario the capacity is limited by time varying fading and interference. Let us consider a fading channel with four possible states corresponding to SNRs of 15dB, 10dB, 5dB and 0dB. The probability of these states is 0.50, 0.25, 0.15 and 0.10 respectively. The Shannon Capacity of such a channel is given as (assuming that the channel state information is known at the receiver):

C=Σ B*log2(1+SNRi)* p(SNRi)

C=B*(Σ log2(1+SNRi)* p(SNRi))

C=(200e3)*(log2(1+31.62)*0.50+log2(1+10.00)*0.25+log2(1+3.16)*0.15+log2(1+1)*0.10)

C=757.43kbps

Assuming that only one out of eight time slots is allocated to any user the Shannon Capacity of a GSM channel is reduced to 94.68kbps.

Note: The contribution of the high SNR states dominates the capacity of the channel. The contribution of the four states in terms of percentage capacity is given as 66.38%, 22.84%, 8.14% and 2.64%.

# Shannon Capacity of a GSM Channel

We know that GSM bit rates can vary from a few kbps to a theoretical maximum of 171.2kbps (GPRS). But what is the actual capacity of a 200kHz GSM channel. We can use the Shannon Capacity Theorem to find this capacity.

C=B*log2(1+SNR)

or

C=B*log2(1+P/N)

The noise power can be found by using the following formula:

N=B*No=k*T*B=(1.38e-23)*(293)*(200e3)=8.08e-16W=-121dBm

Let us now assume a signal power 0f -90dBm. This gives us an SNR of 31dB or 1258.9 on linear scale. The capacity can thus be calculated as:

C=200e3*log2(1+1258.9)=2.06Mbps

This is the capacity if all time slots are allocated to a single user. If only one time slot is allocated to a user the capacity would be reduced to 257.48kbps.

# WCDMA Capacity (Mbps)

The capacity of any wireless communication channel is given by the well known Shannon Capacity Theorem:

C=B*log2(1+SNR)

or

C=B*log2(1+P/(NoB))

where C is the capacity of the channel in bits/sec, P in the noise power in Watts, No is the noise power spectral density in Watts/Hz and B is the channel bandwidth in Hz. It is obvious that the channel capacity increases with increase in signal power. However, the relationship with bandwidth is a bit complicated. The increase in bandwidth decreases the SNR (keeping the signal power and noise power spectral density same). Therefore the capacity does not increase linearly with bandwidth.

It is assumed that the signal power is -80dBm and the noise power spectral density is -170dBm/Hz.

Let us now consider the case of a WCDMA system where the noise component consists of the AWGN noise as well Multiple Access Interference (MAI). The above capacity formula is then modified as:

C=B*log2(1+SINR)

or

C=B*log2(1+P/(NoB+(U-1)*P))

where U is the number of users.

It is assumed that WCDMA system has a bandwidth of 5MHz, signal power of -80dBm and noise power spectral density of -170dBm/Hz. It is observed that the capacity of the WCDMA system decreases exponentially with increase in number of users (all users are assumed to have equal power at the receiver). The capacity of a 5MHz channel drops from about 38Mbps for a single user to about 370kbps for 20 users (the combined capacity of 20 users is 7.4Mbps which is much lesser than the capacity of a single user in AWGN only).

Note:

1. In some references the signal power is adjusted by the processing gain but I think that this is not correct for capacity calculations because in that case the bandwidth should be adjusted as well.

2. The capacity in fading environments would be less than AWGN capacity. However, multi-antenna systems allow for higher capacities.

# Bit Error Rate of BPSK

Modulation is the process by which a binary stream (zeros and ones) is converted to a format that is suitable for transmission over a wired or wireless channel that is prone to noise and interference as well as distortion. The most basic modulation scheme is BPSK or Binary Phase Shift Keying. It transmits the information in the phase of the signal which could be one of two values (0 degrees or 180 degrees).

BPSK signal can be represented as (called the passband representation)

s(t)=a(t)*cos(2*pi*f*t)

where a(t) is a time varying parameter which can have one of two values (+1 or -1). This is equivalent to having the phase of the carrier rotated by 0 degrees or 180 degrees. In simulation of digital communications systems we usually take out the carrier and perform the simulation at baseband. The passband and baseband simulations are equivalent because the carrier signal introduced at the transmitter can be easily removed at the receiver by a process called correlation (or simply put multiplication by the carrier followed by low pass filtering) and what we are left with is the parameter a(t).

If the transmitted signal is given as

a(t)*cos(2*pi*f*t)

then by multiplication with the carrier at the receiver we get

a(t)*cos(2*pi*f*t)*cos(2*pi*f*t)

=(a(t)/2)*(1+cos(4*pi*f*t))

and after low pass filtering the cosine term at twice the carrier frequency is removed and we get the parameter a(t) scaled by the factor 1/2. Since the information is contained in the sign of the parameter a(t) we can recover our transmitted symbols.

So in simulation, instead of multiplying the parameter a(t) by the carrier at transmitter and then again at the receiver we simply transmit a(t). This is equivalent to simulation of a Pulse Amplitude Modulation (PAM) system with two levels. Following are the steps involved in the simulation of BPSK system.

Steps:

1. Generate a random sequence of symbols (+1,-1)

2. Generate samples of Additive White Gaussian Noise (AWGN) with the required variance (noise power = noise variance OR noise power = square of noise standard deviation OR noise power = noise power spectral density * signal bandwidth).

3. Add AWGN samples to the BPSK signal.

4. Detection is performed at the receiver by determining the sign of the parameter a(t).

5. And finally the bit error rate (BER) is calculated. Which is the same as symbol error rate (SER) in this case.

Given below is the MATLAB code that performs these functions. Also shown below are the signals generated at the first four steps and the bit error rate calculated in the fifth and last step.

```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTION TO CALCULATE BER OF BPSK IN AWGN
% l - Input, length of the symbol sequence
% EbNo - Input, energy per bit to noise power spectral density
% ber - Output, bit error rate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[ber]=err_rate(l,EbNo)
s=2*(round(rand(1,l))-0.5);               % Generate BPSK symbols
n=(1/sqrt(2*10^(EbNo/10)))*randn(1,l);     % Generate AWGN noise
r=s+n;                                  % Add noise to signal
s_=sign(r);                              % Detect symbols
ber=(l-sum(s==s_))/l;                    % Calculate BER
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
```

The length of the symbol sequence and EbNo (a bit different than SNR) are the inputs to the function and the bit error rate (BER) is the output. The length of the sequence must be such that you can count about 25 symbol errors at each value of EbNo. This means that at an EbNo of 10dB you would need to pass a few million symbols through the channel. Try it out!!!

Note:

1. To generate the above given bit error rate plot you would have to create a piece of code which calls the above function for each value of EbNo and stores the output BER value in an array and then plot the BER vs EbNo at the end of simulation. We leave this to  you as an exercise.

2. We have generated BPSK symbols directly instead of first generating a binary sequence. This does not matter much in this simple example but for more advanced modulation schemes we would have to first generate a binary stream and then from that the symbols.

3. We have used one sample per symbol of BPSK modulation, as shown in the figure above. But sometimes we have to select higher number of samples per symbol (usually 4 to 10) to implement some other signal processing functions.

4. Most of the concepts discussed above can be extended to other digital modulation schemes. The concepts for analog modulation schemes are somewhat different and we do not use error rates to evaluate the performance of these schemes.