Noise analysis is used to calculate the noise power spectral density generated by a circuit and the total noise power over a specified frequency range. Noise sources considered in the analysis only include thermal, shot and flicker noise generated by the circuit components using the same models described in class. The syntax for noise analysis presented here is valid for ngspice and spice3-based simulators. Other variants of spice may have a different syntax.

The basic syntax for noise analysis is the following:

```
noise v(output <,ref>) src ( dec | lin | oct ) pts fstart fstop
```

example:

```
noise v(5) vin lin 100 1kHz 100kHz
```

The first argument specifies the output noise port, in the example the output port is between node 5 and ground.

The second argument specifies the input port to refer noise. This port is specified by the name of the input voltage source (called vin in this example).

The next 4 arguments specify a frequency sweep using the same notation
as in *Small-Signal Analysis (AC)*.

Note: in some spice versions the noise analysis is combined with the AC analysis and the syntax is somewhat different.

We now perform noise analysis on the RF switch circuit:

```
*** RF switch circuit ***
* Input source
vs 1 0 dc 0V ac 1V sin(0V 1V 100MegHz 20ns 0)
Rs in 1 50ohm
* Switch
Ci in 4 1.6nF
Rb 4 3 2.1k
Lc1 3 2 100uH
D1 4 50 mydiode
vmeter 50 5 dc 0
Lc2 5 0 100uH
cout 5 out 1.6n
* Load
Rload out 0 1k
* DC biasing
vcc 2 0 5V
.model mydiode d (is=1e-15A n=1)
.end
```

The objective is to plot the power spectral density at the output node (out) and print the total noise power at the same node over a frequency range from 1MHz to 100MHz. First the analysis is performed and the output and input-referred noise is printed:

```
ngspice 496 -> noise v(out) vs dec 10 1MegHz 100MegHz
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
No. of Data Rows : 21
No. of Data Rows : 1
ngspice 497 -> display
Here are the vectors currently active:
Title: *** rf switch circuit ***
Name: noise4 (Integrated Noise - V^2 or A^2)
Date: Wed Sep 11 16:08:44 2013
inoise_total : voltage, real, 1 long
onoise_total : voltage, real, 1 long [default scale]
ngspice 498 -> print inoise_total, onoise_total
inoise_total = 9.973860e-11
onoise_total = 8.843864e-11
ngspice 499 ->
```

Output noise is given in `V^2`. Input-referred noise may be in
`V^2` or `A^2` depending on the type of source specified in the
noise analysis.The input-referred noise power is greater than the
output noise power because the switch is attenuating noise in addition
to attenuate the signal.

In order to plot the power spectral density, we must select the “noise1” plot set first:

```
ngspice 2 -> setplot
Type the name of the desired plot:
new New plot
Current noise2 *** rf switch circuit *** (Integrated Noise - V^2 or A^2)
noise1 *** rf switch circuit *** (Noise Spectral Density Curves - (V^2 or A^2)/Hz)
const Constant values (constants)
? noise1
ngspice 2 -> display
Here are the vectors currently active:
Title: *** rf switch circuit ***
Name: noise1 (Noise Spectral Density Curves - (V^2 or A^2)/Hz)
Date: Fri Nov 9 23:51:08 2012
frequency : frequency, real, 21 long, grid = xlog [default scale]
inoise_spectrum : inoise-spectrum, real, 21 long
onoise_spectrum : onoise-spectrum, real, 21 long
ngspice 2 -> plot onoise_spectrum
```

The plot of the noise power spectral density (PSD) is shown below. The
units of the y-axis are `V^2/Hz`. NGspice plots the actual power
spectral density, not the square root.

The output noise power was calculated by ngspice by numerically integrating the PSD over the frequency range specified in the noise analsysis line.