Code covered by the BSD License  

Highlights from
Mutual Information

1.0 | 1 rating Rate this file 23 Downloads (last 30 days) File Size: 1.33 KB File ID: #28694

Mutual Information


Will Dwinnell


12 Sep 2010 (Updated )

Calculates the mutual information between two discrete variables (or a group and a single variable).

| Watch this File

File Information

MutualInformation: returns mutual information (in bits) of discrete variables 'X' and 'Y'

  I = MutualInformation(X,Y);
  I = calculated mutual information (in bits)
  X = variable(s) to be analyzed (column vector)
  Y = variable to be analyzed (column vector)
  Note 1: Multiple variables may be handled jointly as columns in
    matrix 'X'.
  Note 2: Requires the 'Entropy' and 'JointEntropy' functions.

MATLAB release MATLAB 6.0 (R12)
Other requirements Requires JointEntropy and Entropy functions.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
05 Jul 2014 Mohammad Haghighat

Mohammad Haghighat

02 Jul 2014 Batuhan


Those who cannot find Entropy.m and JointEntropy.m files should search the Matlab File Exchange. These files ara available there, by the same author.

Comment only
04 Jun 2013 Debanjan


where can I find the 'Entropy' and 'JointEntropy' functions? The Mutual Information does not seem to run without these functions

Comment only
04 Jan 2013 Will Dwinnell

Will Dwinnell

By "discrete", I mean integer values (intended to act as codes for distinct symbols).

Comment only
03 Jan 2012 Will Dwinnell

Will Dwinnell

This routine is intended for use with discrete variables, not continuous ones.

Comment only
02 Jan 2012 Jun


I am not sure if I run the code right or there is a bug in the code.

I ran the following and got the answers below. Does not seem right to me. A and B are completely independent random numbers, which I verified.

>> A=rand(1,100);
>> B=rand(1,100);
>> MutualInformation(A',A')

ans =


>> MutualInformation(B',B')

ans =


>> MutualInformation(A',B')

ans =


Comment only
06 Dec 2010 Marcello Costa

Marcello Costa

Good Job

Comment only
03 Jan 2012

I have updated the description to clarify the use of this routine.

Contact us