1. Homepage
  2. Programming
  3. EE 5410 Signal Processing MATLAB Exercise 1: Telephone Touch-Tone Signal Encoding and Decoding

EE 5410 Signal Processing MATLAB Exercise 1: Telephone Touch-Tone Signal Encoding and Decoding

Engage in a Conversation
City University of Hong KongHong KongEE 5410Signal ProcessingMatlabSignal EncodingSignal Decoding

EE 5410 Signal Processing MATLAB Exercise 1 CourseNana.COM

Telephone Touch-Tone Signal Encoding and Decoding CourseNana.COM


CourseNana.COM

Intended Learning Outcomes:
CourseNana.COM

On completion of this MATLAB laboratory exercise, you should be able to CourseNana.COM


CourseNana.COM

§ Generate and decode telephone touch-tone signals CourseNana.COM

§ Understand the impact of additive noise in decoding touch-tone signals CourseNana.COM


CourseNana.COM

Deliverable:
CourseNana.COM

§ Each student is required to submit an answer sheet which contains only answers to the questions in this document on or before 23 September 2022. CourseNana.COM


CourseNana.COM

Background: CourseNana.COM

Telephone touch-tone pads generate dual tone multiple frequency (DTMF) signals to dial a telephone. When any key is pressed, the sinusoids of the corresponding row and column frequencies, which are depicted in Table 1, are generated and summed to give dual tone. As an example, pressing the “5” key generates a signal containing the sum of the two tones at 770 Hz and 1336 Hz together, and mathematically, it can be generated as CourseNana.COM

x(t) = cos(2π ⋅ 770t) + cos(2π ⋅1336t) CourseNana.COM

In fact, the frequencies in Table 1 are chosen to avoid harmonics. No frequency is an integral multiple of another, the difference between any two frequencies does not equal any of the frequencies, and the sum of any two frequencies does not equal any of the frequencies. This makes it easier to detect exactly which tones are present in the dialled signal in the presence of non-linear line distortion. CourseNana.COM

Frequency (Hz) 1209 697 “1” 770 “4” 852 “7” 941 “*” CourseNana.COM

Decoding of DTMF signals can be achieved via using a simple finite impulse response (FIR) filter bank which is shown in Figure 1. The filter bank consists of 7 bandpass filters (BPFs) where each filter passes only one of the 7 possible DTMF frequencies. CourseNana.COM

1336 1477 “2” “3” “5” “6” “8” “9” CourseNana.COM

Figure 1: Block diagram for DTMF signal decoding CourseNana.COM

When the input x[n] to the filter bank is a DTMF signal, the outputs from two of the CourseNana.COM

BPFs should be larger than the rest. If we detect the two largest outputs, the two corresponding frequencies can be found. These frequencies are then used as row and column pointers to determine the key from the DTMF code. A possible measure of the output levels can be the peak value at the filter outputs, because when the BPF is working properly it should pass only one sinusoidal signal and the peak value would be the amplitude of the sinusoid passed by the filter. CourseNana.COM

Procedure: CourseNana.COM

  1. If you are not familiar with MATLAB, you can view the MATLAB introduction by typing intro at the MATLAB prompt. This short introduction will demonstrate some of the basics of using MATLAB. Or you can explore the MATLAB help capability which is available at the command line, such as help, help plot and help clear, where plot and clear are command names. Apart from a number of MATLAB reference books such as [1]-[2] which can be found in City University’s library, many on-line MATLAB resources, including [3]-[4], are available.
  2. Create a file named “toneA.m” with the following MATLAB code:

clear all CourseNana.COM

Fs=4000;
Ts=1/Fs; CourseNana.COM

t=[0:Ts:0.3]; CourseNana.COM

F_A=440; CourseNana.COM

A=sin(2*pi*F_A*t); CourseNana.COM

sound(A,Fs); CourseNana.COM

