## Introduction: Signal Generation With MATLAB. Example of DTMF in Telephony

In mathematics a **signal is a real function **of a real variable f(t). In electronics it represents **the evolution of a voltage (or a current)** over the time and depends on the performances of the stage of the amplifier. Through a memory buffer, samples move to a digital-to-analog converter that produces a voltage signal, after an amplification stage that can limit the generation of the signal. A **possible analysis consists of use Matlab **with a PC sound card and an example of DTM.

## Step 1: Define the Code

First of all, the information is available in digital format, inside a file in the vector numbers format (samples). **Through a memory buffer, samples move to a digital-to-analog converter that produces a voltage signal to output to the external world,** after an appropriate amplification stage. Shannon’s theorem states that the sampling frequency fs must satisfy the following relation: fs ≥ 2B, where B is the absolute band of the output signal.

The most important issues are:

1- to generate a file with the signal in the digital format.

2- to setup a hw/sw sysytem able to perform the digital to analog conversion chain (DAC).

## Step 2: Matlab and the PC Sound Card

**Matlab supplies different internal functions to generate a waveform.** Most of these require a preliminary statement of a time vector. Considering a sample** frequency of fs[Hz] **it’s possible to produce a time vector by writing: t=linspace(0, end, end*fs . This command generates a time vector from zero to end second, divided in end*fs points. The source code to generate a 20Hz, 2 seconds tone is the following:

t=linspace(0, 2, 2*10000)

y=sin(2*pi*20*t)

plot(t, y)

wavwrite(y, 10000, prova.wav)

The function wavwrite(y,fs,’nomefile’) generates an audio nomefile.wav file from the y vector sampled at the fs frequency (Figure).

## Step 3: Example: DTMF Tones Generation

As example, we consider the generation of DTMF tones of the telephon keyboard. Using Matlab (in the following source code), it’s possible to generate a 12 seconds dtmf.wav file that reproduces, at interval of one second, the sequence of the **DTMF tones** (Figure) of the buttons. **Dual-Tone Multi-Frequency** is a decoding method used in the telephony to code numerical digits by means of sound signals in the audio band. Full documentation about the matlab code is available on the following link:

http://dev.emcelettronica.com/signal-generation-with-matlab-example-of-dtmf-in-telephony

## Discussions