-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSBLU.m
More file actions
22 lines (22 loc) · 808 Bytes
/
Copy pathSBLU.m
File metadata and controls
22 lines (22 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function mu = SBLU(Y,A,noise,convergence,tMax)
% Y = A*mu + n, n~Normal(0,Delta^2), Delta is estimated from noise.
% convergence is the error threshold, when the difference of adjacent gamma
% is smaller than convergence value, we treat it as convergence.
% tMax is the max number of iteration.
Delta = sqrt((noise'*noise)/length(noise));
gamma0 = ones(width(A),1);
for i=1:tMax
% E-step
variance = (Delta^(-2).*(A'*A)+diag(1./gamma0))^(-1);
mean = Delta^(-2).*(variance*A'*Y);
% M-step
gamma = mean.*mean+diag(variance);
% check the convergence
if norm(gamma-gamma0,2)/norm(gamma0,2) < convergence
break;
end
gamma0 = gamma;
end
% compute the final mu.
variance = (Delta^(-2).*(A'*A)+diag(gamma)^(-1))^(-1);
mu = Delta^(-2).*(variance*A'*Y);