ftrkpl.m

来自「这是一个用于语音信号处理的工具箱」· M 代码 · 共 92 行

M
92
字号
% Function : plot the formant track on figure(Fchek_f) 
%    It has the following features:
%     (1) shifts the display to the left by npts when sf_LR=1; reverse if sf_LR=-1.
%     (2) zoom in or out using zscale to scale. Zoom in if z_IO==1; reverse if z_IO=-1
%    

figure(Fchek_f);

   %--------------%
   % SHIFT EFFECT %
   %--------------%

if sf_LR~=0
   % get the number of shift points
   shframes=str2num(get(shift_frms,'String'));
   nframe2=Rite-Left;

   % set the region, [Left Rite]

   if sf_LR == 1 % shift to left
        Left=max(Left-shframes,1);
        Rite=Left+nframe2;
   elseif sf_LR == -1 % shift to right
        Rite=min(Rite+shframes,nframe);
        Left=Rite-nframe2;
   end;
   sf_LR=0;
end
    %-------------%
    % ZOOM EFFECT %
    %-------------%

if z_IO~=0
   
   % get the zooming factor
   zscale=str2num(get(zm_zscale,'String'));  % zscale == zooming scale

   % locate the region where we want to zoom in by using the mouse
   if z_IO==1
      [str_p y]=ginput(1); % str_p is current x coordinate of mouse position
      str_p=round(str_p);
   elseif z_IO==-1
      str_p=round( (Left+Rite)/2 );
   end


   % calculate the length of the signal to plot
  if exist('nframnow')==0
     nframnow=nframe; % nframnow== the length of the signal displayed in the figure
  end

  if z_IO == 1 % zoom in
	nframnow=round(nframnow/zscale);
        if nframnow>40
           nframnow=40; % show 40 frames at most
        end
  elseif z_IO== -1 % zoom out
	nframnow=round(nframnow*zscale);
  end;

  % Set the range, [Left Rite], to display signal.

  Left= max([str_p-floor(nframnow/2) 1]);
  if Left == 1
	Rite= min([nframnow nframe]);
  else
	Rite= min([str_p+floor(nframnow/2) nframe]);
  end;
  if Rite == nframe
	Left=max([1 nframe-nframnow]);
  end;
  z_IO=0;
  set(shift_lft,'Visible','on');
  set(shift_rght,'Visible','on');
end

   %------------------------%
   % plot the formant track %
   %------------------------%

plot(Left:Rite,FF0(Left:Rite,:),'k' );hold on

frm=find(vctyp0>0);
frm=frm( frm>=Left & frm<=Rite );

for kk=1:numf
    plot(frm,FF0(frm,kk),'bo');
end
hold off;

clear str_p zscale frm;

⌨️ 快捷键说明

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