## Matlab DCMC capacity

This Matlab code calculates the Discrete-input Continuous-output Memoryless Channel (DCMC) capacity of AWGN and uncorrelated Rayleigh fading channels for BPSK, QPSK, 8PSK and 16QAM.

Copyright © 2008 Robert G. Maunder. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

May 9th, 2009 at 8:53 pm

capacity channel

May 24th, 2009 at 11:23 pm

I found this helpful

August 22nd, 2009 at 4:20 pm

Hi Rob, just wanted to ask you that where did you get this probability formaula to calculate the channel capacity.

The classic shannonian formula is different. Can you please give me the link to the research paper.

Thankyou

King Regards

August 24th, 2009 at 9:44 am

Hi Pir,

Shannon’s formula assumes a Gaussian distributed input into the channel and can be referred to as the Continuous-input Continuous-output Memoryless Channel (CCMC) capacity. The simulation here gives the Discrete-input Continuous-output Memoryless Channel (DCMC) capacity, which considers the effect of having a digital modulation scheme, such as M=2-PSK or M=16-QAM. The main effect of this is that the number of bits per channel use (or bits/s/Hz) that can be achieved is limited by log2(M), even when the channel SNR is very high. You can find out more about this in…

L. Hanzo, S. X. Ng, T. Keller and W. Webb, “Quadrature Amplitude Modulation,” Wiley, Chichester, UK, 2004.

Hope this helps, Rob.

October 11th, 2010 at 4:00 pm

Hi, Rob

I’m not sure about the capacity formula used in your m-file. I wondered why there is no Rayleigh pdf factor in the integrand of

mean(sum(probabilities.*log2(probabilities)))

Maybe i misunderstand it. Would u please give some details?

Thanks

Regards

October 11th, 2010 at 4:07 pm

Hi Yin,

The Rayleigh fading is considered by the demodulator on the line…

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/N0),realmin);

This calculates a probability for each of the constellation points. The capacity is then calculated by subtracting the entropy implied by the probabilities from the number of bits per symbol.

Hope this helps, Rob.

May 12th, 2011 at 9:29 am

Hello Rob,

I check your post very useful, could you give a hint of how to plot those graphs you show in your post?

Thanks

May 12th, 2011 at 9:36 am

Hi Caste,

You need to use a vector of SNR values and a for loop that records the corresponding capacity values into a vector.

You can plot the SNR plots using

plot(SNR,capacity)

You can plot the Eb/N0 plots using

plot(SNR-10*log10(capacity),capacity)

Take care, Rob.

May 13th, 2011 at 7:36 am

Dear Rob,

I think you define Eb/N0 = 1/sigma^2 for QPSK and Eb/N0 = 1/2*sigma^2 for BPSK? AM I right?

May 13th, 2011 at 12:47 pm

Hi Ideal,

Actually, I use N0 = 2*sigma^2 regardless of the situation, where the real and the imaginary part of the noise each have a standard deviation of sigma. For BPSK, it is possible to use purely real-valued noise and N0 = sigma^2, however this unfairly downgrades the performance of BPSK relative to QPSK.

