An Introduction to Signal Generation
Overview
Signal generation is an important part of the engineering design process and affects almost very level of this process, from initial design and simulation to final validation and verification. Examples of using signal generation include adding Gaussian white noise to test a digital filter, creating an arbitrary user-defined signal, and simulating a basic function generator. The following concept document discusses fundamental test signals and provides examples of their implementation.
Table of Contents
Common Signals
Signals such as square and sine waves form the basis for many real-world tests. These signals often are used to measure the response of a system to a particular stimulus. You can use software to generate test signals and then design and test a system without using hardware. You also can combine software-based signal generation with data acquisition (DAQ) equipment, such as arbitrary waveform generators or analog output modules and then output custom signals to actual equipment. The following table lists several common test signals along with their measurement applications.Signal | Measurement |
| Sine wave | Gain and phase response, total harmonic distortion (THD) |
| Multitone (two sine waves) | Intermodulation distortion |
| Multitone (many sine waves), impulse, chirp, broadband noise | Frequency response |
| Sinc wave | Interpolation |
| Square wave, pulse pattern | Rise time, fall time, overshoot, undershoot |
| Square wave | Jitter |
Sine Wave Fundamentals
Fundamentally, the sine wave is the most basic form of wave motion. A sine wave is also one of the most commonly used signals in signal generation because, according to the Fourier theorem, you can analyze any periodic waveform as the sum of a series of sine waves with frequencies in a harmonic series. For example, you can construct a square wave by summing a series of sine waves with varying frequencies and amplitudes.

Figure 1. A sine wave plot that shows the period and the amplitude
Use Cases for Sine Waves
Gain and Phase Response
The phase, gain, and frequency are important design parameters for many electronic parts such as audio amplifiers. By applying a sine wave at a specified frequency to the amplifier input, you can measure the output signal and compare the output signal to the input signal. Then you can calculate the gain and the phase of the system. Stepping through a range of frequencies determines the overall frequency response of the system. Instead of using sine waves at discrete frequencies to determine the frequency response of a system, you can use a chirp signal to provide a linear, frequency-swept sine wave over a user-defined frequency range at a given amplitude. This allows for a complete characterization of gain and phase versus frequency.
Total Harmonic Distortion
A total harmonic distortion (THD) test utilizes sine waves in order to discern the amount of harmonic distortion in a system. A THD test consists of the ratio of the sum of the powers of all harmonic frequencies above the fundamental frequency to the total power of the fundamental frequency. The figure below demonstrates a typical THD test. A single tone (sine wave) is used as an input for a device like an amplifier. Then the output of the amplifier is fed into a computer, and the power spectrum of the signal is analyzed. The power of the harmonics of the tone are added and applied to the following formula:

where H2 - HN are the second through Nth harmonic power levels of the input frequency.
Figure 2. Total harmonic distortion test. A single tone, such as a sine wave, is used as an input for the device you want to test. The output signal from the device is analyzed in a computer, and the power of the harmonics of the fundamental frequency are added and applied to the previous formula.
Square Wave Fundamentals
Square waves are used primarily in digital communications to represent binary logic (on and off). The duty cycle is a fundamental concept of square waves. The duty cycle is defined as the percentage of time the square wave is high divided by the period of the signal, as shown in the following figure.

Figure 3. A square wave with a duty cycle of 50%
Use Cases for Square Waves
Pulse Width Modulation
Pulse width modulation (PWM) is a technique that uses variable length square waves to represent the amplitude of an analog signal. PWM is performed by adjusting the duty cycle. PWM is an extremely useful technique because by adjusting the duty cycle of a square wave, a digital signal can drive an analog circuit. Figure 4 shows a simple circuit that can be driven using PWM. The light bulb is powered by a 5 V battery, and a switch lies between the battery and the light bulb. If the switch is initially open for 100 ms, the light bulb receives 5 V. If the switch then is closed for another 100 ms, the light bulb receives 0 V. If you repeat this process, the duty cycle of the square wave is 50%, and the average voltage across the light bulb is 2.5 V. If the light bulb is driven with a duty cycle of 10%, the average voltage across the bulb is 0.5 V.
Figure 4. (a) Example of square waves with 10% (blue) and 50% (red) duty cycles (b) Circuit that shows the concept of PWM
Jitter
A jitter measurement is an important example of a measurement technique that requires square waves. The goal of a jitter measurement generally is to measure the deviation, in time, between a reference signal and the signal of interest. You can use the jitter of a clock signal to quantify how good that clock signal is. Less jitter equates to a better signal. Refer to the Digital Waveform Timing Developer Zone article (linked below) for more information about jitter.

Figure 5. Example of a jitter measurement. In this measurement, the jitter is the time difference between the reference signal and the measured signal.
Chirp Signal Fundamentals
A linear chirp signal, one type of chirp signal, is a frequency-swept sine wave with constant amplitude. Another type of chirp is an exponential chirp whose frequency increases exponentially with time. The following figure demonstrates a chirp pattern swept linearly between 0 and 20 Hz.

Figure 6. A chirp pattern swept linearly between 0 and 20 Hz
Use Cases for Chirp Signals
The chirp pattern offers a signal that sweeps linearly from one frequency to another. Thus, you can use chirp signals to characterize systems such as filters. For example, by inputting a chirp pattern into a band-pass filter, you can characterize the frequency response of the filter between frequencies of interest.

[+] Enlarge Image
Figure 7. Block diagram that demonstrates the implementation of a chirp pattern to characterize a filter. The chirp pattern allows you to characterize a linear system over a specified frequency range.
Developer Zone: Digital Waveform Timing
Developer Zone: An Introduction to Noise Signals
Developer Zone: Signal Generation in LabVIEW
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).


