229-A2.1

From Microlab Classes
Revision as of 13:28, 21 September 2020 by Louis Alarcon (talk | contribs)
Jump to navigation Jump to search

Activity: Nonlinearity in Circuits

  • Instructions: This activity is structured as a tutorial with a design problem at the end. Should you have any questions, clarifications, or issues, please contact your instructor as soon as possible.
  • At the end of this activity, the student should be able to:
  1. Understand and observe the effects of nonlinearity in electronic circuits.

Visualizing Nonlinearity

Let us examine the effects of varying the coefficients of the power series model of our transfer function using this Python script. Fig. 1 shows the an even function with only second order coefficients. This is typical of ideal square-law single-ended MOS amplifiers where a quadratic term dominates.

Figure 1: An even function with positive and negative second order coefficients.
Figure 2: An odd function with positive and negative third order coefficients.

Fig. 2 shows an odd function with only third order coefficients. This is a good estimate for differential circuits, where the common-mode terms cancel out. For example, the outputs of a differential amplifier can be expressed as:

 

 

 

 

(1)

 

 

 

 

(2)

Then the differential output is:

 

 

 

 

(3)

We can also see from Fig. 2 that the negative third (and other odd) order coefficients model the output saturation in real amplifiers as the output level approaches the supply voltages. Thus, in most cases, the third order nonlinearity dominates.

Spectral Response

Let us also try to visualize the effects of nonlinearity in the frequency domain, where our main tool would be the discrete Fourier transform (DFT) or the fast Fourier transform (FFT). When performing an FFT, we want our sinusoids (or tones) to fall into just one frequency bin. To do this, we must make sure that:

  • We use a sampling frequency much higher than twice our highest frequency of interest, or .
  • We choose a prime number of whole periods so we do not get spurious tones in the frequency response. Note that the FFT assumes the input is periodic. If not, we will get spectral leakage.
  • We choose the number of samples to be integer powers of 2, e.g. 1024, 2048, 4096, etc. so we can take advantage of the FFT algorithm's speedup.

For example, using this Python script, let us set a sampling frequency, , and generate a sinusoid with 673 periods, with the number of samples . Let us then choose a sinusoid that is an integer multiple of . Thus, we get . The spectrum of our single sinusoid is shown in Fig. 3.

Figure 3: The spectrum of a single tone at .
Figure 4: The spectrum of the output of a nonlinear stage.

If we pass this input sinusoid through a nonlinear stage with , , and , we get the spectrum in Fig. 4. As expected, we get the second and third harmonic frequency components at and respectively.

Note that the y-axis of Figs. 3 and 4 are normalized to the fundamental, i.e. the fundamental will always have a value of 0dB. Also, we can see that the numeric noise floor is around -300dB, due to the finite floating point range of the computer I am using. In real systems, we will be limited by electronic noise, which we will cover in the next module.

We can define the fractional harmonic distortion metric as the ratio of the amplitude of the harmonic to the fundamental. Thus, we can calculate the second fractional harmonic distortion, (), as:

 

 

 

 

(4)

And the third fractional harmonic distortion, (), as:

 

 

 

 

(5)

This agrees with our FFT results.

Activity 1

Modify the Python script used above to:

  1. Generate the frequency spectrum of two tones with and .
  2. Then plot the spectrum when the two input tones are passed through a nonlinear stage with , , and .
  3. Compare the frequency locations of the harmonic and intermodulation tones to their theoretical locations.
  4. Compare the simulated and theoretical values of the harmonic and intermodulation terms.

Submissions

Submit via email a 1-page report, excluding the graphs, detailing how you performed the steps outlined above. Include your graphs in your report.

Activity 2