Type toneA at the command line and then answer the following: CourseNana.COM

  1. (a)  What is the time duration of A?
  2. (b)  How many elements are there in A?
  3. (c)  Modify toneA.m by changing “F_A=440” to “F_A=800”. Can you hear any difference? Describe the difference if any.

(d) The frequencies of notes B, C#, D, E and F# are 493.88 Hz, 554.37 Hz, 587.33 Hz, 659.26 Hz and 739.99 Hz, respectively. Write a MATLAB file named “song.m” to produce a piece of music with notes in the following order : A, A, E, E, F#, F#, E, E, D, D, C#, C#, B, B, A, A. Assign the duration of each note as 0.3s. CourseNana.COM

  1. Create a file named “tone.m” with the following MATLAB code:

function x = tone(frequency, observation_length);
% x=tone(frequency, observation_length) is used to generate CourseNana.COM

% a sinusoidal signal x with frequency and observation
% length specified in the arguments.
fs = 4000;
Ts = 1/fs;
t = [0:Ts:observation_length];
x = cos(2*pi*frequency*t); CourseNana.COM

Note that tone is a user-defined MATLAB function. Try the following commands: help tone and y=tone(200,0.5). What are the uses of these two commands? CourseNana.COM

  1. Write a MATLAB function named dtmfdial.m, to implement a DTMF dialer based on the frequency table in Table 1. A skeleton of dtmfdial.m is given as follows:

function xx=dtmfdial(keyName)
%DTMFDIAL Create a DTMF tone
%usage: xx=dtmfdial(keyName)
% keyName = character which is one of the valid key names CourseNana.COM

% xx = signal vector that corresponds to the DTMF dtmf.keys = ['1','2','3'; CourseNana.COM

'4','5','6'; CourseNana.COM

'7','8','9'; CourseNana.COM

'*','0','#']; CourseNana.COM

ff_cols = [1209,1336,1477]; ff_rows = [697;770;852;941]; dtmf.colTones = ones(4,1)*ff_cols; dtmf.rowTones = ff_rows*ones(1,3); CourseNana.COM

Complete dtmfdial.m so that it implements the following: CourseNana.COM

(i)  The input to the function is one of the valid key names, i.e., ‘1’ to ‘#’. CourseNana.COM

(ii)  The output should be a vector of samples at sampling frequency f s = 8000 Hz containing the DTMF tone. Each DTMF signal is the sum of a pair of sinusoidal signals with same amplitudes of 1, and the time duration is 0.2s. CourseNana.COM

(iii)  The frequency information is given in two 4 × 3 matrices, namely, dtmf.colTones and dtmf.rowTones. To translate a key into the correct locations of the two matrices, the find function can be used. An example of using find when keyName='3' is: CourseNana.COM

[ii,jj] = find('3'==dtmf.keys) CourseNana.COM

ii=1 and jj=3 will then be obtained. CourseNana.COM

 (iv) Play the sound of the DTMF tone using soundsc.
5. One simple way to implement a BPF for a single frequency is to use the following impulse response:
where
ω is the center discrete-time frequency of the BPF and L is the FIR filter length. Use MATLAB to generate the impulse response of the BPF with ω = 0.2π . CourseNana.COM

  1. (a)  Try the cases of L = 50 and L = 500 . Plot the magnitudes of the frequency spectra of the two filters using freqz. What do you expect about the shape of the magnitude when L → ∞ ? An example of using freqz is:

[a,b] = freqz(h); %h is the impulse response plot(b,abs(a)); CourseNana.COM

  1. (b)  Compute the energies of h[n] for L = 50 and L = 500 . The energy of h[n] is defined as

h[n]= 1 cos(ωn), 0n<L L CourseNana.COM

 (c) To relate the discrete-time frequency with the continuous-time frequency, the impulse response of the BPF for DTMF decoding is determined as: CourseNana.COM

where fb is the center frequency of the BPF and fs is the sampling frequency, both in Hz. CourseNana.COM