Note that Es/N0 = 10*log10(1/(2*sigma^2)) and Eb/N0 = Es/N0 - 10*log10(R*log2(M), where R is the coding rate of the channel code and M is the number of constellation points used by the modulator.

Take care, Rob.

May 17th, 2011 at 10:31 am

Hello Rob:

Thanks for your answer, actually computing DCMC capacity in Matlab is much more easier than other language, I was trying to do it in C, but the complexity increases.

Congratulations for your blog and thanks for sharing the information with everybody.

May 17th, 2011 at 10:54 am

You’re welcome

May 17th, 2011 at 4:54 pm

Hello Rob:

Thanks for your answer, actually computing DCMC capacity in Matlab is much more easier than other language, I tried to plot the graphs described above however I couldnt success,the capacity value decreases after 2 dB for 16QAM almost to cero bits/symbol, here is the coded maybe you can give me a hand to check it. Thanks so much one more time…

May 18th, 2011 at 2:23 am

Hi Rob:

This is the last version of my attemp to figure it out your graphs, this time I am trying to save it into an *.txt file so I can plot it using other software, however I couldn’t success in the operation, what could it be wrong?, I really appreciate your help.

May 18th, 2011 at 9:40 pm

Hi Caste,

I’ve put a version of the code that can be used to plot the figures shown above at…

http://users.ecs.soton.ac.uk/rm/wp-content/capacity2.m

Take care, Rob.

June 3rd, 2011 at 6:45 am

Hi Rob,

Can you please tell me, the performance difference of QPAK and 4-QAM in calculating the capacity curve? I mean is the curve will be different if we change the constellation point shape to 4-QAM. i.e.

qam = sqrt(1/2)*[+1+1i, -1+1i, -1 - 1i, 1 -1i].

even then we can use the same program you wrote?

my way of normalizing 4-qam is right? please answer thanks

June 3rd, 2011 at 8:18 am

Hello Ideal,

The capacity of QPSK and 4QAM is the same, since one is just a rotation of the other. The constellation points you have provided look correct to me and should be fine to use in this Matlab code.

Take care, Rob.

June 28th, 2011 at 3:22 am

Hello Rob,

I have one question, how can we calculate Non-Ergodic capacity for MPSK constellations?, as you know ergodic capacity mantains a constant bit-rate for a period of time, which can be inferred from the graphs, after a period of time the bit-rate is constant for every constellation size. Thanks for your answer

June 28th, 2011 at 9:19 am

Hi Caste,

You can use the outage probability to characterise a non-ergodic channel. This quantifies the fraction of time for which your scheme’s bit rate is exceeded by the channel’s capacity, as it varies with time.

Take care, Rob.

June 28th, 2011 at 10:34 am

Hello Rob,

I am working exactly with outage probability for rate distortion analysis, my analysis is on MPSK constellations. In my analysis I need to calculate SNR values for different links (cooperative relay), so assuming a Rc=0.85 for example will permit me to obtain an average SNR value from your plots (for every MPSK constellation size) in specific fraction on time, do you think that this assumption make sense? Thanks for your answer.

Take Care, Caste

June 28th, 2011 at 11:39 am

Hi Caste,

This sounds reasonable to me - you can measure the fraction of time that the SNR is less than the value obtained from the capacity plot.

Take care, Rob.

July 1st, 2011 at 10:08 am

By the way, the CCMC capacity plots for the AWGN and Rayleigh fading channels are given by equations 2 and 4 in…

http://eprints.ecs.soton.ac.uk/20942/

You can draw the AWGN SNR plot using these Matlab commands…

snr_dB = -10:20;

snr = 10.^(snr_dB/10);

C = log2(1+snr);

plot(snr_dB,C);

You can draw the Rayleigh fading channel SNR plot using these Matlab commands…

snr_dB = -20:30;

snr = 10.^(snr_dB/10);

C = exp(1./snr).*expint(1./snr)/log(2);

plot(snr_dB,C);

You can draw the AWGN Eb/N0 plot using these Matlab commands…

snr_dB = -20:18;

snr = 10.^(snr_dB/10);

C = log2(1+snr);

plot(snr_dB-10*log10(C),C);

You can draw the Rayleigh fading channel Eb/N0 plot using these Matlab commands…

snr_dB = -20:30;

snr = 10.^(snr_dB/10);

C = exp(1./snr).*expint(1./snr)/log(2);

plot(snr_dB-10*log10(C),C);

July 7th, 2011 at 8:20 am

What if I want to plot 32-QAM and 64-QAM and 128-QAM capacity using your code?

what can be points?

July 7th, 2011 at 10:15 am

Hello Ideal,

Assuming that you have the Communications toolkit for Matlab, you can obtain the constellation points using these commands…

M=32 % or 64, or 128, etc

mod = modem.qammod(M)

modulation = mod.Constellation/sqrt(mean(abs(mod.Constellation).^2))

Take care, Rob.

July 8th, 2011 at 6:39 am

Hi Rob,

thanks for your responses. One more question.

if we increase the number of symbol, is it affects the symbol energy? like if we increase the symbol (2 symbols per time frame), is the symbol energy reduced by a factor of 1/4, I mean is there any relationship between the number of symbols and symbol energy? Thanks

July 8th, 2011 at 8:07 am

Hi Ideal,

It does affect the symbol energy. However, dividing by sqrt(mean(abs(mod.Constellation).^2)) normalises the constellation diagram, so that the average transmission energy is 1, regardless of how many constellation points there are.

Take care, Rob.

July 11th, 2011 at 5:43 am

Dear Rob,

thanks for the quick response. just one question, what is the difference between the M-PSK and M-QAM capacity curves? are they have same shape or different depending on SNR. please also give me any reference if possible.

I was thinking that the capacity curve for 16-QAM will be different due to its squared shape constellation than simple QPSK or 8-PSK. Thanks

July 11th, 2011 at 10:33 am

Hi Ideal,

In general, different arrangements of constellation points gives a different capacity curve. Some arrangements are better than others, yielding higher capacities. There is a book that explains the DCMC capacity in greater detail. You can download a sample of some of its chapters from…

http://www-mobile.ecs.soton.ac.uk/newcomms/files/u1/QAM3-chaps_1-22-24.pdf

Take care, Rob.

July 14th, 2011 at 12:29 pm

HI ALL

Can any one help me with Adaptive Modulation Code for Ergodic Capacity

Thanks

August 21st, 2011 at 7:35 pm

HI Rob,

THANKS for your code. It is really helpfull. I’m trying to understand how did you reach to the capacity equation.

I was wondering if you know where to find chapter 23 of the book you are refering to (Quadrature Amplitude Modulation).

Thanks again.

Con

August 22nd, 2011 at 9:21 am

Hi Con,

I’m afraid that chapter is only available in the book - perhaps your library has a copy…

Take care, Rob.

August 24th, 2011 at 5:51 pm

Hi again Rob!

Thanks. Your matlab implementation is very elegant!

I\’m trying to reach your equation for channel capacity.

The first part is quite clear assuming Uniform distrubition for X.

But the second part of your capacity is the tricky one:

Capacity can be defined after some calculations as http://imageshack.us/photo/my-images/20/capacitydiscreteinput.png/

Because the simulation is ergodic the integral over Y can be done with the mean.

Then, you are calculating the probabilites of the symbol p(y/x), but in your final equation I\’m still missing the 1/abs(X) and the denominator. of the log2.

I also try to reach your elegant solution with the reference of L. Hanzo, Chapter 23. But from equation 23.23 I\’m not able to go beyond that.

http://imageshack.us/photo/my-images/830/equation2323.png/

Thanks again

Con

August 25th, 2011 at 9:21 am

Hi Con,

In my code, ‘probabilities’ is calculating the probability of each transmitted symbol having each possible value. Then sum(probabilities.*log2(probabilities)) is calculating the entropy of each symbol (but multiplied by -1). Then the capacity is calculated as the number of bits per symbol minus the average entropy of the symbols.

This explanation is equivalent to both the equations you have provided, particularly equation 23.23.

Take care, Rob.

August 28th, 2011 at 7:56 pm

Hi Rob

Thanks for all your replies, though I am not exactly working on them but I am trying to plot exit charts so in that sense your posts are realy helpful.

By the way, I wanted to know about combining of LLRs, as how should I combine the two LLR sequence.

And is combining of simple bit sequence similar to combining of two LLR sequence

August 30th, 2011 at 8:35 am

Hi Zhiven,

You can combine two sets of LLRs by simply adding them, provided that they both pertain to the same set of bits.

By contrast, when you have two sets of LLRs that each pertain to a different set of bits, you have to do things differently. If those bits are combined using XOR operations, then the LLRs should be combined using boxplus operations. The boxplus operator is defined in…

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.291&rep=rep1&type=pdf

Take care, Rob.

September 11th, 2011 at 4:34 am

Hello Rob:

Thanks for your answers so far,

I have one question regarding OUTAGE CAPACITY for MPSK constellation, can you please give me a hint regarding how can we calculate this outage pagacity for each MPSK constellation, as far as I know , outage event occurs when the SNR at the RX, falls below a threshold SNRmin , so we can’t use the classical approximation of C(out)=log(1+SNRmin), is it possible somehow to use the curves from your post?

Thanks for your answer

Best Regards

September 12th, 2011 at 8:00 pm

Hello Caste,

You can use the curves from this post to convert from your transmission rate (in bits per symbol or bits per second per Hz) to the minimum required SNR. You can then calculate the outage capacity by determining the probability that the SNR will exceed this minimum required value. In an AWGN channel, the SNR does not vary and so this probability will be either 0 or 1. In a Rayleigh fading channel, the instantaneous SNR varies with the fading and so the probability will be somewhere between 0 and 1.

Take care, Rob.

September 14th, 2011 at 1:29 am

Hello Rob,

Thanks for your answer, what you mean is to select a minimum required SNR based on the BER for each constellation, for example in BPSK, for a BER=10e-3, the minimum required SNR will be 6,68dB, then according to your recommendations, Cout is the probability that the SNR exceed 6.68dB?, if so how can i do this?

Thanks again for your answer

Best Regards

Caste

September 14th, 2011 at 5:53 am

Hi again Rob,

Please let me explain myself in a better way:

I want to compute end-to-end distortion following the classical expression for gaussian sources: D=2*exp(-2*Cout)*(1-Pout)+Pout, for MSK.

Assuming Rayleigh fading Pout is express as: Pout=1-exp((minSNR)/(Eb/N0)), and then: minSNR=-Eb/N0*ln(1-Pout), so selecting a especific BER for every MPSK constellation ( for example 10e-2), I can obtain Eb/N0 for every M=2,4,8,etc, then I have a equation that express minSNR as a function of Pout for every MPSK constellation size.

The remaining part would be to make some analysis that will permit to express this Cout as a function of this minSNR, at the end I would like to have an expression that permits to express distortio D, as a funtion of Pout (considering already the effect of MPSK constellation sizes).

Cout is defined as the reliable rate at a certain outage probabilty, so we can define Pout=1-P(SNR>minSNR), so in this point I am lost in the darkness.. :(, is this Cout going to be a fixed value in the capacity curves of MPSK constellation sizes?.

Thanks for your help.

Best Regards

Caste

September 14th, 2011 at 9:13 pm

Hmmm,

To calculate outage capacity, you should be using a capacity plot, not a BER plot. The way you calculate the outage probability depends on the characteristics of the channel. In a Rayleigh fading channel, you can perform an integration on a function of the Rayleigh PDF to determine the probability that the SNR will exceed a particular value.

Take care, Rob.

September 14th, 2011 at 11:05 pm

Hello Rob:

Actually the reason why at the begining i want to use BER is to calculate the minimum SNR required, otherwise how can i set the minimum point of operation? Can u please give me an example?

Thanks for your answer

Best regards

September 15th, 2011 at 6:19 pm

Hi Caste,

Your approach seems reasonable and more accurate than considering only the capacity. However, I would call it “outage probability”, rather than “outage capacity”, since you are not using the capacity plots in your approach.

To use the capacity plots, you would draw a horizontal line in the plot at the position along the y axis that matches the number of bits per channel use in your scheme. The minimum SNR is then the position along the x axis where the horizontal line crosses the capacity plot.

Take care, Rob.

December 24th, 2011 at 7:12 am

Hi Rob

Can I use the following capacity equation to plot the throughput:

C = log2(M) * ( 1 - H(p)).

where H(p) = - p*log2(p) - (1-p)*log2(1-p)

where p is the bit error rate not the symbol error rate.

is the equation correct??????????

thanks in advance

December 29th, 2011 at 3:09 pm

Hi Rajab,

I’m not in my office at the moment so I can’t check, but I think your equation would only work for a Binary Symmetric Channel (BSC), which has a discrete input and discrete output. This won’t work in general, such as for an Additive White Gaussian Noise (AWGN) channel, which has a discrete input and a continuous output.

Take care, Rob.

February 2nd, 2012 at 12:44 am

hi, rob.

thanks for your m-code. It is pretty helpful to understand the capacity.

I have a question.

I\\\’d like to know the capacity in frequency selective channel such as sqrt(3)*[1 1 1].

As i know, the capacity in frequency selective channel depends on H(f)^2/N0.

I tried to draw the capacity by modifying your m-code. but I got un-expected results, which under around 5 snr dB, its capacity exceeds the awgn capacity.

please give me a tip to draw the capacity correctly.

best regeards.

February 2nd, 2012 at 10:01 am

Hello John Shin,

I’m afraid that I’ve never drawn the capacity for frequency selective channels and I can’t offer any tips for this…

There seems to be some good references on this topic at Google Scholar…

http://scholar.google.co.uk/scholar?q=frequency+selective+capacity&hl=en&btnG=Search&as_sdt=1%2C5

Take care, Rob.

February 2nd, 2012 at 12:32 pm

hello rob.

thanks for your quick response and good references.

Best Regards,

John.

February 3rd, 2012 at 1:26 pm

Hi,

Can you help me with any formula or code to plot throughput v/s SNR plot for MIMO system??

February 3rd, 2012 at 1:40 pm

Hi Pooja,

I’m afraid that I don’t have any code for plotting the DCMC capacity of MIMO channels. However, it is not too difficult to do this by combining all the received soft information together and using it to determine the probability of transmitting each possible combination of signals from the various antennas. You can then use similar equations to those in my code.

Take care, Rob.

February 4th, 2012 at 7:29 am

Hi Rob,

Thanks for reply… Will try to derive the similar formulas for MIMO systems too…

Have a great day,

Regards,

Pooja.

February 24th, 2012 at 3:08 pm

hi sir i want to optimize MIMOCapacity(R_t, R_r, SNR)

fitness=c=log(det(I+pQ/Nt) but problem plz help me matlab code

February 25th, 2012 at 3:02 pm

Hello Anand,

I’m afraid that I don’t have any Matlab code for the MIMO channel capacity.

Take care, Rob.

March 7th, 2012 at 5:45 pm

ok,actually i want to optimize mimo ofdm ergodic capacity through Genetic Algorithm but my result is not iterative iso plz help me

March 7th, 2012 at 5:50 pm

Hello Anand,

I’m afraid that I don’t have any Matlab code for the channel capacity of OFDM either…

Take care, Rob.

March 31st, 2012 at 9:40 am

hi every body…can anyone plz guide me how to plot outage probability vs SNR?

March 31st, 2012 at 7:27 pm

Hello Fateme,

You can use the curves from this post to convert from your transmission rate (in bits per symbol or bits per second per Hz) to the minimum required SNR. You can then calculate the outage capacity by determining the probability that the SNR will exceed this minimum required value. In an AWGN channel, the SNR does not vary and so this probability will be either 0 or 1. In a Rayleigh fading channel, the instantaneous SNR varies with the fading and so the probability will be somewhere between 0 and 1.

Take care, Rob.

May 2nd, 2012 at 11:11 am

i need a theoretical formula of Bit Error Rate or Symbol error rate for 16-APSK (amplitude phase shift keying). i got the simulation result . but i dont know the exact theoretical formula or equation regarding of this problem. Plz Help me by giving me the theoretical equation or formula of Bit Error Rate or Symbol Error Rate if anybody knows.

May 2nd, 2012 at 2:59 pm

Hi Imran,

There are lots of these derivations in…

Quadrature Amplitude Modulation: From Basics to Adaptive Trellis-Coded, Turbo-Equalised and Space-Time Coded OFDM, CDMA and MC-CDMA Systems, 3rd Edition, by L. Hanzo, S. X. Ng, T. Keller, W. T Webb.

You can download some of the chapters from this book at…

http://www-mobile.ecs.soton.ac.uk/newcomms/files/u1/QAM3-chaps_1-22-24.pdf

Take care, Rob.

May 5th, 2012 at 12:16 pm

theory SER_16PSK = erfc(sqrt(10.^(Es_N0_dB/10))*sin(pi/M));

theorySER_16QAM = 3/2*erfc(sqrt(0.1*(10.^(Es_N0_dB/10))));

like this how can or what will be the theoretical formula for 16-APSK.

Plz Rob if you know then help me.

i read your given link,

i am confused Adaptive PSK Modulation Schemes i.e is it APSK but i know APSK means Amplitude Phase shift keying.

in 16 APSK, 2 concentric ring, like inner is 4 and outer is 12.

but in 16-PSK, only one circle.

if you have any suggestion please inform me. i am waiting for your kind response.

take care

imran

May 7th, 2012 at 11:38 am

Hi Imran,

The constellation you are describing is similar to star-16QAM, which has 8 points in an inner ring and 8 in an outer ring. If you can find the derivation of the BER for this, you should be able to adapt it for your constellation. I’m afraid that I have never looked for these derivations before, but I suspect that they can be found.

Take care, Rob.

May 14th, 2012 at 4:09 pm

Hi,

Thank you very much. Can you explain why you use

mean(sum(probabilities.*log2(probabilities))) in the code? because the probabilities is normalise as probabilities = probabilities ./ (ones(length(modulation),1)*sum(probabilities));

I try to modify your code to compute the BICM capacity, and then have some problems in the above confusion.

Thank you very much.

May 14th, 2012 at 4:42 pm

Hello Deen,

That line is calculating the average entropy of the probabilities. This a different calculation to the one used to normalise the probabilities.

Take care, Rob.

June 1st, 2012 at 2:29 pm

Wonderful work, Rob.

How do we derive bit likelihood ratios for 4QAM,16QAM and 64QAM to use in a code. By the way, in your statement below: R, is it the coderate or the bitrate ? Say polar code (512,128), r=1/3. Is this equal to R or is R=0.5 like the bit rate of polar codes!

Note that Es/N0 = 10*log10(1/(2*sigma^2)) and Eb/N0 = Es/N0 - 10*log10(R*log2(M), where R is the coding rate of the channel code and M is the number of constellation points used by the modulator.

Thanks

June 1st, 2012 at 2:31 pm

Sorry, r =0.25

June 6th, 2012 at 6:03 pm

Hi Nyakac,

I have some Matlab code for deriving the LLRs of various different modulation schemes. You can see some discussion about this and download the code at…

http://users.ecs.soton.ac.uk/rm/resources/matlabexit/#comment-1545

R is the ratio of input bits to output bits, so that R*log2(M) is the ratio of input bits to transmitted symbols.

Take care, Rob.

June 7th, 2012 at 8:16 am

Thanks Rob,

I take that comment to mean the input/output to the encoder. We had an argument with a colleague and I hope this adds insight to our understanding.

Great!

Rgds

August 2nd, 2012 at 3:08 pm

Any code for Chase algorithm? or Kaneko, or list, I would be happy.

Kind regards,

August 2nd, 2012 at 4:42 pm

Hi Nyakec,

I’m afraid that I don’t have any code for those algorithms…

Take care, Rob.

September 23rd, 2012 at 1:58 pm

hi rob dis is jai thanks for ur mcode.iam doing project on cooperative diversity in wireless networks.In that iam doing comparison of snr in amplify and forward relay and decode and forward relay networks do u hav any matlab code for that.

September 23rd, 2012 at 3:39 pm

Hi Jai,

I’m afraid that I don’t have any matlab code for cooperative diversity schemes.

Take care, Rob.

November 30th, 2012 at 3:23 am

Hi Rob,

I have a bit confusion, in capacity eq. 23.23, the capacity is calculated as the number of bits per symbol minus the average entropy of the symbols. Then, why in your matlab command, you used ‘+’?

channel_capacity(index) = log2(length(modulation))+mean(sum(probabilities.*log2(probabilities)));

In your previous comment, you did mention that ” sum(probabilities.*log2(probabilities)) is calculating the entropy of each symbol (but multiplied by -1).”

Why do you choose to multiply with -1? Any reason behind that?

December 3rd, 2012 at 9:48 am

Hello Anne,

This is because I am using log2(probabilities), rather than log2(1./probabilities). This is okay because log2(probabilities) = -log2(1./probabilities).

Take care, Rob.

December 11th, 2012 at 1:15 am

Dear Rob,

I have question about the mutual information (MI) calculations.

In you matlab script, you use the following model,

y = x + sigma*n, where sigma = sqrt(N0/2), N0 = 1/SNR_Linear; x = symbol

I want to use the following model, y = sqrt(Es)*x + n, where n = zero mean, unit variance noise, and Es is the received symbol energy, Es/No = (P/No*R), where P is the transmit power and R is the symbol rate.

I was thinking that the MI plot should be same in both of the two model? Am I wrong somehwere? please give me some suggestion. Thanks

December 12th, 2012 at 4:45 pm

Hi Ideal,

I would expect the MI plot to be the same for both y=sqrt(Es)*x+n and y=x+sigma*n. I think that you are getting confused by the difference between Es/N0 and Eb/N0…

Es/N0 = SNR

Eb/N0 = SNR - 10*log10(bits_per_transmission)

Here, Es/N0, Eb/N0 and SNR are all expressed in dB. bits_per_transmission is a function of R.

Take care, Rob.

December 13th, 2012 at 3:33 am

Thanks.

Let me explain in other way, i.e., y = sqrt(P)*x + n, where I consider the BPSK system. Now SNR = Es/N0 = Eb/N0. In above equation P is the received signal power, x belongs to (+1,-1) and n~(0,1). What is the relationship of SNR and P in this case. I think SNR = sqrt(P) but what will be the relationship of SNR or P with the transmit signal power.

Like in case of y = x + sigma*n, it is easy to say that sigma = sqrt(1/2*SNR), but I am still confuse with the above system. Like how to simulate it? Or I can just simulate by saying that y = sqrt(SNR)*x + n and SNR = sqrt(P) and vary P from 0 to 10 dBm. Please Please clear my this concept. Thanks

December 13th, 2012 at 5:50 pm

Hi Ideal,

In the case of y = sqrt(P)*x + n, the SNR will be equal to P, not to sqrt(P)…

Take care, Rob.

December 14th, 2012 at 1:10 am

Yes,

SNR = P, It was mistakenly written. I am using your script DCMC capacity

But with that the (the script written by you) DCMC capacity results doesn’t match of both models.

1. y = x + n, n~(0,sigma), sigma = sqrt(N0/2), N0 = 1/SNR_Linear

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/N0),realmin);

2. y = sqrt(SNR)*x + n, n~(0,1), SNR = P_Linear, N0 = 2*sigma^2, sigma^2 = 1,

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/2),realmin);

Both models give me different results, why, or where I am wrong. Please can you rectify me. Thanks

December 14th, 2012 at 4:14 am

Dear Rob,

I got it, I also need to multiply with sqrt(P), i.e.

p(y|x = sqrt(Es)) = 1/sqrt(2*pi)*exp(rx - sqrt(Es)*x*h), so

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/2),realmin);

is not correct. The correct one is,

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - sqrt(P)*modulation.’*channel).^2)/2),realmin);

and P = SNR, Thanks for your useful suggestions.

December 14th, 2012 at 5:00 am

Dear Rob,

The above method works but I got 3dB difference between the capacity curves. Where I am wrong now? sorry for asking so many times the fundamental questions

December 14th, 2012 at 6:05 pm

Hi Ideal,

I’m afraid that I’m not sure what else could be going wrong. It seems that you are getting very close - perhaps with a little more time on this, you will figure it out…

Take care, Rob.

December 15th, 2012 at 5:02 am

Dear Rob

Thanks just let me know Is the below formula correct?

y = sqrt(P)*x + n; n=randn(0,symbol_count), P = SNR; x = (+1,-1),

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - sqrt(P)*modulation.’*channel).^2)/2),realmin);

Thanks

December 16th, 2012 at 5:50 am

Dear Rob,

Thanks I got it now but not sure correct?,

