% Adds noise to a synthetic image
% Computes the SNR(u0/u)=signal-to-noise-ratio
% image dimensions
M=100;
N=100;
% factor coefficient of the noise in u0(i,j)=u(i,j)+k*noise(i,j)
% small k (less noise) => larger SNR
% large k (more noise) => smaller SNR
% remove noise by maximizing the SNR
k=20;
% construct an original synthetic image u(i,j)
for i=1:M,
for j=1:N,
u(i,j)=125;
if 40