EC39201 - Expt3 - Lab Report - Grp-24
EC39201 - Expt3 - Lab Report - Grp-24
07 September 2022
Group-24
KR Rahul(20EC30021)
Rahul Singh(20EC30037)
AIM
● Design a Dual Tone Multi Frequency Coder and then decode it using bandpass filters
● To observe the response of our DTFT coding for various different inputs
THEORY
DTMF is a signaling system for identifying the keys pressed on a DTMF keypad. The
frequencies corresponding to each key on the keypad can be represented in the form of a
matrix.
When the key is pressed the sinusoids of the corresponding frequencies are summed to
generate an input signal.
DTMF Decoder
This signal is then passed through a filter bank consisting of eight band pass filters. Each
filter passes only one of the eight DTMF frequencies. The values of magnitude of two of
the filters would be high compared to others. These two filters will signify the two
frequencies present in the input signal. Using this and the DTMF frequency matrix, the
pressed key can be decoded.
1
The Band Pass Filter is realized by defining the impulse response of L-point FIR filter:
where L is the filter length, wc is the center frequency determining the location of the
passband frequency and β is the term corresponding to the passband gain.
CODE:
clear;
clc;
s=input('Enter your sequence:','s');
res=char(zeros(1,length(s)));
for i=1:1:length(s)
res(i)=dtmf(s(i));
end
disp("The output after decoding is:");
disp(res);
%%
function val=dtmf(key)
Frow=[697,770,852,941];
Fcol=[1209,1336,1477,1633];
inp=['1','2','3','A';'4','5','6','B';'7','8','9','C';'*','0','#','D'];
[i,j]=find(inp==key);
f1=Frow(i);
f2=Fcol(j);
f3=max(f1,f2);
T=1/f3;
fs=2500;
t=0:1/fs:40/f3;
x=sin(2*pi*f1*t)+sin(2*pi*f2*t);
figure;
plot(x)
xlabel('Time-Axis')
ylabel('x(t)')
title('Signal generated for given input')
N=800;
y=fft(x,N);
y=fftshift(y);
M=abs(y);
M=M/N;
f=(-length(y)/2:length(y)/2-1)*fs/length(y);
figure;
plot(f,M);
xlabel('Frequency')
ylabel('X(f)')
title('FFT of Signal generated')
2
%defining a filterbank consisting of 8 bandpass filters
b1=band_pass(x,697,fs);
b2=band_pass(x,770,fs);
b3=band_pass(x,852,fs);
b4=band_pass(x,941,fs);
b5=band_pass(x,1209,fs);
b6=band_pass(x,1336,fs);
b7=band_pass(x,1477,fs);
b8=band_pass(x,1633,fs);
val_row=[m1,m2,m3,m4];
val_col=[m5,m6,m7,m8];
[v1,r]=max(val_row);
[v2,c]=max(val_col);
val=inp(r,c);
end
%%
function [y]=band_pass(x,fc,fs)
wc=2*pi*fc/fs;
L=100;
b=0.05;
for n=1:L
h(n)=b*cos(wc*n);
end
y=conv(x,h);
end
3
● For a sequence:
DISCUSSION
● In this experiment in order to decode the signal we made use of 8 bandpass filters
with center frequencies equal to that of the dual tone frequencies. Here we made
use of a bandpass filter known as L point average filter.
● As mentioned in the manual we observed that increasing the number of points in
FIR filters makes the filter narrower. In Fact this is true because if we see the
frequency domain realization of the FIR filter, the increase in number of points L
will lead to reduction in bandwidth and closer approach to the asymptotic notch
filter (bandpass version).
● In the case of the L point average filter we made an observation that the
bandwidth varies inversely with L.
4
● A peculiar property was observed while varying the FIR length. At extremely low
or high lengths, the magnitude response was quite smooth and there were almost
no small sized ripples in phase response. However, there were several small
ripples in the magnitude as well as phase response as was shown in the parameter
variation slide.
● When a noise signal is added it could be seen that the dft of the noise added signal
is a bit distorted compared to the DFT of the input signal.
● Even after the addition of noise, signal dialed numbers can be detected by making
use of narrow bandpass filters.
● From the outputs of the bandpass filters it could be seen that the outputs of only
two particular filters are maximized and they represent the dialed number.
● The DTMF decoder works on the principle of selecting the bank which captures
the maximum energy. This works properly when the SNR is greater than
-2.4decibels. At lower SNR, this principle fails because the noise spectrum
overcomes the signal and the noise (being computer generated) is not fully white
and thus whichever frequency band by chance gets more energy gets decoded and
thus we decode a wrong key press. Moreover every time a key is pressed, noise
acting always varies. Thus due to above mentioned two reasons, we observe the
same key press giving different detections at low values of SNR.