📄 arma_go.m
字号:
%
% Callback function for popup menu in the ARMA Analysis window
% Author : Minkyu Lee
% Date : 27-Feb-1995
% Modified by Karthik on May 27 1997
% Modified by D. G. Childers
PV=[275 100 519 240];
s2 = 'Frequency Domain Analysis - Output';
% Open analysis window
while exist('freq_out_win_h')==1
try1 = 'get(freq_out_win_h,''position'');';
eval(try1,catch2);
if check ==0
clear freq_out_win_h;
check = 1;
break;
end
s1 = get(freq_out_win_h,'Name');
if ~strcmp(s1,s2)
clear freq_out_win_h;
break;
end
figure(freq_out_win_h);
break;
end;
if exist('freq_out_win_h')~=1;
freq_out_win_h=figure('Position',PV,...
'Resize','on',...
'Numbertitle','off',...
'Name',s2 );
end
if arma_window == 1
window = hamming(arma_frame_len);
elseif arma_window == 2
window = hanning(arma_frame_len);
elseif arma_window == 3
beta=0.5;
window = kaiser(arma_frame_len,beta);
elseif arma_window == 4
window = triang(arma_frame_len);
elseif arma_window == 5
window = bartlett(arma_frame_len);
elseif arma_window == 6
window = blackman(arma_frame_len);
elseif arma_window == 7
window = boxcar(arma_frame_len);
elseif arma_window == 8
rdb=3;
window = chebwin(arma_frame_len,rdb);
end
epsilon=1e-15;
val=get(arma_po_method_h,'Value');
button=1;
while button == 1
if freq_arma_mark_flag == 0
if arma_frame_len > length(SPEECH);
S=sprintf('Analysis window length is longer that input data. %d of zeros are padded',arma_frame_len-LEN);
disp(S);
temp=zeros(arma_frame_len-LEN,1);
speech1=[SPEECH;temp];
else
S=sprintf('The analysis frame is the first %d points of current data window',arma_frame_len);
disp(S);
speech1=SPEECH_OLD(1:arma_frame_len);
end
button=0;
else
figure(ana_wav_win_h);
[x,y,button]=ginput(1);
x=round(x);
if button ~= 1
return
end
speech1=SPEECH_OLD(x:x+arma_frame_len-1);
figure(freq_out_win_h);
end
speech1=window.*speech1;
FFT = fft(speech1,arma_frame_len);
wait_window = figure('Numbertitle','off',...
'Color',BACK_COLOR,...
'Name','Please be patient...',...
'Position',[117 248 560 150]);
wait_window_display = uicontrol('Style','Text',...
'Position',[50 50 410 30],...
'Backgroundcolor','white',...
'Foregroundcolor','blue',...
'String','These methods may take a while...please wait');
pause(0.01);
if val == 1
[A0 sig2] = autocorr(speech1, arma_frame_len, arma_num_poles);
[B0 sig2] = durbin(speech1, arma_frame_len, arma_num_zeros, round(arma_frame_len/5));
NIT=100;
epsilon=1e-15;
PER=0.1;
[A B sig2 iflag] = akaike(speech1,arma_frame_len,A0,B0,arma_num_poles,arma_num_zeros,NIT,epsilon,PER);
elseif val == 2
[A B sig2 iflag] = mywe(speech1,arma_frame_len,arma_num_poles,arma_num_zeros,epsilon);
elseif val == 3
M=50;
[A B sig2 iflag] = lsmywe(speech1,arma_frame_len,arma_num_poles,arma_num_zeros,M,epsilon);
elseif val == 4
L=3*arma_num_poles;
NEXP=9;
[A B sig2 iflag] = maynefir(speech1,arma_frame_len,arma_num_poles,arma_num_zeros,L,NEXP,epsilon);
end
error=filter([1 A],[1 B],speech1);
eng=sqrt(error'*error);
[H W] = freqz(eng*[1 B], [1 A], arma_frame_len/2);
set(wait_window_display,'String','Thanks for being patient. Now plotting');
pause(0.01);
close(wait_window);
clear wait_window;
% plot the spectrum and pole_zero plot
vh=1:arma_frame_len/2;
vh=vh/(arma_frame_len/2)*1/(2*Ts);
subplot(121),plot(vh, 20*log10(abs(FFT(1:arma_frame_len/2))));
hold on;
plot(vh,20*log10(abs(H)), ':r');
hold off;
subplot(122), zplane([1 B], [1 A]);
fsave=20*log10(abs(H));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -