1.代码
% check if the weight has the same size as psiif (~all(size(weight) == size(psi)))error('Argument error: Size of the weight must be the same as size of the wrapped phase');end%论文(公式 15)中的矢量 b 为 dx 和 dy% vector b in the paper (eq 15) is dx and dydx = [wrapToPi(diff(psi, 1, 2)), zeros([size(psi,1),1])]; % 计算x差分dy = [wrapToPi(diff(psi, 1, 1)); zeros([1,size(psi,2)])]; % 计算y差分% 将向量 b 乘以权重平方 (W^T * W)% multiply the vector b by weight square (W^T * W) 将向量 b 乘以权重平方 (W^T * W)WW = weight .* weight;WWdx = WW .* dx;WWdy = WW .* dy;%对 WWdx 和 WWdy 应用 A^T 就像在非加权情况下获得 rho 一样% applying A^T to WWdx and WWdy is like obtaining rho in the unweighted caseWWdx2 = [zeros([size(psi,1),1]), WWdx];WWdy2 = [zeros([1,size(psi,2)]); WWdy];rk =