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

📄 decoder.m

📁 Goertzel算法是DTMF信号检测的核心
💻 M
字号:
function [Dialled_num,Goertzel_array] = decoder(dtmf_output,Num_of_samples);
%
%
%             Function to decode the DTMF signals
%
%   Author: Pranam Janney           Date: 15/05/04     Time: 17:50          
%   Email: pranamjanney@yahoo.com
%
%  Usage :
%              [Dialled_num,Goertzel_array] = decoder(dtmf_output,Num_of_samples);
%  Inputs:
%             dtmf_output  = the combination of two sinesoids corresponding to the
%                            number dialled
%             Num_of_samples =  Number of samples
%  Outputs:
%            Dialled_num = The Number that was dialled at the "generator"
%            Goertzel_array = output of the goertzel's algorithm in an array 
%                      
% 



Fs = 8000;
Fm = [697 770 852 941 1209 1336 1477 1633];
k = cal_k(Num_of_samples,Fs,Fm);
v_sum = 0;

for K_ind = 1 : length(k);
    
    y = goertzel_algo ( dtmf_output,k(K_ind),Num_of_samples);
    
    if (K_ind == 1)                                        % this appends each Kth array to 
         y1(1 : Num_of_samples) = y( 1 : Num_of_samples);  % the output array
     else
          v_sum = v_sum + Num_of_samples;
          y1(v_sum + 1 : v_sum + Num_of_samples) = y( 1: Num_of_samples);
      end
    ymax(K_ind) = max(y);
end
Goertzel_array = ymax;

% To find the two maximum peaks
temp = ymax(1);
temp1 = 1;

for s = 2:8
   if (ymax(s) > temp)
        temp = ymax(s);
        temp1 = s ;
   end
end
             
ymax(temp1) = 0;
temp2 = ymax(1);
temp3 = 1;

for s = 2:8
   if (ymax(s) > temp2)
       temp2 = ymax(s);
       temp3 = s;
   end
end

dialnum = ['1' '2' '3' 'A';'4' '5' '6' 'B';'7' '8' '9' 'C';'*' '0' '#' 'D'];
   
if (temp1 > temp3)
     temp = temp1;
     temp1 = temp3;
     temp3 = temp;
end

Dialled_num = dialnum(temp1,(temp3-4));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

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