y = sqrt(P)*tx + n; n~(0,1), P=SNR, tx=modulation(symbols), as you defined for each constellation size in you script.

I got the same capacity curves when I divide the modulation with sqrt(1/2),

otherwise I got 3dB in each curves. This division of sqrt(1/2) applies for every constellations BPSK to higher size, 16-QAM.

Can you please advise me any helpful comments? Thanks

December 17th, 2012 at 9:45 am

Hi Ideal,

I think that your noise should be generated as follows…

n = sqrt(1/2)*(randn(1,symbol_count)+1i*randn(1,symbol_count))

Take care, Rob.

December 17th, 2012 at 11:22 am

Dear Rob,

I tried to generate the noise like as you said but it dosn’t match, It only matches if I divide the modulation by sqrt(1/2), i.e., modulation = [+1, -1]/sqrt(1/2); and it applies for all modulations.

Secondly why should I need to generate the noise with variance sqrt(1/2) because I said the noise is zero mean and unit variance in the 2nd model.

I am not clear yet but the capacity curves of both models match well with additional term sqrt(1/2).

December 17th, 2012 at 7:17 pm

Hi Ideal,

That sqrt(1/2) is needed to maintain a variance of one when using complex noise. This is because complex noise has two dimensions…

Take care, Rob.

December 18th, 2012 at 4:36 am

Yes That’s right, now it makes sense,

N0 = 1;

n = sqrt(1/2)*(randn(1,symbol_count)+1i*randn(1,symbol_count));

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - sqrt(P)*modulation.’*channel).^2)/N0),realmin);

Now by using the above three lines in your script, the capacity results of both models match very well without the division factor of sqrt(1/2). I think now its right?

December 18th, 2012 at 9:29 am

Hi Ideal,

It sounds like you have got it now.

Take care, Rob.

January 8th, 2013 at 12:05 pm

Dear Rob,

I have some basic question please.

The receive signal is represented by y = Px + n

where x is transmitted symbol, P is the transmit power, n is 0 mean 1 variance noise.

then the SNR = P (transmit power) for BPSK? or not

I am confuse here and also is there any effect on SNR for higher modulation level.

please can you clarify my concept please. Also if you can refer some tutorial example will be good. thanks

January 8th, 2013 at 5:58 pm

Hi Ideal,

SNR = P for BPSK, provided that you are using +1 and -1 as your BPSK symbols. For higher order modulation schemes, you need to make sure that mean(constellation_points.^2) has a value of 1. I’m afraid that I can’t think of a tutorial that discusses this…

Take care, Rob.

January 8th, 2013 at 11:03 pm

Dear Rob,

Thanks, it means for higher order constellation points, we can consider the unity constraints constellation, e.g. for QPSK, constellation_point.*sqrt(1/2) and SNR in that case will remain same which is SNR = P (transmit power).

Am I right?

January 9th, 2013 at 5:25 pm

Hi Ideal,

That’s right.

Take care, Rob.

February 22nd, 2013 at 4:54 pm

Helloo Rob

Is there any formula to convert Bit Error Rate to Capacity, for any M-ary?

Another question,

how can I use you code to calculate the end-to-end capacity for two-hops relay for the following case:

source send symbol, then the relay hard-estimates the symbol and broadcasts it to the destination.?

My best regards

Rajab

February 22nd, 2013 at 5:41 pm

Hi Rajab,

I’m afraid that I don’t know of any formula to convert BER to capacity. I think that in a two-hop relay scenario, the end to end capacity is just the minimum of the capacities of the two hops…

Take care, Rob.

February 26th, 2013 at 7:03 am

Hi Rob

Actually, using the minimum of the two capacity will not work in my two-hop relaying scheme. Because, in my scheme, the relay hard-estimates the transmitted symbols from the source, and then forward the estimated symbol to the destination. In other words, the relay do not do any channel decoding.

Assuming the link of the first hop is too bad. so we will have a lot of symbol error at the relay after hard-estimation. So, in this case, the channel decoding at the destination is equivalent to hard decoding, since we lost much information because the hard-estimation.

thanks for response

My best regards

February 27th, 2013 at 6:39 pm

Hi Rajab,

Something that you should note is that capacity is a measure of the upper-limit performance that can be potentially achieved in practice. So even though your relay may be forwarding erroneous information, this does not reduce the capacity. All it means is that your scheme is sub-optimal and that its performance is somewhere away from the capacity.

Take care, Rob.

February 28th, 2013 at 3:12 pm

Hi Rob

Thanks you for this information.

My best regards

March 5th, 2013 at 6:09 am

Hi Rob

I have a quick question.

How can I calculate the Mutual information (MI) for discrete input discrete output channel in general? In other words, I want calculate the MI using the data for the input and output using matlab?

Thanks

Rajab

March 5th, 2013 at 7:23 pm

Hi Rajab,

A general way to calculate the MI is to express your received bits using LLRs and then to provide them to one of my functions for measuring MI.

LLR = ln(P1/P0), where P1 is the probability that the bit has a value of 1 and P0 is the probability that the bit is 0.

Take care, Rob.

March 6th, 2013 at 9:32 am

Hi Rob

Could explain this method?

My best regards

Rajab

March 6th, 2013 at 7:24 pm

Hi Rajab,

In a binary symmetric channel, where we transmit x and receive y, the LLRs can be calculated as follows.

In cases where y = 0, the LLRs are given by

LLR = ln(P(y=0|x=1)/P(y=0|x=0)) = ln(Pe/(1-Pe))

In cases where y = 1, the LLRs are given by

LLR = ln(P(y=1|x=1)/P(y=1|x=0)) = ln((1-Pe)/Pe)

Here, Pe is the probability of transmission error.

Take care, Rob.

March 6th, 2013 at 7:44 pm

Hi Rob

But how can I calculate the MI from LLR?.

Which equation i have to use?

Thanks for your help

My best regards

Rajab

March 7th, 2013 at 10:32 am

Hi Rajab,

You can use the equation immediately below figure 4 in…

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.291&rep=rep1&type=pdf

This equation is implemented in my Matlab function measure_MI_averaging, which you can download from…

http://users.ecs.soton.ac.uk/rm/resources/matlabexit/

Take care, Rob.

March 8th, 2013 at 3:27 am

Hi Rob

It woks perfectly.

Thanks for you help

Rajab

May 16th, 2013 at 11:01 am

Hi Rob,

do you have or know any good publication that analyses capacity of DCMC with fading,?

Thanks

Fourat

May 17th, 2013 at 1:14 pm

Hi Fourat,

I can recommend the following paper on this…

http://www-mobile.ecs.soton.ac.uk/sxn99r/paper/capacity-vt06.pdf

Take care, Rob.

July 12th, 2013 at 11:26 am

Can you simulate this paper for me:

On the Area Spectral Efficiency Improvement of

Heterogeneous Network by Exploiting the

Integration of Macro-Femto Cellular Networks

I want to know how they got their fig4 and fig5

July 15th, 2013 at 7:54 am

Hello Mfon,

I’m afraid that I don’t have any Matlab code for this.

Take care, Rob.

September 22nd, 2013 at 9:23 am

Hi Rob,

I am trying to simulate the Ergodic rate for slow flat Rayleigh fading channel but my results are a bit different from the paper. I think I am making mistake to apply the ergodicity in simulation. Could you guide me on this? Any Matlab code available for that?

I am working under a very tight time schedual :((

Thank you

September 23rd, 2013 at 8:57 am

Hi Pari,

I’m afraid that I don’t have any Matlab code for this - everything that I have is available from this page…

Take care, Rob.

October 20th, 2013 at 8:15 pm

can i have a code to calculate the capacity of bsc channel

October 20th, 2013 at 8:27 pm

matlab code for capacity of

binary erasure channel plzzzz

October 21st, 2013 at 12:38 pm

Hi Kuchv,

The capacity of a binary erasure channel with an erasure probability of p is…

C=1-p

The capacity of a binary symmetric channel with an error probability of p is…

C=1-p*log2(1/p)-(1-p)*log2(1/(1-p))

Take care, Rob.

November 17th, 2013 at 6:37 am

Hi Rob,

first of all tnx for ur helpful instructions on the capacity of a DCMC.

I’m confused with the formula u used for the analytic capacity in an AWGN channel. I mean you’ve used C = log2(1+snr). isn’t it actually C = 0.5*log2(1+snr) ?

Bests, Miti

November 21st, 2013 at 11:08 am

Hi Miti,

The equation you have given is the capacity if you only use the in-phase part of the carrier. If you also use the quadrature-phase part (like in QAM) then the capacity becomes the equation I gave. You can find more on this at…

http://en.wikipedia.org/wiki/Shannon–Hartley_theorem

Take care, Rob.

December 14th, 2013 at 6:49 am

Can you help for the simulation of OFDM for 64-QAM in rayleigh fading channel and find outage capacity & spectral efficiency for that.

December 16th, 2013 at 6:53 pm

Hi Jigna,

I’m afraid that I don’t have any Matlab code for OFDM. But you can convert the following code to 64-QAM…

http://users.ecs.soton.ac.uk/rm/resources/matlabexit/#comment-1545

Take care, Rob.

March 2nd, 2014 at 10:11 am

Hi Rob,

I have found many papers that show graphs for capacity versus SNR . However, they have one SNR value. I think we can not plot capacity versus SNR for one value. If we have one received power, we will have one SNR and this received power and capacity depend on one distance value. So we also have one channel matrix and one capacity value. So I m having a lot of trouble for plotting with one SNR value.Please give me some suggestions for plotting this.

March 10th, 2014 at 5:39 pm

Hi Rob

i need a code matlab of calculation capacity a function the interference in network UMTS (3G)

can you help me!

March 10th, 2014 at 6:06 pm

Hi Phyuphyu,

I’m afraid that I don’t understand what you mean by “one SNR value”. The x axis of a capacity vs SNR plots includes lots of different SNR values…

Take care, Rob.

March 10th, 2014 at 6:06 pm

Hello Rahma,

I’m afraid that I don’t have any Matlab code for the capacity of an interference channel.

Take care, Rob.

March 14th, 2014 at 4:38 am

Hi Rob,

Thank Rob for your reply. Some papers show graphs for capacity vs SNR. In our experiments, we can get one SNR value for one experiment. We make experiments in LOS conditions. So MIMO channel matrix depends on one distance value between transmitter and receiver, antenna spacing, and wavelength. According to this experiments, we can get one received power and thus one SNR value as it depends on received signal power and noise power (SNR= Pr/sigma^2). Therefore, with experimental data, we can’t plot SNR vs capacity because we have one SNR vale and one capacity value.

I think some papers shows simulation results and I would like to know how we can plot capacity vs SNR with our experiments.

Thank Rob.

May be happy and peace

March 14th, 2014 at 7:11 pm

Hi Phyuphyu,

I’m wondering where your value of sigma comes from? If you vary this value, you can vary your noise power and investigate different SNRs…

Take care, Rob.

March 17th, 2014 at 10:05 am

Hi Rob

i need a code matlab of calculation global capacity in the coexistence DVB-LTE systems (both DVB and LTE are OFDM-based systems) ;

can you help me!

March 17th, 2014 at 1:57 pm

Rob,

I hav calculate SIR for a number of receive antennas (hav taken 20). Nw I need to find outage probabilty. Hw to get it?Finally I need to plot outage probabilty versus no. of receive antennas.

Regards.

Sooraj

March 17th, 2014 at 7:10 pm

Hello Maha,

I’m afraid that I don’t have any Matlab code for the situation you describe.

Take care, Rob.

March 17th, 2014 at 7:12 pm

Hello Sooraj,

The outage probability is given by the fraction of frames for which the channel capacity is below the transmission rate of your system.

Take care, Rob,

March 18th, 2014 at 3:27 pm

Thank Rob,

sigma^2 is the noise power or variance which is equal No/2 and we can consider Noise power over bandwidth B. So, sigma^2=NoB=KTB (K = Boltzmann’s constant = 1.3803×10-23 [J/K], T = Temperature [K] (Standard Temperature = 290 K, B=bandwidth)). If so, how can I vary noise power?

Please help me.

Thank Rob.

March 18th, 2014 at 8:16 pm

Hi Phyuphyu,

Ah, I see. In that case, I would suggest varying the path loss, such that the receiver receives the amount of power that gives you the SNR you want.

Take care, Rob.

April 2nd, 2014 at 1:33 am

Hi Rob,

I would appreciate some help. I need to calculate the capacity of a binary symmetric channel, and an asymmetric channel. Where should I start from? Also, is there an example of how maximization is done for the mutual information?

Thanks for your help.

Dina.

April 2nd, 2014 at 5:49 pm

Hi Dina,

You can find all the information you are looking for on Wikipedia…

http://en.wikipedia.org/wiki/Binary_symmetric_channel#Capacity_of_BSCp

http://en.wikipedia.org/wiki/Z-channel_(information_theory)#Capacity

Take care, Rob.

April 30th, 2014 at 7:06 am

HI,

Now I am doing project on cognitive radio spectrum sharing.

I will be grateful if any one help me by giving some matlab simulation code such as “secondary user ergodic capacity under interference constraints”

April 30th, 2014 at 12:42 pm

Hello Maha,

I’m afraid that I can’t help because I don’t have any Matlab code for cognitive radio.

Take care, Rob.

June 2nd, 2014 at 10:38 am

Hello Rob,

What’s the probability density function of the ratio of two lognormal variables?

June 2nd, 2014 at 4:15 pm

Hi Maha,

I’m afraid that I’m not sure. The difference of two normal variables is normal distributed so perhaps the ratio of two lognormal variables is also lognormal distributed (since the log of a ratio of two variables is equal to the difference between the logs of the variables).

Take care, Rob.

October 29th, 2014 at 2:29 am

hi dear rob

i’ve simulated an idma system (it is like cdma) which calculate BER versus SNR.

now,i wanna to calculate capacity for this system versus snr. how should i do that? should i first calculate snr and then i use it in c=blog(1+snr) or no?

i was wonder if u help me

October 29th, 2014 at 2:21 pm

Hello moh99,

The equation you have provided will give you the Shannon capacity of an AWGN channel, as plotted in the top figure above. If you would prefer to use the DCMC capacity that corresponds to your modulation scheme, then you can use the simulation that you can download from this page.

Take care, Rob.

October 29th, 2014 at 9:58 pm

dear Rob can you please oblige me with MATLAB CODES to simulate \’throughput\’ graphs for QPSK, 16-QAM and 64-QAM.

I am carrying out a research to analyze modulation techniques of WCDMA system based on maximum data throughput. From these codes(and simulation), i intend to investigate which of them yields better data throughput.

God bless you.

Mekus

October 30th, 2014 at 6:02 pm

Hello Mekus,

Unless I have misunderstood what you are seeking, I think that you are looking for the Matlab code provided above, which can draw the DCMC capacity plots for QPSK, 16QAM, 64QAM, etc. The DCMC capacity is the maximum throughput that these modulation schemes can achieve.

Take care. Rob.

December 23rd, 2014 at 4:14 pm

Hello Rob,

Thank you for your generous help and for your responses to the questions.

I am trying to use your code to calculate the channel capacity in a very special case.

In most cases, in the references books and papers, people suppose that the noise is an additive normal Gaussian wight noise. But in my case the noise is a non Gaussian Impulsive noise. There is not a mathematical formula to calculate its PDF.

There are two approximations that can be used witch are Middleton Class A or alpha stable distributions. The PDF of the last one is also not defined except for two special cases, Cauchy (parametre α=1)and Gaussien (parametre α=2).

I was thinking that I may use a similar way to the one that you proposed to calculate the capacity.

you said that ‘probabilities’ is calculating the probability of each transmitted

symbol having each possible value. so if we suppose y=x+n then the term

abs(ones(length(modulation),1)*rx - modulation.’*channel) is actually

y-x*H=n and

probabilities= max(e^(-n^2/N0),realmin). and since N0 = 2*sigma^2 then

probabilities= max(e^(-n^2/2*sigma^2),realmin). Then the sigma factor is the key to calculate the probabilities.

So I was wondering that if I can some how (maybe empirically) calculate the sigma of my simulated non-Gaussian noise, I could use the same approach that you used to calculate the probabilities and then the capacity. But I am not sure if that is correct and I think that this way is only correct for Gaussian noises.

I am really stocked with this problem and any help will be appreciated.

December 23rd, 2014 at 5:27 pm

Hi Ismail,

The equations that you have mentioned are derived from the Gaussian PDF - that’s where the sigma comes from. For non-Gaussian noise, the probabilities would be obtained using a different equation, having different parameters. In order to measure the capacity, you would need to derive these equations. Any attempt at using an ‘equivalent’ sigma value would only give you an approximation of the channel capacity. It would probably be possible to derive the correct equations for the cases where the noise PDF is defined. However, I’m afraid that I don’t know what to suggest for cases where the PDF is not defined…

Take care, Rob.

December 24th, 2014 at 2:12 pm

Hello Rob,

thank you for your fast respond and for the explanations,

I noticed that the formula that you used to measure the PDF of the Gaussian noise may be missing the (1/sqrt(2*pi*N0)) term. So I think that the ‘probabilities’ factor witch represents the PDF of a normal distribution should be :

probabilities = max((1/sqrt(2*pi*N0))*

exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/N0),realmin);

Also, may I say that if I know the PDF of my noise I can Just replace the above equation with some other corresponding PDF and all the rest will be the same?

Thank you for your comments.

December 30th, 2014 at 10:42 am

Hi Ismail,

The term that you mention can be optionally omitted. All it does is normalise the symbol probabilites, such that they sum to one. Many Soft-In Soft-Out (SISO) algorithms (such as the BCJR) don’t care if the probabilities are normalised or not.

In order to derive an equation for the LLRs when using a different noise distribution, it should be the same process. I would encourage you to figure out the derivation for AWGN first, then apply this process to your different noise distribution.

Take care, Rob.

December 30th, 2014 at 2:53 pm

Hi Rob,

Thank you for your help, I will try to do so and see what can I get .

Have a nice day.

January 16th, 2015 at 10:11 am

Hello,

plz i need a matlab code of adaptive coder and modulation ,

could you giving me idea how it can be done plz?

Thanks!

January 16th, 2015 at 10:13 am

Hello,

plz i need a matlab code related to adaptive modulation and coder could you help me,

Best regards!

January 17th, 2015 at 2:20 am

Hello Najwa,

I’m afraid that I don’t have any Matlab code for adaptive coding and modulation. However, you could build this from the coding and modulation Matlab code that I have here. You would just need to produce different parametrisations of the coding and modulation, then switch between them as appropriate.

Take care, Rob.

January 26th, 2015 at 2:33 pm

hi Rob!

I’m doing research on Ergodic capacity maximization of cognitive Radio network with Quantized channel state information. I have few problems in matlab coding. I’m facing problem to calculate channel gain with feedback bit.

would you b able to help me please.

iwill be very thankful to you ..

January 26th, 2015 at 2:39 pm

hi maha !

i m also doing my research in cognitive radio, a relevent title as urs, I m aslo calculating optimum transmit power of secondary user with constraints with parial CSI ..

Can we be heplful for each other ??

nasir

January 27th, 2015 at 1:18 pm

Hi Nasir,

I’m afraid that I haven’t done much on cognitive radio or channel capacity for quantized channel state information. You might be able to use my DCMC capactity Matlab code as a starting point, but I’m not sure what the best approach for this would be.

Take care, Rob.

January 27th, 2015 at 3:56 pm

hi Rob,

Thank you so much for your cooperation. I got alot of help from your this page.

regads, nasir

February 12th, 2015 at 5:00 am

hi sir i want matlab code that gives the desisgn of channel such that it give varying snr values with random time intervel.

February 15th, 2015 at 10:05 am

Hi Pranav,

You are describing a fading channel. Simulation of these is built into the Communications toolkit of Matlab - you can read about this here…

http://uk.mathworks.com/help/comm/ug/fading-channels.html?refresh=true

Take care, Rob.

March 3rd, 2015 at 8:10 am

Hi Rob,

I used your code to plot the capacity of BPSK, QPSK and 16QAM star and 16 QAM square. Could you help me the equation to plot Shannon line for Rayleigh and AWGN channel.

Thanks.

kind regards…

March 3rd, 2015 at 5:49 pm

Hi Mat,

You can see code for plotting these lines in my comment above…

http://users.ecs.soton.ac.uk/rm/resources/matlabcapacity/#comment-5205

Take care, Rob.

March 4th, 2015 at 3:32 am

Thank you so much Rob.

Kind regards…

March 4th, 2015 at 5:44 pm

Hi Rob,

Thanks a lot for the explanation you have provided above. It is really helpful. Do you have any codes about DCMC capacity with MIMO channels for different channel distributions?

Thanks in advance

March 4th, 2015 at 7:08 pm

Hello Wang,

I’m afraid that I don’t have results for MIMO channels. My code could be modified to implement this though…

Take care, Rob.

March 6th, 2015 at 4:27 pm

Hello Rob,

Your explanation about DCMC capacity is highly appreciated. I think that eq. 23.23 of Hanzo’s book represents the boundary of modulation capacity with limited Symbol Error Rate, SER, as Shannon,s definition. How can define the bandwidth efficiency of certain modulation technique according to SER? Does this definition true [SE=log2(M)(1-SER)]. Could please provide me references about Spectral efficiency of modulation techniques?

March 6th, 2015 at 7:23 pm

Hi Hamed,

The bandwidth efficiency depends only on the design of the transmitter. The SER also depends on the channel and on the design of the receiver. Owing to this, the bandwidth efficiency is not a direct function of the SER. You may be talking about the maximum bandwidth efficiency that can achieve a particular SER in a particular channel, but I’m afraid that I don’t know of any references for this…

Take care, Rob.

March 21st, 2015 at 10:01 am

Hi Rob,

I plotted the capacity of 16 QAM star and square, both modulation schemes should have the same graph?

Thank you…

Kind regards…

March 22nd, 2015 at 7:45 pm

Hello Mat,

They should have slightly different DCMC capacities - I would expect that square 16QAM is superior for most SNRs.

Take care, Rob.

April 5th, 2015 at 12:02 pm

hi i need a matlab code to plot the capacity as a function of average SNR for log-normanl fading with 8db standard deviation ,Rayleigh fading and Nakagami fading with m=2. (regenerate the figure 4.6 , 4.7, 4.8 in wireless communication book for goldsmith)

April 8th, 2015 at 7:16 am

sir can you give me m file script for capacity vs snr , throughput vs snr ,cdf and pdf for 2×1 mimo ofdm system ..i m badly stuck in that ..

the thing is i m doing my project on simulink platform and thats why not able to write exact m file for simulink model for above mentioned plots.

plz plz help sir ..my mail id is ashuu.engg@gmail.com

April 8th, 2015 at 7:19 am

i can upload my mimo-ofdm simulink model and its m file for adaptive modulation i just need the formulae for capacity ,throughput ,cdf and pdf plots for my system ..

where i can upload ? plz let me know

April 9th, 2015 at 4:40 pm

Hi Sara,

I’m afraid that I don’t have Matlab code for plotting the capacity of log-normal fading or Nakagami-m fading. However, you should be able to modify my Rayleigh fading channel capacity code for this. The difficult part is getting the demodulator to accurately estimate the symbol probabilities - you may need to derive these probabilities from scratch. I’m afraid that I have never derived these probabilities, so I can’t help you with this.

Take care, Rob.

April 9th, 2015 at 4:47 pm

Hi Ashwini,

I’m afraid that I don’t have any Matlab code for the capacity of MIMO channels. I suspect that you will need to write a simulation in order to measure this capacity - I suspect that a closed-form expression cannot be easily found for the capacity of these channels. I’m afraid that I haven’t worked on the capacity of MIMO channels before, so I can’t help you with this.

Take care, Rob.

April 13th, 2015 at 7:25 pm

hello sir thanks for ur instant response..sir can u plz atleast suggest some book or website where i can get proper help for plotting various graphs for mimo ofdm system in simulink platform ???

plz help me sir …i m in bad need of some proper direction atleast..i m new to simulink and so unable to plot graphs with the scripts in m file

April 13th, 2015 at 7:26 pm

hello.sir can u plz atleast suggest some book or website where i can get proper help for plotting various graphs for mimo ofdm system in simulink platform ???

plz help me sir …i m in bad need of some proper direction atleast..i m new to simulink and so unable to plot graphs with the scripts in m file

April 15th, 2015 at 4:31 pm

Hi Ashwini,

I’m afraid that I’ve never used Simulink so I’m not really sure. It seems to me that this might be the best place to get started…

http://uk.mathworks.com/help/comm/ref/ofdmmodulatorbaseband.html

http://uk.mathworks.com/help/comm/ref/mimochannel.html

http://uk.mathworks.com/help/comm/ref/ofdmdemodulatorbaseband.html

Take care, Rob.

June 5th, 2015 at 11:29 am

HI i am really thankful to everyone here helping each other i really need help if some one can do that for me i want to plot the equations of the following paper….

Achievable Transmission Capacity of Relay-assisted

Device-to-Device (D2D) Communication Underlay

Cellular Networks

Si WEN, Xiaoyue ZHU, Yanchao LIN, Zhesheng LIN, Xin ZHANG, Dacheng Yang

specaily equation no..1,3 and 9

means SINR, Probability and capacity of the system

June 17th, 2015 at 2:11 pm

Hi sir

I want to plot the channel capacity of 8 PAM but the value of spectral efficiency is 2. It mean that i change the distribution of symbols 8 PAM.

How can I plot the channel capacity curve of this case?

June 22nd, 2015 at 4:23 pm

Hi Kas,

I’m afraid that I can’t help you with this, but perhaps somebody else reading this can.

Take care, Rob.

June 22nd, 2015 at 4:25 pm

Hi Minh,

I’m guessing that you are using a 2/3 rate code with 8PAM, in order to achieve a spectral efficiency of 2. In any case, the channel capacity curve is independent of the coding rate. You just need to plot the DCMC capacity curve for 8PAM by modifying my code above. Then you can use this to find the SNR where the capacity becomes equal to your spectral efficiency of 2.

Take care, Rob.

June 25th, 2015 at 4:03 am

Hi Rob,

trying to plot throughput vs snr plot for mimo ofdm using the formula t = r(1-ber) where r is code rate.

getting the graph but throughput scale is not starting with 0 .

can u suggest me something ??

or its just ok even if its not starting with zero.

also tried formula t=r*(1-ber)*log2(M)

BUT with that just the throughput value increased and yet not started from zero

June 25th, 2015 at 4:04 am

Hello everyone ,

is there anyone working on LDPC CODES ..

I WANT HELP REGARDING PLOTTING ITS BER

June 29th, 2015 at 12:55 pm

Hello Ashwini,

I’m afraid that I’m not familiar with the formula t = r(1-ber) - this looks like an equation for goodput, rather than throughput to me. I guess that you are not getting t = 0 because ber doesn’t go higher than 0.5.

Take care, Rob.

July 1st, 2015 at 10:01 am

I will be great full if anyone can help me please

July 31st, 2015 at 3:44 pm

Rob

please provide matlab code for power allocation in cognitive radio

July 31st, 2015 at 3:46 pm

dear Rob

matlab codes for waterfilling algorithm

August 13th, 2015 at 10:46 am

Hello Keshav,

I’m afraid that I don’t have any Matlab code for power allocation in cognitive radio, so I can’t help you.

Take care, Rob.

August 31st, 2015 at 4:58 pm

Hello Rob , thanks for your alwys instant replies .

can you suggest me the mathematical formula for 1] Throughput for MIMO systems 2] CDF formula and 4] LDPC Sparse matrix .

September 2nd, 2015 at 12:50 pm

Hi Ashwini,

My colleague Michael Ng has done lots of work on the throughput of MIMO systems. e.g.

http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1608632&tag=1

For LDPC parity matrix design, I would recommend the following paper…

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.125.2561

Take care, Rob.

September 15th, 2015 at 7:32 am

Thanks a lot Sir , really when i open internet with hopes to get solve my querries this is the place where i collect futher hopes to keep working as someone is helping.

thanks sir.

will look into the papers forwarded by you.

September 30th, 2015 at 1:28 pm

Dear Rob,

I was wondering if you can share with me any reference (book,web, paper) where it is explained why you can use the normalized euclidean distances as transition probabilities in a Gaussian Channel.

Thank you in advance,

Nikola

October 1st, 2015 at 10:00 am

Hi Tesla,

You can see this in “Bit-interleaved coded modulation with iterative decoding” by Xiaodong Li and James A. Ritcey in IEEE Communications Letters, as well as in some of their other work.

Take care, Rob.

October 7th, 2015 at 10:05 pm

Hi Rob,

Your code works very well but I don’t understand why I can not show it matches the capacity formula. In your code, if we consider A=P(y┃x,h)/P(y┃h), you somehow calculate integral of sum over x of A.log2(A). You know that the capacity is integral on x and h of sum over x of P(x,y,h).log(A). I wonder why yours works. Could you please explain me why A. log2 (A) works?

