weibmom.m

来自「rang doppler imaging and motion compensa」· M 代码 · 共 52 行

M
52
字号
function [bh,ah] = weibmom(x);

% Estimation of Weibull parameters using the
% method of moments.

[n1 n2] = size(x);

n = n1*n2;

x = reshape(x,n,1);

m1 = (1/n)*sum(x);    % First moment
m2 = (1/n)*sum(x.^2); % Second moment

div = (m1^2)/m2;

% Generate gamma table
% See I. Olkin, L. J. Gleser, and C. Derman 
% Probability Models and Applications
% Macmillan. p. 281.

z = 0:0.001:0.99;

table = ((gamma(1+z)).^2)./(gamma(1+2*z));

% Find closest value

tt = abs(div-table);
[val ind] = min(tt);

% Interpolate teh values in table
% using linear interpolation

if abs(div-table(ind+1)) > abs(div-table(ind-1)) 
 xx = [z(ind) z(ind-1)];
 yy = [table(ind) table(ind-1)];
else
 xx = [z(ind) z(ind+1)];
 yy = [table(ind) table(ind+1)];
end

penbe = polyfit(xx,yy,1);

bh = (div-penbe(2))/penbe(1);
bh = 1/bh;

% Compute the other parameter

ah = ((gamma(1+(1/bh)))^2/m1)^bh;


⌨️ 快捷键说明

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