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

📄 vector_quant.m

📁 this code is in Matlab.and this code od for Speaker recognitoin system.
💻 M
字号:
function b = vector_quant(v,no_centroids)


% v:            speech vectors ,mel scaled.
% no_codebook:  no.of centroids reqd. Here k=16.
% b:            Codebook generated
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Speaker Recognition System                        %
%                                                     %
%   Project mmembers: (1)  Habib ur Rehn=man          %
%                     (2)  Abdul Basit                %   
%   Date:   12-05-2003                                %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

no_update=5 ;                     %no of updates
c=mean(v,2)  ;                    % finding initial codebook
e = 0.01 ;                        % splitting parameter
c(:,1)=c(:,1) + c(:,1)*e ;        % splitting the codebook into 2.
c(:,2)=c(:,1) - c(:,1)*e;
for up1=1:no_update;
d=euclid_dist(v,c);               % calculating the  euclidean distance.
[m,id]=min(d,[],2);               % finding the minimum distance.
[rows,cols]=size(c);

for j=1:cols;

   c(:,j)=mean(v(:,find(id==j)),2);  % finding the centroid of the new cluster.

end;
end     %update end
n=1;n=n*2;

while cols < no_centroids  ;                 % updating the code book to get the reqd. no.

     for i = 1:cols ;                 % of code vectors.

        c(:,i)=c(:,i) + c(:,i)*e;
        c(:,i+n)=c(:,i) - c(:,i)*e;
     
     end;
     
     for up2=no_update  %update2
     d=euclid_dist(v,c);          % calculating the  euclidean distance  

     [m,i]=min(d,[],2);           % finding the minimum distance

     [rows,cols] = size(c);

       for j=1:cols;
          
      c(:,j)=mean(v(:,find(i==j)),2);  % finding the centroid of the new cluster

       end;
   end %end update2
     n=n*2;
 end
b=c;


   

⌨️ 快捷键说明

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