# Linearity vs. Flatness

## Introduction

Linearity and Flatness are two metrics to evaluate a electronic device performance such amplifier gain of a radio system or sampling quality of an Analog to Digital converter. Engineers often confuse the terms of linearity and flatness of a system response. We will provide background information about these two metrics and conclude with real world applications.

## Background

Electronic System: it is a circuit that processes input signal/s to a desired system output.

System response: The system response is the output of the electronic system when excited with valid input signal . Response can be in the forming of voltage, current, power. Often response is compared against input signals such that gain , frequency response, phase response, and distortion are evaluated.

**Linearity**

A linear function is such that the system output with respect to its input can be plotted as a** straight line. **The steepness/shape of the line is described as proportional constant (i.e slope). A more formal definition of linearity system is principles of superposition in physics or having properties of** additivity** and **homogeneity **in mathematics.

- Linearity property means that output Y is any linear combination of input variable X.
- A linear combination means multiplying each term x by a constant and adding the results is the same as multiply the output by a constant and adding the output results together
- e.g.,
*f*(*ax*+*bz*)=*af*(*x*)+*bf*(*z*)

- e.g.,
- An example of linear electronic circuit
- e.g., voltage
**V = I•R**

- e.g., voltage
- An example of nonlinear combination is square or cube of input variable X.
- e.g., Power
**P = I^2 • R**

- e.g., Power

- A linear combination means multiplying each term x by a constant and adding the results is the same as multiply the output by a constant and adding the output results together

**Non-linearity**

A nonlinear system is such that the change in system output is not proportional to change in its inputs. It often measured as maximum deviation for ideal straight line, Total harmonic deviation (THD), and gain error (i.e slope deviation from an ideal straight line).

- Common cause is saturation or clipping point of an amplifier output in electronics.
- A desired nonlinear system is frequency mixer is used to mix two frequency signals together for amplitude modulation.

**Flatness**

Flatness is defined as the amplitude variation over a frequency range often characterized as amplitude error.

## Analysis

- A system response can be flat but not linear
- e.g. the frequency response amplitude is the same across desired frequency range but a step increase in system output voltage with respect to a step increase in input voltage deviates from constant gain. An example of this deviation is due to amplifier output compression near the clipping point.

- A system can be linear but not flat.
- e.g. A non flat frequency response is desired in application such as audio equalization where the audio engineer wants to boost certain acoustic spectral band such as bass or tweeter to achieve certain sound effects, but the entire audio system can still follow volume control change.

In generally, non-linearity in ADC, DAC, Op-AMP, Power Amplifier is unwanted because it introduce measurement errors and distortions.

## Q&A

What are some non-linearity correction methods?

- For RF power amplifier, a signal predistortion processing technique can be applied to amplifier input signals to main a straight line graph. Also restricting power amplifier inputs to operate within the linear region.
- For ADC/DAC nonliearity, applying a calibration curve to linearize input to output relationship.

What are some nonflatness correction methods?

- measures the amplitude error as function of frequency. Apply a amplitude adjustment filter for the input signals before sending it to the electronic system.
- For audio system, a typical driver EQ audio processing made using octave band graphic equalization (GEQ) is used to flatten the speaker driver frequency response.

## Summary & Conclusion

**Linear system**is plotted as a straight line with proportional constant (i.e slope), and in other words, it obeys**principles of superposition.****Nonlinear system**means change in system output is not proportional to change in system inputs.**Flatness**is a measure of amplitude error across a frequency range in frequency response test.**Saturation and clipping point**is common cause of nonlinearity of ADC,DAC, and power Amplifiers.**Nonlinearity**causes signal distortion in electronic circuit often characterized as THD.

A electronic system does not have to be either linear and flat; It can be any combination of them. In practice for most of the mixed signal circuits and amplifiers, we would prefer a linear and flat system. For audio digital signal processing, nonlinear and nonflat algorithm is often used for speaker protection and sound effects such limiter and equalization design respectively.

## Further Reading

"Linearity", http://www-math.mit.edu/~djk/calculus_beginners/chapter03/section03.html

"Linear System: https://www.dspguide.com/ch5/4.htm

"How to Measure Gain and Flatness", http://na.support.keysight.com/vna/help/latest/Tutorials/Gain_Flat.htm