How to express integration of mutual information in MATLAB?
Show older comments
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
Walter Roberson
on 9 Aug 2013
Is it exp(-(y-1)^2)/4 or is it exp(-(y-1)^2/4) ?
Rana
on 10 Aug 2013
Walter Roberson
on 10 Aug 2013
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.
Answers (1)
Andrei Bobrov
on 9 Aug 2013
Edited: Andrei Bobrov
on 9 Aug 2013
f = @(y) exp (-(y - 1) .^ 2 / 4) .* log2 (1 + exp (-y));
out = integral(f,-100,inf);
or
out = quadgk(f,-100,inf);
2 Comments
Rana
on 12 Aug 2013
Walter Roberson
on 12 Aug 2013
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.
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!