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语言的版本,不甚感激
%%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语言的版本,不甚感激
...全文
相关推荐
MATLAB GUI
MATLAB揭秘修订版 自学指导书 郑碧波译 2010年.pdf
MATLAB库函数unwrap(相位解卷绕)的C语言实现
什么是相位解卷绕 Q = unwrap(P) Q = unwrap(P) corrects the radian phase angles in a vector P by adding multiples of ±2π when absolute jumps between consecutive elements of P are greater than or equal to the default jump tolerance of π radians. If P is a matrix, unw
C语言调用MATLAB生成DLL的完整实现与实战
MATLAB Compiler(MCC)并非将.m文件直接翻译为C代码,而是将其封装为独立的库或可执行文件,并依赖MATLAB Runtime(MCR)进行运行。在编译过程中,MCC首先将.m函数转换为中间表示形式,随后打包为C++兼容的动态链接库(DLL),同时生成对应的头文件(.h)和导入库(.lib)。该过程涉及依赖项分析、函数入口封装及平台适配,确保生成的DLL可在无MATLAB环境的目标机器上运行。// 示例:由mcc生成的头文件函数原型上述mxArray。
【MATLAB教程案例91】将MATLAB程序转化为C语言
将MATLAB程序转化为C语言是一项复杂的任务,因为MATLAB和C语言在语法、数据结构和功能方面有很大的差异。这个过程通常称为“代码生成”或“代码翻译”。
matlab简体中文汉化包R14(7.0)
一款matlabR14(7.0)版本的汉化包,希望可以帮助到大家。


其他开发语言
