polya_fit_ms.m

来自「关于室内定位的算法」· M 代码 · 共 42 行

M
42
字号
function a = polya_fit_ms(data, a, weight)% POLYA_FIT_MS   Maximum-likelihood Polya distribution.%% Same as POLYA_FIT but uses alternating optimization for M and S.% DATA is a matrix of histograms, oriented the same way as A.% Written by Tom Minkaif nargin < 2  a = polya_moment_match(data);end% alternate between polya_fit_m and polya_fit_suse_weight = (nargin >= 3);row = (rows(a) == 1);if row  N = rows(data);  if ~use_weight    weight = ones(N,1);  endelse  N = cols(data);  if ~use_weight    weight = ones(1,N);  endends = sum(a);for iter = 1:10  old_s = s;  a = polya_fit_m(data, a, weight);  m = a/s;  a = polya_fit_s(data, a, weight);  s = sum(a);  if ~finite(s)    s = 1e7;    obj.a = s*m;  end  if abs(s - old_s) < 1e-4    break  endend

⌨️ 快捷键说明

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