# FM spectrum analysis

In this demo, we will look at the spectrum of a frequency modulated signal, with the intent of exploring the effect of overmodulation on bandwidth.

The circuit is simple, just a voltage source, with a Spice-style “SFFM” waveform. We will use parameters to tinker with the signal, and the Fourier command to display the spectrum. You could calculate the spectrum using Bessel functions, but we will look at it with simulation.

## Setting up

First, the circuit. Enter it with the “build” command:

```gnucap> build
> v1 ( 1 0 ) sffm (carrier={carrier} modindex={mod/signal} signal={signal})
>       **** blank line exits build mode
gnucap>```

Now, set up the parameters:

```gnucap> param carrier=10Meg
gnucap> param signal=10K
gnucap> param mod=75K```

This sets up a signal of 10 KHz with the usual maximum deviation of 75 KHz. This is not overmodulated. I chose a carrier frequency of 10 MHz for convenience. 100 MHz would be more realistic but would take longer to run. It doesn't really matter, and 10 MHz is close to the usual intermediate frequency of 10.7 MHz.

Now, set up the sweep parameters:

```gnucap> param start={carrier-2*(mod+signal)}
gnucap> param stop={carrier+2*(mod+signal)}
gnucap> param step={signal}```

Carson's rule estimates the bandwidth to be 2*(mod+signal), so we will cover a range of twice that, in steps equal to the modulating frequency. If you look at the Bessel functions, you will see that this is corresponds to the actual signal.

Now, set up a probe:

`gnucap> probe fourier v(1)`

## The first run

Try one .. look at the spectrum:

`gnucap> fourier {start} {stop} {step}`

You will see the time points of a transient run, then the spectrum over the range you asked for.

```# v(1)      --------- actual ---------  -------- relative --------
#freq       value        dB      phase  value        dB      phase
9.83Meg    7.2578u   -102.78   93.604  20.494u    -93.77 -179.033
9.84Meg    31.322u    -90.08  -86.484  88.446u    -81.07    0.879
9.85Meg    126.38u    -77.97   93.428  356.88u    -68.95 -179.209
9.86Meg    474.21u    -66.48  -86.660  0.0013391  -57.46    0.703
9.87Meg    0.001644   -55.68   93.252  0.0046423  -46.67 -179.385
9.88Meg    0.005225   -45.64  -86.836  0.014754   -36.62    0.527
9.89Meg    0.015076   -36.43   93.076  0.042571   -27.42 -179.561
9.9Meg     0.038998   -28.18  -87.012  0.11012    -19.16    0.352
9.91Meg    0.088919   -21.02   92.900  0.25108    -12.00 -179.736
9.92Meg    0.17441    -15.17  -87.188  0.49248     -6.15    0.176
9.93Meg    0.28315    -10.96   92.725  0.79954     -1.94 -179.912
9.94Meg    0.35414     -9.02  -87.363  1.           0.00   -0.000
9.95Meg    0.28347    -10.95   92.549  0.80046     -1.93  179.912
9.96Meg    0.023825   -32.46  -87.539  0.067275   -23.44   -0.176
9.97Meg    0.25806    -11.77  -87.627  0.7287      -2.75   -0.264
9.98Meg    0.23027    -12.76   92.285  0.65023     -3.74  179.648
9.99Meg    0.13525    -17.38   92.197  0.38191     -8.36  179.561
10.Meg     0.26634    -11.49  -87.891  0.75207     -2.47   -0.527
10.01Meg   0.13525    -17.38  -87.979  0.38191     -8.36   -0.615
10.02Meg   0.23027    -12.76   91.934  0.65023     -3.74  179.297
10.03Meg   0.25806    -11.77   91.846  0.7287      -2.75  179.209
10.04Meg   0.023825   -32.46  -88.242  0.067275   -23.44   -0.879
10.05Meg   0.28347    -10.95  -88.330  0.80046     -1.93   -0.967
10.06Meg   0.35414     -9.02  -88.418  1.          -0.00   -1.055
10.07Meg   0.28315    -10.96  -88.506  0.79954     -1.94   -1.143
10.08Meg   0.17441    -15.17  -88.594  0.49248     -6.15   -1.230
10.09Meg   0.088919   -21.02  -88.682  0.25108    -12.00   -1.318
10.1Meg    0.038998   -28.18  -88.770  0.11012    -19.16   -1.406
10.11Meg   0.015076   -36.43  -88.857  0.042571   -27.42   -1.494
10.12Meg   0.005225   -45.64  -88.945  0.014754   -36.62   -1.582
10.13Meg   0.001644   -55.68  -89.033  0.0046423  -46.67   -1.670
10.14Meg   474.22u    -66.48  -89.121  0.0013391  -57.46   -1.758
10.15Meg   126.38u    -77.97  -89.209  356.88u    -68.95   -1.846
10.16Meg   31.323u    -90.08  -89.297  88.447u    -81.07   -1.934
10.17Meg   7.2581u   -102.78  -89.385  20.495u    -93.77   -2.021
gnucap>```

As a quick check .. For a modulation index of 7.5, the fourth sideband should have a null, or close to it. It does.

Another quick check .. Carson's rule says the bandwidth should be about 2*(mod+signal) or 2*(10K+75K), or 85K on each side. It's pretty close. It looks like the real bandwidth is probably a little more.

## Now experiment

Let's try a modulating frequency of 50 KHz, roughly the top of the stereo subcarrier.

```gnucap> param signal=50k
gnucap> fourier
#Time       v(1)
0.0025    -0.99968
0.0025     0.8       ```
``` 0.0025199  0.76861
0.00252   -0.99968
# v(1)      --------- actual ---------  -------- relative --------
#freq       value        dB      phase  value        dB      phase
9.75Meg    0.0017994  -54.90   94.307  0.0032251  -49.83    1.758
9.8Meg     0.011768   -38.59  -86.133  0.021092   -33.52 -178.682
9.85Meg    0.060964   -24.30   93.428  0.10927    -19.23    0.879
9.9Meg     0.23209    -12.69  -87.012  0.41598     -7.62 -179.561
9.95Meg    0.55794     -5.07   92.549  1.           0.00    0.000
10.Meg     0.51183     -5.82  -87.891  0.91736     -0.75  179.561
10.05Meg   0.55794     -5.07  -88.330  1.          -0.00  179.121
10.1Meg    0.23209    -12.69  -88.770  0.41598     -7.62  178.682
10.15Meg   0.060964   -24.30  -89.209  0.10927    -19.23  178.242
10.2Meg    0.011768   -38.59  -89.648  0.021092   -33.52  177.803
10.25Meg   0.0017994  -54.90  -90.088  0.0032251  -49.83  177.363
gnucap>```

Mod index is 1.5, so the spectrum is simpler, Carson's rule predicts 50K+75K, or 125K each side. Again, it seems the real signal takes more space. Check the Bessel functions, from a graph … about .55, .55, .2 .. it matches as well as I read the graph.

The signal is really pretty wide. Try half of the deviation ..

```gnucap> param mod=37.5K
gnucap> fourier
#Time       v(1)
0.00252   -0.99952   ```
``` 0.0025399  0.75896
0.00254   -0.99952
# v(1)      --------- actual ---------  -------- relative --------
#freq       value        dB      phase  value        dB      phase
9.85Meg    0.0084844  -41.43   93.428  0.0098171  -40.16 -178.682
9.9Meg     0.067074   -23.47  -87.012  0.07761    -22.20    0.879
9.95Meg    0.34924     -9.14   92.549  0.4041      -7.87 -179.561
10.Meg     0.86424     -1.27  -87.891  1.           0.00   -0.000
10.05Meg   0.34924     -9.14  -88.330  0.4041      -7.87   -0.439
10.1Meg    0.067074   -23.47  -88.770  0.07761    -22.20   -0.879
10.15Meg   0.0084844  -41.43  -89.209  0.0098171  -40.16   -1.318
10.2Meg    801.07u    -61.93  -89.648  926.9u     -60.66   -1.758
gnucap> ```

So now you see why the FCC limit on deviation is lower for higher modulation frequencies.

Let's try overmodulating.

