lossy = laplace; for k=1:6 height = size(lossy(:,:,1),1); width = size(lossy(:,:,1),2); threshold = max(max(laplace(:,:,k))); for i=1:height/(2^(k-1)) for j=1:width/(2^(k-1)) if laplace(i,j,k) < threshold lossy(i,j,k) = 0; end end end end