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

📄 dtmfrun.m

📁 很多matlab的源代码
💻 M
字号:
function keys = dtmfrun(xx,L,fs)
%DTMFRUN    keys = dtmfrun(xx,L,fs)
%    returns the list of key numbers corresponding
%      to the DTMF waveform, xx.
%      L = filter length
%     fs = sampling freq  
dtmf.keys=...
    ['1','2','3','A';
     '4','5','6','B';
     '7','8','9','C';
     '*','0','#','D'];
ff_cols=[1209,1336,1477,1633];
ff_rows=[697;770;852;941];
freqs = [697,770,852,941,1209,1336,1477,1633];
n=0:L-1;
hh=cos(2*pi*freqs'*n/fs)/L*2;
f=(0:511)*fs/2/512;
for ii=1:length(freqs)
    HH=freqz(hh(ii,:),1,512);
    subplot(8,2,ii*2);
    h=plot(f,abs(HH));
    set(h,'LineWidth',2);
    axis([0 fs/2 0 1]);
end
%   hh = MATRIX of all the filters. Each column contains the impulse
%        response of one BPF (bandpass filter)
%
[nstart,nstop] = dtmfcut(xx,fs);   %<--Find the tone bursts
keys=[];
length(nstart)
for kk=1:length(nstart)
    %----Extract one DTMF tone
    x_seg=xx(nstart(kk):nstop(kk));
    row_position=0;
    col_position=0;
    for jj=1:4
        sc=dtmfscore(x_seg,hh(jj,:));
        if sc==1 row_position=jj;        end
        sc=dtmfscore(x_seg,hh(jj+4,:));
        if sc==1 col_position=jj;        end
    end
    if row_position==0 disp('Error in row');return;end
    if col_position==0 disp('Error in col');return;end
    new_key=dtmf.keys(row_position,col_position);
    keys=[keys,new_key];
end

⌨️ 快捷键说明

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