How to express integration of mutual information in MATLAB?

Hello,
I am currently working on a project where I have to plot the exit chart of the mutual information exchanged between two entities. The following function is necessary:
J = integral [-inf,inf] {e^(-(y-1)^2/4)*log2(1+e^-y)}dy
However, I am having a hard time trying to code it in MATLAB.
Can anyone please tell me the necessary lines needed in code to do this?

3 Comments

Is it exp(-(y-1)^2)/4 or is it exp(-(y-1)^2/4) ?
It's exp(-(y-1)^2/4). I apologize for the typo.
It appears there is no (obvious) closed-form solution for that. (Perhaps there is a change of variable that could be done, but I could not see it.) You will likely need to use numeric integration like Andrei shows.

Sign in to comment.

Answers (1)

f = @(y) exp (-(y - 1) .^ 2 / 4) .* log2 (1 + exp (-y));
out = integral(f,-100,inf);
or
out = quadgk(f,-100,inf);

2 Comments

The original integral is as a function of u: f = @(y) exp (-(y - u) .^ 2 / (4*u)) .* log2 (1 + exp (-y)); result_u = (1/sqrt(4pi*u)) * int(f,-inf,inf);
However, the plot is showing otherwise.
The plot of what? For any given u, there is only a single result_u . Are you plotting over a range of u? If so, what range? What result are you getting that shows that it is not a function of u? Show your code.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Asked:

on 9 Aug 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!