?? dratio.m
字號(hào):
function D=Dratio(x)
%this procedure is to calculate the d ratio of the speech signal,which is important in speaker recogniton and speech recognition
% input--- x is a struct array variable, cluding m persons feature matrix f(n*k), x(i).f
%thereinto, n indicate speech number, k indicate feature vector dimension
%output---D is d ratio of the input x which is a speech signal
[n,m]=size(x);% n is equal to "1", and m indicate the speakers number
%calculate W
n
m
for i=1:m
[n,k]=size(x(i).data);
u(i,:)=mean(x(i).data);
for j=1:n
xu=x(i).data(j,:)-u(i,:);
y(i).z(j).a=xu'*xu;
end
summ=0;
for j=1:n
summ=summ+y(i).z(j).a;
end
y(i).b=summ/n;
end
sumb=0;
for i=1:m
sumb=sumb+y(i).b;
end
W=sumb/m;
%calculate B
Bv=cov(u);
uu=mean(u);
for i=1:m
ud=u(i,:)-uu;
y(i).c=ud'*ud;
end
sumc=0;
for i=1:m
sumc=sumc+y(i).c;
end
B=sumc/m
%calculate D
D=trace(W^(-1)*Bv);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -