Matlab函数求C翻译
function e_DOF = EDOF(W, O, L, K)
%%e_DOF = EDOF(W, O, L, K)
% Calculate equivalent degrees of freedom
% W(x, L) is window function, devined over [0, L-1], and is zero every else
% O is overlap, 0<O<1 (1 = 100% overlap)
% L is block size, in number of samples
% K is average number
D = floor((1-O)*L); % offset of subsequent frames, in no. of samples. Rounded to nearest integer
rho_ = [];
k_ = 0:L-1;
j_ = 1:K-1;
for j = j_
rho_ = [rho_, sum(W(k_, L).*W(k_+j*D, L))^2/sum(W(k_, L).^2)^2]; %correlation coef. of W
end
varP = 1/K*(1+ 2*sum((K-j_)/K.*rho_)); %variance of spectral estimator
e_DOF = 2/varP; %E.D.O.F. = 2 * E[P(f)]^2 / var[P(f)]
end
本人对Matlab并不熟悉,请各位大大对这个DOF函数给出一个C语言的版本,不甚感激