```gnucap> param signal=10K
gnucap> param mod=150K
gnucap> fourier```
```# v(1)      --------- actual ---------  -------- relative --------
#freq       value        dB      phase  value        dB      phase
9.68Meg    6.6294n   -163.57    0.001  23.786n   -152.47 -179.999
9.69Meg    26.707n   -151.47  180.000  95.822n   -140.37   -0.000
9.7Meg     103.74n   -139.68    0.000  372.23n   -128.58 -180.000
9.71Meg    388.29n   -128.22  180.000  1.3931u   -117.12   -0.000
9.72Meg    1.3976u   -117.09    0.000  5.0145u   -106.00 -180.000
9.73Meg    4.8295u   -106.32  180.000  17.328u    -95.23   -0.000
9.74Meg    15.989u    -95.92    0.000  57.365u    -84.83 -180.000
9.75Meg    50.597u    -85.92  180.000  181.54u    -74.82   -0.000
9.76Meg    152.67u    -76.32   -0.000  547.76u    -65.23 -180.000
9.77Meg    437.95u    -67.17  180.000  0.0015713  -56.07   -0.000
9.78Meg    0.0011904  -58.49   -0.000  0.0042709  -47.39 -180.000
9.79Meg    0.0030538  -50.30  180.000  0.010957   -39.21   -0.000
9.8Meg     0.0073602  -42.66   -0.000  0.026408   -31.57 -180.000
9.81Meg    0.016574   -35.61  180.000  0.059464   -24.51    0.000
9.82Meg    0.034626   -29.21   -0.000  0.12423    -18.12 -180.000
9.83Meg    0.066529   -23.54  180.000  0.2387     -12.44    0.000
9.84Meg    0.11617    -18.70   -0.000  0.41682     -7.60 -180.000
9.85Meg    0.18131    -14.83  180.000  0.65051     -3.73    0.000
9.86Meg    0.24644    -12.17   -0.000  0.8842      -1.07 -180.000
9.87Meg    0.27871    -11.10  180.000  1.           0.00    0.000
9.88Meg    0.23667    -12.52   -0.000  0.84913     -1.42  180.000
9.89Meg    0.09995    -20.00  180.000  0.35861     -8.91   -0.000
9.9Meg     0.090072   -20.91  180.000  0.32317     -9.81   -0.000
9.91Meg    0.22005    -13.15   -0.000  0.7895      -2.05  180.000
9.92Meg    0.17398    -15.19  180.000  0.62424     -4.09   -0.000
9.93Meg    0.034464   -29.25  180.000  0.12365    -18.16   -0.000
9.94Meg    0.20615    -13.72   -0.000  0.73964     -2.62  180.000
9.95Meg    0.13046    -17.69  180.000  0.46806     -6.59   -0.000
9.96Meg    0.11918    -18.48  180.000  0.4276      -7.38   -0.000
9.97Meg    0.19402    -14.24   -0.000  0.69612     -3.15  180.000
9.98Meg    0.041572   -27.62   -0.000  0.14915    -16.53  180.000
9.99Meg    0.2051     -13.76  180.000  0.73589     -2.66   -0.000
10.Meg     0.014224   -36.94  180.000  0.051036   -25.84   -0.000
10.01Meg   0.2051     -13.76   -0.000  0.73589     -2.66  180.000
10.02Meg   0.041572   -27.62   -0.000  0.14915    -16.53  180.000
10.03Meg   0.19402    -14.24  180.000  0.69612     -3.15   -0.000
10.04Meg   0.11918    -18.48  180.000  0.4276      -7.38   -0.000
10.05Meg   0.13046    -17.69   -0.000  0.46806     -6.59  180.000
10.06Meg   0.20615    -13.72   -0.000  0.73964     -2.62  180.000
10.07Meg   0.034464   -29.25   -0.000  0.12365    -18.16  180.000
10.08Meg   0.17398    -15.19  180.000  0.62424     -4.09   -0.000
10.09Meg   0.22005    -13.15  180.000  0.7895      -2.05   -0.000
10.1Meg    0.090072   -20.91  180.000  0.32317     -9.81   -0.000
10.11Meg   0.09995    -20.00   -0.000  0.35861     -8.91  180.000
10.12Meg   0.23667    -12.52   -0.000  0.84913     -1.42  180.000
10.13Meg   0.27871    -11.10   -0.000  1.          -0.00  180.000
10.14Meg   0.24644    -12.17   -0.000  0.8842      -1.07  180.000
10.15Meg   0.18131    -14.83   -0.000  0.65051     -3.73  180.000
10.16Meg   0.11617    -18.70   -0.000  0.41682     -7.60  180.000
10.17Meg   0.066529   -23.54   -0.000  0.2387     -12.44  180.000
10.18Meg   0.034626   -29.21   -0.000  0.12423    -18.12  180.000
10.19Meg   0.016574   -35.61   -0.000  0.059464   -24.51  180.000
10.2Meg    0.0073602  -42.66   -0.000  0.026408   -31.57  180.000
10.21Meg   0.0030538  -50.30   -0.000  0.010957   -39.21  180.000
10.22Meg   0.0011904  -58.49   -0.000  0.0042709  -47.39 -180.000
10.23Meg   437.95u    -67.17   -0.000  0.0015713  -56.07 -180.000
10.24Meg   152.67u    -76.32   -0.000  547.76u    -65.23 -180.000
10.25Meg   50.597u    -85.92    0.000  181.54u    -74.82 -180.000
10.26Meg   15.989u    -95.92    0.000  57.365u    -84.83 -180.000
10.27Meg   4.8295u   -106.32    0.000  17.328u    -95.23 -180.000
10.28Meg   1.3976u   -117.09    0.000  5.0145u   -106.00 -180.000
10.29Meg   388.29n   -128.22    0.000  1.3932u   -117.12 -180.000
10.3Meg    103.75n   -139.68    0.000  372.26n   -128.58 -180.000
10.31Meg   26.712n   -151.47    0.000  95.838n   -140.37 -180.000
10.32Meg   6.6384n   -163.56    0.001  23.818n   -152.46 -179.999
gnucap> ```

As expected, the bandwidth is a a little more than 2*160k.

That's enough for now.