Thank you very much

October 8th, 2015 at 6:37 pm

Hello Hos,

I’m afraid that I’m not sure exactly. My histogram code is approximating equation (12) in “Convergence behavior of iteratively decoded parallel concatenated codes” by Stephan ten Brink (IEEE TCOM 2001). I wonder if that paper can help to answer your question. I would also suggest looking at “Extrinsic information transfer functions: Model and erasure channel properties” by Alexei Ashikhmin (IEEE TInfTheory 2004). This paper relates the EXIT chart to the capacity.

Take care, Rob.

October 8th, 2015 at 7:00 pm

Hi Rob,

Thank you very much. But in equation (12) in “Convergence behavior of iteratively decoded parallel concatenated codes” by Stephan ten Brink (IEEE TCOM 2001), he has P(y┃x,h).log[P(y┃x,h)/P(y┃h)] but you implemented P(y┃x,h)/P(y┃h).log[P(y┃x,h)/P(y┃h)] . Could you please check why this happened. I assume you used Trapezoidal rule for integration but how it simplifies to what you implemented is an important question for me?

Thank you very much

October 9th, 2015 at 11:54 am

Hi Hos,

I’m afraid that I don’t follow what you are saying. You are saying that the coefficient of my log term (you have called it P(y┃x,h)/P(y┃h)) is the same as the operand of my log term. But my code is using…

0.5*pdf(bit_value+1,bin_index)*log2(2.0*pdf(bit_value+1,bin_index)/(pdf(1,bin_index) + pdf(2,bin_index)))

The coefficient is pdf(bit_value+1,bin_index) and the operand is pdf(bit_value+1,bin_index)/(pdf(1,bin_index) + pdf(2,bin_index)). These are both different. I would argue that they are as Stephan ten Brink suggested.

Take care, Rob.

October 9th, 2015 at 6:27 pm

Dear Rob,

I really appreciate for your answers. To be on the same page, the link of your code is “http://users.ecs.soton.ac.uk/rm/wp-content/capacity.m” on top of the page. Please let me know if I make a mistake. In your code you are simulating probabilities = probabilities ./ (ones(length(modulation),1)*sum(probabilities));

This is what I mentioned as P(y┃x,h)/P(y┃h).log[P(y┃x,h)/P(y┃h)].

This is quite different from what Stephan ten Brink says. You are simulating the total mutual information of channel but Stephan ten Brink talks about bitwise mutual information of channel which is good for analyzing BICM schemes.

I’m afraid we are not on the same page. Please just check the file on top of this page.

Thank you very much.

October 9th, 2015 at 7:35 pm

Hi Hos,

Now I understand what you mean. The line you are referring to simply normalises the probabilities. This is necessary since the line above…

probabilities = max(exp(-(abs(ones(length(modulation),1)*rx - modulation.’*channel).^2)/N0),realmin);

…produces a matrix in which the columns do not add up to 1. Once we have normalised probabilities, the capacity can be calculated according to…

channel_capacity = log2(length(modulation))+mean(sum(probabilities.*log2(probabilities)));

…where the term on the right is the average of the entropy corresponding to each column of the probabilities matrix.

Does that make sense?

Take care, Rob.

January 17th, 2016 at 3:33 am

Hi Rob,

Could you please tell me how you plotted the Shannon curve? I tried to plot using the code you’ve mentioned in the above comments. I got a straight line cutting the x-axis. Can you tell me how you got a curve instead of a straight line?

Thanks

January 17th, 2016 at 3:39 am

Hi Prathysusha,

