이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
고르첼 알고리즘을 사용한 DFT 추정
R2026a이 예제에서는 고르첼 함수를 사용하여 DFT 기반 DTMF 검출 알고리즘을 구현하는 방법을 보여줍니다.
이중톤 다중 주파수(DTMF) 신호는 음성 통신 제어의 근간이 되며 현대적인 전화 기술에서 번호를 누르고 전화 교환대를 구성하는 데 전 세계적으로 널리 사용됩니다. 음성 사서함, 이메일, 텔레뱅킹과 같은 시스템에서도 사용됩니다.
DTMF 톤 생성하기
DTMF 신호는 2개의 상호 배타적인 주파수 집단에서 가져온 주파수를 갖는 2개의 정현파, 즉 2개의 톤의 합계로 구성됩니다. 이러한 주파수는 수신기가 고조파를 다른 DTMF 주파수로 잘못 감지하지 못하도록 선택됩니다. 각각의 톤 쌍은 저주파수 무리의 주파수 하나(697Hz, 770Hz, 852Hz, 941Hz)와 고주파수 무리의 주파수 하나(1209Hz, 1336Hz, 1477Hz)를 포함하며, 고유한 기호를 나타냅니다. 전화기 패드의 푸시 버튼에 할당되는 주파수는 다음과 같습니다.
전화 패드의 각 버튼에 대해 DTMF 신호를 생성하고 플로팅합니다. 각 신호는 샘플 레이트가 8Khz이고 지속 시간이 100ms입니다.
symbol = {"1","2","3","4","5","6","7","8","9","*","0","#"};
[tones, Fs, f, lfg, hfg] = helperDTMFToneGenerator(symbol, false);
helperDFTEstimationPlot1(tones, symbol, Fs, f);![Figure contains 12 axes objects. Axes object 1 with title Symbol " 1 ": [ 697 , 1209 ], ylabel Amplitude contains an object of type line. Axes object 2 with title Symbol " 2 ": [ 697 , 1336 ], ylabel Amplitude contains an object of type line. Axes object 3 with title Symbol " 3 ": [ 697 , 1477 ], ylabel Amplitude contains an object of type line. Axes object 4 with title Symbol " 4 ": [ 770 , 1209 ], ylabel Amplitude contains an object of type line. Axes object 5 with title Symbol " 5 ": [ 770 , 1336 ], ylabel Amplitude contains an object of type line. Axes object 6 with title Symbol " 6 ": [ 770 , 1477 ], ylabel Amplitude contains an object of type line. Axes object 7 with title Symbol " 7 ": [ 852 , 1209 ], ylabel Amplitude contains an object of type line. Axes object 8 with title Symbol " 8 ": [ 852 , 1336 ], ylabel Amplitude contains an object of type line. Axes object 9 with title Symbol " 9 ": [ 852 , 1477 ], ylabel Amplitude contains an object of type line. Axes object 10 with title Symbol " * ": [ 941 , 1209 ], xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 11 with title Symbol " 0 ": [ 941 , 1336 ], xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 12 with title Symbol " # ": [ 941 , 1477 ], xlabel Time (ms), ylabel Amplitude contains an object of type line.](dftestimationexample_02_ko_KR.png)
DTMF 톤 재생하기
예를 들어, 전화번호 508-647-7000에 해당하는 톤을 재생합니다. "0" 기호는 11번째 톤에 해당합니다.
% To hear, uncomment these lines: % for i = [5 11 8 6 4 7 7 11 11 11] % p = audioplayer(tones(:,i),Fs,16); % play(p) % pause(0.5) % end
고르첼 알고리즘을 사용하여 DTMF 톤 추정하기
ITU 표준에서 정의하는 DTMF 신호의 최소 지속 시간은 40ms입니다. 따라서 추정 및 검출에 사용할 수 있는 샘플은 최대 0.04 x 8000 = 320개입니다. DTMF 디코더는 이러한 짧은 신호에 포함된 주파수를 추정해야 합니다.
이 추정 문제에 대한 한 가지 일반적인 접근 방법은 7개의 기본 톤에 가까운 이산시간 푸리에 변환(DFT) 샘플을 계산하는 것입니다. DFT 기반 솔루션에서는 주파수 영역에서 205개의 샘플을 사용하면 원래 주파수와 DFT가 추정되는 점 사이의 오차가 최소화된다는 것이 증명된 바 있습니다.
Nt = 205;
original_f = [lfg(:);hfg(:)] % Original frequenciesoriginal_f = 7×1
697
770
852
941
1209
1336
1477
k = round(original_f/Fs*Nt); % Indices of the DFT estim_f = round(k*Fs/Nt) % Frequencies at which the DFT is estimated
estim_f = 7×1
702
780
859
937
1210
1327
1483
원래 주파수와 DFT가 추정되는 점 사이의 오차를 최소화하기 위해 톤을 자르고 추후 처리를 위해 205개의 샘플(25.6ms)만 남겨 두겠습니다.
tones = tones(1:205,:);
이 시점에서 고속 푸리에 변환(FFT) 알고리즘을 사용하여 DFT를 계산할 수도 있습니다. 하지만 이 맥락에서 고르첼 알고리즘이 널리 사용되는 이유는 DFT가 추정되는 점의 개수가 적기 때문입니다. 이 경우에는 FFT 알고리즘보다 고르첼 알고리즘이 더 효율적입니다.
for toneChoice = 1:12 % Select tone tone = tones(:,toneChoice); % Estimate DFT using Goertzel ydft(:,toneChoice) = goertzel(tone,k+1); % Goertzel uses 1-based indexing end
전화 패드에 대응되는 그리드 상에 각 톤의 고르첼 DFT 크기 추정값을 플로팅합니다.
helperDFTEstimationPlot2(ydft,symbol,f, estim_f);
![Figure contains 12 axes objects. Axes object 1 with title Symbol " 1 ": [ 697 , 1209 ], ylabel DFT Magnitude contains an object of type stem. Axes object 2 with title Symbol " 2 ": [ 697 , 1336 ], ylabel DFT Magnitude contains an object of type stem. Axes object 3 with title Symbol " 3 ": [ 697 , 1477 ], ylabel DFT Magnitude contains an object of type stem. Axes object 4 with title Symbol " 4 ": [ 770 , 1209 ], ylabel DFT Magnitude contains an object of type stem. Axes object 5 with title Symbol " 5 ": [ 770 , 1336 ], ylabel DFT Magnitude contains an object of type stem. Axes object 6 with title Symbol " 6 ": [ 770 , 1477 ], ylabel DFT Magnitude contains an object of type stem. Axes object 7 with title Symbol " 7 ": [ 852 , 1209 ], ylabel DFT Magnitude contains an object of type stem. Axes object 8 with title Symbol " 8 ": [ 852 , 1336 ], ylabel DFT Magnitude contains an object of type stem. Axes object 9 with title Symbol " 9 ": [ 852 , 1477 ], ylabel DFT Magnitude contains an object of type stem. Axes object 10 with title Symbol " * ": [ 941 , 1209 ], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem. Axes object 11 with title Symbol " 0 ": [ 941 , 1336 ], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem. Axes object 12 with title Symbol " # ": [ 941 , 1477 ], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem.](dftestimationexample_03_ko_KR.png)
DTMF 톤 검출하기
위에서 추정된 7개의 주파수에 존재하는 에너지를 측정하여 디지털 톤을 검출할 수 있습니다. 저주파 무리와 고주파 무리에 있는 최대 에너지 성분을 취하여 각 기호를 분리할 수 있습니다.
부록
이 예제에서는 다음 헬퍼 함수가 사용되었습니다.