% ML cost function for Gaussian h
%
%
function cost = get_Gauss_ML_cost( b)

global z;
global N;
global var_noise;
global avg_h;
global Rh;

A = get_A_C( b);
  
cost = 0;

for k = 1:N

  t = A(k,:)';

  sk = var_noise + t'*(Rh*t);

  t = z(k) - t'*avg_h(:,k);

  cost = cost + t*t/sk + log(sk);
end