It should just be as simple as copying the commands from my comment above (http://users.ecs.soton.ac.uk/rm/resources/matlabcapacity/#comment-5205) into Matlab.

Take care, Rob.

January 27th, 2016 at 5:57 am

Hi Rob ,

how about the throughput graph for adaptive modulation ? could we make it ?

January 27th, 2016 at 6:04 am

I think that i could make it for the adaptive modulation with switching the condition based on the value of SNR

and could I get the code for througthput DCMC capacity ?

thank you so much

January 29th, 2016 at 9:41 pm

Hi Icha,

The DCMC capacity curve gives the upper bound for the achievable throughput, which can be fulfilled by combining the modulation with a well designed turbo or LDPC code, for example.

To get a plot of throughput versus SNR for adaptive modulation, you need to run simulations to find the SNR where you achieve the target BER for each modulation mode. The throughput of the modulation mode is just eta = R*log2(M), where R is the coding rate of your channel code and M is the number of constellation points in your modulator. So, for each modulation mode, you will have a throughput and an SNR. You just plot each of these pairs as points in the plots above.

Take care, Rob.

February 20th, 2016 at 6:49 pm

Sir How can we do simulation in matlab for multipath mimo channel b/w legitimate nodes and eavesdropper to calculate secure bits from the legitimate channel…… plotting bit/channel realization vs number of paths for a given snr?

February 20th, 2016 at 7:18 pm

Hi Adil,

Thank you for your interest in my work, but I haven’t worked on physical layer security before, so I’m afraid that I am unable to help you with this.

Take care, Rob.

March 2nd, 2016 at 4:11 am

Dear Rob,

Thanks for your clarifications,my question concentrate about the maximization of Mutual Information using probabilities {c=max I(X,Y)} ,How I can draw it using transition probability?

March 4th, 2016 at 12:44 pm

Hello F.Wang,

I’m afraid that I’m not sure what you are asking. You can find a discussion of the capacity of binary symmetric channels on Wikipedia…

https://en.wikipedia.org/wiki/Binary_symmetric_channel#Capacity_of_BSCp

Take care, Rob.

March 5th, 2016 at 1:27 pm

Thanks Rob,

My aim is not the BSC Channel ,is a broadcast AWGN Channel for 2 users ,using your script and form mutual information point of view I want to compute

C= max I(X,Y1)-I(X,Y2) . Any hint ?

Best Regards

March 7th, 2016 at 1:50 pm

Hi F.Wang,

I’m afraid that I haven’t worked on the channel capacity for multi-user scenarios, so I don’t have any hints to offer unfortunately.

Take care, Rob.

March 10th, 2016 at 7:17 pm

Thanks Rob; can you help me plotting capacity vs number of paths?

March 13th, 2016 at 10:55 am

Hi Adil,

I’m afraid that I haven’t worked on the capacity for dispersive channels before.

Take care, Rob.

March 13th, 2016 at 6:56 pm

I have question bout how we can find the analytical expression for the capacity of four point constellation input which are uniform placed.

March 14th, 2016 at 3:49 pm

Hi Majeed,

I’m afraid that I am not aware of a closed-form analytic expression for the DCMC capacity of QPSK (which is what I think you are asking for). I have only ever calculated the capacity using the heuristic method provided in my Matlab code on this webpage.

Take care, Rob.

March 24th, 2016 at 2:49 pm

Hello Rob,

The whole post is really interesting. I am consider a QAM constellation with geometric shaping. So some of the symbols in the constellation are eliminated, and some are assigned two binary labels (i.e. the transmission probability is double for some symbols).

Do you think that this must be taken into account when calculating the average transmit power? (I think it must).

Thanks

March 26th, 2016 at 8:17 pm

Hi Ecace,

Yes - you should take this into account when calculating the average transmit power.

Take care, Rob.

April 12th, 2016 at 4:46 pm

Dear Rob,

After long time, I am contacting. Can I use rician channel parameter instead of rayleigh fading using the following code;

Let mu = sqrt( K/(2*(K+1)) ) and s = sqrt( 1/(2*(K+1)) )

r = ( s*randn(1,10000 ) + mu ) + j*( s*randn(1,10000 ) + mu );

R = abs(r);

April 13th, 2016 at 7:54 am

Dear Rob,

I was saying that for the ricican channel, we can replace channel in your matlab script by R as in the above code;

Let mu = sqrt( K/(2*(K+1)) ) and s = sqrt( 1/(2*(K+1)) )

r = ( s*randn(1,10000 ) + mu ) + j*( s*randn(1,10000 ) + mu );

R = abs(r);

so channel = R; for the Rician channel over a value of K.

April 25th, 2016 at 9:50 am

Hi Ideal,

If you replace the channel, then you will also need to replace the calculation of the symbol probabilities in the receiver - these are used as the basis of the MI and capacity measurement. I’m afraid that I haven’t done this for the Rician channel before, but I suspect that it would not be too difficult to derive…

Take care, Rob.

May 3rd, 2016 at 8:21 am

Hi Rob,

Thanks for the answer,

Can you provide any reference for the calculation of MI curves assuming the Rician channel? i want to derive that…

May 6th, 2016 at 8:59 am

Hello Ideal,

The closest reference that I can find is…

http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=595031

However, my suggestion would be to figure out how to derive the symbol probabilities for the case of Rayleigh fading, then apply the same process but for Rician fading.

Take care, Rob.

June 14th, 2016 at 3:53 pm

Hi Rob, thanks for your code. I have a question, this capacity computed considers the modulation, but not the channel coding. If I want to compute the AWGN channel capacity for channel coding rates R_c with BPSK modulation, can I just modify \"N0 = 1/(R_c*10^(snr/10));\"? I also saw someplace that the capacity is given by 1/2*log2(1+2Es/N0), is this correct?

Thank you very much.

June 15th, 2016 at 8:27 pm

Hi Huihui,

The DCMC capacity depends only on the nature of the input and output of the channel. In other words, it depends on the modulation scheme because this determines the input to the channel. But it doesn’t depend on the channel code.

Having said that, the conversion from SNR to Eb/N0 does depend on the channel code:

Eb/N0 = SNR/(R*log2(M))

SNR = 10^(SNRdB/10)

where R is the coding rate of the channel code and M is the number of constellation points (2 for BPSK).

The equation you have given is for a variant of the Shannon capacity, which assumes a Gaussian input to the channel (rather than a BPSK input to the channel).

Take care, Rob.

June 16th, 2016 at 1:57 pm

Hi Rob,

Thanks very much for sharing your code.

I have a question on the 16AQM part. In order to normalise the transmitted symbols, you have simply added a factor 1/sqrt(10). shouldn\’t we normalise them one by one? I mean 1/sqrt(18)*(3 + 3i), 1/sqrt(10)*(3 + i), 1/sqrt(2)*(1 + i), and so on. I am really confused. Looking forward to your response.

June 16th, 2016 at 2:34 pm

Hi Chris,

If you normalise them one by one, then you will end up with constellation points on top of each other. In your example you have 1/sqrt(18)*(3 + 3i) and 1/sqrt(2)*(1 + i), but these two complex numbers are identical. We need to normalise the *average* symbol energy, not the instantaneous symbol energy. In this way, the average energy will be 1, even though the instantaneous energy can vary from 2/10 up to 18/10.

Take care, Rob.

June 16th, 2016 at 3:11 pm

Hi Rob,

Thanks for your rapid response and your explanation. I noticed where I am wrong. I read above comments and figure out that we can use 1/sqrt(mean(abs(mod.Constellation).^2)) to normalise the *average* symbol energy. However, I think this applies only when the symbols are equiprobalbe. For example, 1/sqrt(10) normalises the 16QAM symbols when they are equiprobable. But when they are not equiprobable, we have to normalise them with a different number other than 1/sqrt(10). Am I right?

June 28th, 2016 at 7:38 pm

Hi Chris,

If the symbols are not equiprobable, then you need to weight their energies accordingly.

Take care, Rob.

September 9th, 2016 at 8:52 am

Hi Rob,

Can you explain me the equation of these 2 channels m and p using Rayleigh , and how to plot it in matlab, i kinda lost in here…

help me please!

∁ =F(γ_m )- F((γ_m.γ_p)/(γ_m+γ_p ))

F_x=∫_0^∞▒〖log(1+4)1/x〗 e^((-4)/x) d4 = e^(1/x) E_1 (x^(-1))1/log2

Regards,YnI.

September 10th, 2016 at 10:43 pm

Hello Yni,

I’m afraid that I don’t have any Matlab code for those equations - they are not ones that I have used in my work.

Take care, Rob.

November 26th, 2016 at 5:27 am

Hi Rob,

I have BER data, how to convert that into capacity of the channel. Please give me matlab code

thanks,

bye

November 27th, 2016 at 10:14 pm

Hello Nel,

I’m afraid that BER data cannot be converted into the capacity of the channel. BER depends on the whole system. CCMC capacity depends only on the channel, while DCMC capacity depends only on the channel and the modulation scheme.

Take care, Rob.

January 19th, 2017 at 7:48 am

Hello Rob Sir,

Can you mail me the codes of above graphs. AWGN channel capacity,Uncorrelated Rayleigh Fading Channel capacity and corresponding graphs.

Thanks and Regards,

SHIVANGI ATREY

January 19th, 2017 at 8:32 am

Hi Shivangi,

You can find the code in one of my comments above…

http://users.ecs.soton.ac.uk/rm/resources/matlabcapacity/#comment-5205

Take care, Rob.

January 20th, 2017 at 5:56 am

Hello Rob Sir,

I am working to simulate Average Spectral Efficiency V/S Average SNR graph in MIMO OSFBC-OFDM system with the help of this paper which is given below,

http://ieeexplore.ieee.org/document/5361409/

But there is a lots of issues.If you have worked on this paper then please give me some guidance.

Thanks and Regards,

SHIVANGI ATREY

January 20th, 2017 at 9:53 am

Hello Shivangi,

I’m afraid that I haven’t worked on the capacity for MIMO, so I can’t help you with this.

Take care, Rob.

March 1st, 2017 at 10:03 am

Hi Rob,am working on PM-16QAM(capacity of 8),which is basically two 16QAM unions. I have changed the modulation = sqrt(1/20)*[-3-3*i, -3-3*i,…. however may graph still reads Capacity of 4,what parts show i change?Please offer me some guidance..

March 1st, 2017 at 6:32 pm

Hi Enock,

Can you express the union with 256 constellation points? I think that this would work.

Take care, Rob.

March 5th, 2017 at 9:47 am

Hi, Rob, thank you very much for sharing the code!

I want to get the Goodput vs Receiver Es/N0(5-30dB) curves of the adaptive modulation and coding (AMC) in IEEE 802.11a standard. Specifically speaking, four modulation schemes, namely BPSK, QPSK, 16-QAM and 64-QAM, are used. And, convolutional codes with coding rate 1/2 (2/3 for 64-QAM) and 3/4 are adopted. In total, there are eight modulation and coding combinations. And, an AWGN channel is used. How can I get those curves?

Do you have any codes about that ? (if you have, could you please E-mail the code to me?) Thank you again!

March 6th, 2017 at 3:50 pm

Hi William,

I’m afraid that I don’t have code for generating those curves. But you can obtain them by simulating each combination and measuring the goodput as a function of the channel SNR. Then, for each SNR, you pick the combination that has the best goodput.

Take care, Rob.

March 22nd, 2017 at 3:33 pm

Hi Rob, i am trying to plot the channel capacity of msk.

what will be the modulation of msk in constellation form as you have done for the the various psk.

March 24th, 2017 at 9:48 am

Hello Jerry,

I haven’t looked at the capacity curve for MSK before, but I suspect that this will be similar to that of QPSK, since both MSK and QPSK give the same BER vs Eb/N0 curve for coherent detection. In Simon Haykin’s book “Digital Communication Systems”, he includes a constellation diagram for MSK that matches the QPSK constellation diagram.

Take care, Rob.

March 27th, 2017 at 3:30 pm

Hey Rob,

Thanks a lot for posting this, it’s very helpful. I’ve read through the comments above and I’m specifically trying to plot the channel capacity/throughput of an adaptive modulation scheme vs. each constant modulation scheme. I already have simulations to determine SNR thresholds based on a minimum BER constraint. Could I just use the code you have provided here to calculate capacity at each SNR value and adjust the modulation according to the thresholds I have calculated?

Also, I’d like to calculate capacity over a Rician channel as well. I know in previous comments you had suggested to figure out how symbol probabilities are calculated in Rayleigh fading, then apply the same technique to Rician. Do you have an equation for symbol probabilities in Rician fading or any resources where I can find one to modify in your code?

Thanks,

Joe

April 12th, 2017 at 7:46 am

Hi Joe,

That’s right - you can plot the capacity curves for each modulation scheme separately then get the overall performance for the adaptive modulation scheme by taking the best of the individual modulation schemes at each SNR.

You can replace the Rayleigh channel model in my code with a Rician channel model. My code uses a heuristic approach, so there is no need to change any of the other equations. However, in one of the comments above, I have provided analytic expressions for the DCMC capacity of a Rayleigh fading channel - I suspect that a similar equation could be derived for a Rician channel, but I haven’t done this before.

Take care, Rob.