Which filter will give a better DTMF decoding performance,
h[n] with L = 50 or L = 500 ? Explain your answer. CourseNana.COM

6. Write a MATLAB function named dtmfdetect.m (function dtmfdetect(keyName,L,noise_power)) to implement a DTMF encoder and decoder in a noisy environment. The requirements of the dtmfdetect function are given as follows: CourseNana.COM

  1. (i)  The input to the function consists of one of the valid key names, filter length of the BPF and noise power. That is, dtmfdetect('1',50,1) will generate a DTMF tone “1” with L = 50 and the tone is corrupted by a zero- mean white Gaussian noise with power of 1. The output will show the result of the detection, namely, displaying a message of The detected key is 1, if it is correct.
  2. (ii)  Each DTMF signal is the sum of a pair of sinusoidal signals with same amplitudes of 1, and the time duration is 0.2s with sampling frequency fs =8000.
  1.  (iii)  To add a zero-mean white Gaussian noise to the noise-free DTMF tone, you can use the randn command. An example of using randn is:

noise = sqrt(0.1)*randn(1,10); CourseNana.COM

where a zero-mean Gaussian noise sequence of length 10 with power of σ2 = 0.1 will be generated. CourseNana.COM

  1. (iv)  To detect the DTMF tone frequencies, you first need to pass the signal to a filter bank of 7 BPFs whose center frequencies are 697 Hz, 770 Hz, 852 Hz, 941 Hz, 1209 Hz, 1336 Hz and 1477 Hz. The DTMF tone can then be deduced from the two outputs with the largest energies. An example of producing the output signal given the input and FIR filter coefficients is

y=conv(x,h); % x is the input and h is the filter % impulse response CourseNana.COM

An example of computing the energy of a signal is CourseNana.COM

energy = sum(y.*y); CourseNana.COM

Try your dtmfdetect function with various keys, different L ( L = 50 and L = 500 ) CourseNana.COM

and noise powers (σ2 = 0, σ2 =10 and σ2 =100). For each setting, perform 20 trials and record the number of correct detections in the following table. For example, if the CourseNana.COM

DTMF tone is “1”, and “1” is correctly detected 18 times at L = 50 and σ2 = 0 , write down the number 18 in the corresponding entry. CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
City University of Hong Kong代写,Hong Kong代写,EE 5410代写,Signal Processing代写,Matlab代写,Signal Encoding代写,Signal Decoding代写,City University of Hong Kong代编,Hong Kong代编,EE 5410代编,Signal Processing代编,Matlab代编,Signal Encoding代编,Signal Decoding代编,City University of Hong Kong代考,Hong Kong代考,EE 5410代考,Signal Processing代考,Matlab代考,Signal Encoding代考,Signal Decoding代考,City University of Hong Konghelp,Hong Konghelp,EE 5410help,Signal Processinghelp,Matlabhelp,Signal Encodinghelp,Signal Decodinghelp,City University of Hong Kong作业代写,Hong Kong作业代写,EE 5410作业代写,Signal Processing作业代写,Matlab作业代写,Signal Encoding作业代写,Signal Decoding作业代写,City University of Hong Kong编程代写,Hong Kong编程代写,EE 5410编程代写,Signal Processing编程代写,Matlab编程代写,Signal Encoding编程代写,Signal Decoding编程代写,City University of Hong Kongprogramming help,Hong Kongprogramming help,EE 5410programming help,Signal Processingprogramming help,Matlabprogramming help,Signal Encodingprogramming help,Signal Decodingprogramming help,City University of Hong Kongassignment help,Hong Kongassignment help,EE 5410assignment help,Signal Processingassignment help,Matlabassignment help,Signal Encodingassignment help,Signal Decodingassignment help,City University of Hong Kongsolution,Hong Kongsolution,EE 5410solution,Signal Processingsolution,Matlabsolution,Signal Encodingsolution,Signal Decodingsolution,