%function rho = MAP_norm(unnorm_controls,alpha,t) % takes as input the unnormalized control data, and regularization parameters alpha and t % returns the normalization constants (as log values) function rho = MAP_norm(unnorm_controls,alpha,t) [M,N] = size(unnorm_controls); %#rows = #controls, #col = #expt %set the initial parameters: newrho = zeros(1,N); %matrix containing zeros, our initial estimate of norm constants rho = ones(1,N); %matrix containing ones, to ensure our loop runs the first time while max(abs(rho-newrho))>0.000001 %calculates rho to a precision of 0.000001 rho = newrho; %sets the old value = new value %!YOUR CODE HERE - you need to duplicate your code for ML_norm, %!just changing the equation for calculation of sigma2 end rho = newrho; %best estimate of normalization constants return