align.m

来自「包含大量遗传算法程序」· M 代码 · 共 22 行

M
22
字号
function kpc=align(f)
%ALIGN  Real alignment
%       ALIGN(F) return a constant matrix KPC which minimizes
%       the least squares error of
%       f*kpc - diag(exp(sqrt(-1)*ai))
%       over both the elements of kpc and the phases ai.

%       Dr M.P. Ford 15th September 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
%       MRN0039

if rcond(f) < eps,
  error('Input to ALIGN too close to singularity.')
end

ff=f'*f;
rff=real(ff);
x=f*(rff\conj(ff'))*(rff\conj(f'));
p=angle(diag(x))/2;
kpc=rff\(real(f'*diag(exp(sqrt(-1)*p))));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?