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

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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 8월 9일
편집: Andrei Bobrov 2013년 8월 9일
f = @(y) exp (-(y - 1) .^ 2 / 4) .* log2 (1 + exp (-y));
out = integral(f,-100,inf);
or
out = quadgk(f,-100,inf);

댓글 수: 2

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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

질문:

2013년 8월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by