plot_formant.m
来自「这是一个用于语音信号处理的工具箱」· M 代码 · 共 89 行
M
89 行
% To plot the formants
% Author: Albert Hsiao 2/97
%Changes by Karthik
% construct the formant polynomial
rts=ff2root(Ff1(segment_no,:),Fb1(segment_no,:));
pcofa=real( poly(rts) );
% plot Z-plane zero-plot and digital filter frequency response.
% zplane(B,A) is defined as the following filter
% -1 -nb
% jw B(z) b(1) + b(2)z + .... + b(nb+1)z
% H(e) = ---- = ----------------------------
% -1 -na
% A(z) 1 + a(2)z + .... + a(na+1)z
A=pcofa;
B=1;
PV = [420 300 380 202];
s2 = 'Pole Zero Plot';
% Open analysis fig
while exist('formant_display_fig1')==1
try1 = 'get(formant_display_fig1,''position'');';
eval(try1,catch2);
if check ==0
clear formant_display_fig1;
check = 1;
break;
else
close(formant_display_fig1);
clear formant_display_fig1;
end
end
formant_display_fig1= figure('Position',PV,...
'Resize','on',...
'Numbertitle','off',...
'Name',s2);
%figure(formant_display_fig1);
zplane([],A);
title(' ');
xlabel('Real');
ylabel('Imaginary');
% Z-transform digital filter frequency response
[h,f]=freqz(B,A,128);
PV = [420 51 377 203];
s22 = 'Frequency respose';
% Open analysis fig
while exist('formant_display_fig2')==1
try1 = 'get(formant_display_fig2,''position'');';
eval(try1,catch2);
if check ==0
clear formant_display_fig2;
check = 1;
break;
end
s12 = get(formant_display_fig2,'Name');
if ~strcmp(s12,s22)
clear formant_display_fig2;
break;
end
figure(formant_display_fig2);
break;
end;
if exist('formant_display_fig2')~=1;
formant_display_fig2= figure('Position',PV,...
'Resize','on',...
'Numbertitle','off',...
'Name',s22);
end
subplot(211);
plot(f/2/pi*Srate,20*log10(abs(h)),'color', LINE_COLOR);
grid on;
xlabel('Frequency');
ylabel('Magnitude(dB)')
subplot(212)
plot(f/2/pi*Srate,unwrap(angle(h))*180/pi,'color',LINE_COLOR);
grid on;
xlabel('Frequency')
ylabel('Phase')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?