?? decoder.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 + -