⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdncb0.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
 % Function : search the optimal stochastic codeword. 
 % Input :
 %	s = speech signal.
 %	ncofa = LP coefficients.
 % Output :
 %	nidx = index of the optimal codeword.
 
 %                     Auther: Dr. Hu
 %                     Modified by Albert Hsiao  10/4/96

 function nidx=findncb0_h(s,ncofa,nc0,Rnc0);

 %load nc;  % where "nc.mat" stores the entire codebook
 N=length(s);  % length of each codeword = 50

 if N~=50
     s=interpft(s,50);
     N=50;
 end

 % Following performs the codeword searching using the autocorrelation method.
 % For details, please refer to Section 4.1.4.2.2 of Hu's dissertation.

 h=filter(1,ncofa,impulse(N));
 Rh=xcorr(h);
 Rh1=Rh(N:N*2-1)';
 Rh2=[0 Rh(N-1:-1:1)];
 Rhh=Rh1'+Rh2;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 lo1=xcorr(h,s);   
 % The positions of the arguments of this command has to be switched as
 % "xcorr(s,h)" for old Matlab (e.g. version 3.5 or older).
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 lo=lo1(N:N*2-1);
 for k=1:length(nc0)
 	gm1(k)=(lo*nc0(k,:)')/(Rhh*Rnc0(k,:)');
 	gamma1(k)=(lo*nc0(k,:)')*gm1(k);
 end;

 [mag, nidx]=max(gamma1);

 % Adjust the gain to match the power of the analyzed signal if necessary.
 % See Section 4.3.2 for explanation.
 %if autoc1(s)>.2
 %	gm=gm1(nidx);
 %else
 %	gm=sign(gm1(nidx))*sqrt((s*s')/(Rhh*Rnc0(nidx,:)'));
 %end;
	

⌨️ 快捷键说明

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