forked from Craigacp/MIToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mi.m
23 lines (22 loc) · 557 Bytes
/
mi.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function output = mi(X,Y)
%function output = mi(X,Y)
%X & Y can be matrices which are converted into a joint variable
%before computation
%
%expects variables to be column-wise
%
%returns the mutual information between X and Y, I(X;Y)
if (~isa(X,'double') || ~isa(Y,'double'))
error('Error, inputs must be double vectors or matrices')
end
if (size(X,2)>1)
mergedFirst = MIToolboxMex(3,X);
else
mergedFirst = X;
end
if (size(Y,2)>1)
mergedSecond = MIToolboxMex(3,Y);
else
mergedSecond = Y;
end
[output] = MIToolboxMex(7,mergedFirst,mergedSecond);