function mutInfo = mutInfo(jointDistribution)
  xMar = xMargin(jointDistribution);
  yMar = yMargin(jointDistribution);

  rows = size(jointDistribution, 1);
  cols = size(jointDistribution, 2);

  sum = 0;
  for x = 1 : cols
    for y = 1 : rows
      if(jointDistribution(y, x) == 0)
        continue
      end
      sum = sum + jointDistribution(y, x) * (log2(double(jointDistribution(y, x)) / double(xMar(x) * yMar(y))));
    end
  end
  mutInfo = sum;
end
