# Creating Signals from Math and “Beating”

## Introduction

In this experiment, we will use the Analog Discovery's™ ability to create “custom” waveforms according to a mathematical function. These waveforms are referred to as custom waveforms because they may not fall into any particular category of common waveforms (e.g., sinusoids, square waves, triangular waves, all fall into broad categories—their names provide intrinsic information as to the basic shape of the waveform).

The Analog Discovery allows us to create waveforms in a variety of ways. One approach is to define the waveform in terms of an arbitrary mathematical expression. This approach is especially useful for engineers, since we tend to view the world in terms of the mathematics that describes it. Being able to create a physical representation of the mathematics we are using (i.e., a voltage waveform) allows us to check this view of the world.

In this project, we will simultaneously “play” two sinusoids with slightly different frequencies over our speaker. When two sinusoids with very similar frequencies interact, a phenomenon called beating occurs—the resulting signal seems to have a sinusoidal component which varies with a frequency corresponding to the difference in frequency of the two individual sinusoids. Beating can be heard by striking two closely spaced keys on a piano keyboard simultaneously. The closer the two keys are together, the slower the apparent beating between the sinusoids becomes.

##### Before you begin, you should:
• Be able to use the Analog Discovery waveform generator to apply Sinusoids and Swept Signals to a circuit.
• Write the mathematical formula for a sinusoidal signal. Identify the parameters describing the amplitude and frequency of the signal.
• State how the frequency (in Hertz) of a sinusoid and the frequency (in radians/second) are related, and how they both relate to the period of the sinusoid.
##### After you're done, you should:
• Use the Analog Discovery waveform generator to create signals from mathematical expressions.

## Inventory:

Qty Description Typical Image Schematic Symbol Breadboard Image
1 Buzzer/Speaker
The Buzzer/Speaker in the analog parts kit has two terminals. If a time-varying voltage is applied between the terminals a film in the speaker vibrates, converting the voltage waveform to a pressure waveform with a similar “shape”. Note: The speaker in your parts kit may have different markings than the one pictured.

## Procedures

### Shortcut!

If you have completed the Sinusoids and Swept Signals project and your circuit is still intact, feel free to skip to Step 2 of this exercise.

### Step 1: Understanding the Circuit

#### A. Circuit Schematic

1. Connect one terminal of the speaker to the W1 terminal of your Analog Discovery.

2. Connect the other terminal of the speaker to a ground terminal on your Analog Discovery.

#### B. Create Circuit

1. Insert the terminals of the speaker into your breadboard so that they are in different rows.

2. Connect W1 (the yellow wire) to one terminal of the speaker.

3. Connect ground (, the black wire) to the other speaker terminal.

## Step 2: Set up Instruments

### A. Open WaveGen Instrument

1. Open WaveForms™ to view the main window.

2. Click on the WaveGen icon to open the waveform generator.

#### Note

• The frequencies in the equation typed in the math editor are relative to the range of X also defined in the math editor. Therefore, the $\sin (60 \cdot \pi \cdot X)$ term will go through 30 cycles over the range ${\rm{ - 0}}{\rm{.5 < X < 0}}{\rm{.5}}$. The ${\rm{sin(62}} \cdot \pi \cdot {\rm{X)}}$ term will go through 31 cycles in the range ${\rm{ - 0}}{\rm{.5 < X < 0}}{\rm{.5}}$.

• “Beating” results from adding the two sinusoids together. The addition results in another sinusoidal component which has a frequency that is the difference in the frequencies of the individual sinusoids. Thus, in our plot window, we see a signal which, in addition to its high frequency oscillation, goes through one cycle in the range ${\rm{ - 0}}{\rm{.5 < X < 0}}{\rm{.5}}$.

### Step 3: Experiment

#### A. Apply the Signal to Your Speaker

1. Click on Run AWG1 or Run All to apply the signal to your speaker. The sum of the sinusoids should create a “tone” which seems to fade in and out. The rate at which the signal fades in and out is based on the relative frequencies of these sinusoids.