# Frequency Modulation (FM) Matlab Tutorial.- Part 2

In this post we are going to apply what we learnt about the FM signal’s properties in our last post. We will do some exercises in Matlab by using the functions fmmod  and fmdemod. Remember the three cases that we will study:

1. fc and fm have the same values and Af will change
2. fc and Af have the same values and fm will change
3. Af and fm have the same values and fc will change

## EXERCISE 1: fc and fm have the same values and Af will change

Using the function fmmod study the following cases:
1. fc=100 kHz and fm=1000 Hz and Af=100 Hz.
2. fc=100 kHz and fm=1000 Hz and Af=500 Hz.
3. fc=100 kHz and fm=1000 Hz and Af=1000 Hz.
4. fc=100 kHz and fm=1000 Hz and Af=2000 Hz.
5. fc=100 kHz and fm=1000 Hz and Af=5000 Hz.
When we change the value of the frequency deviation, Af, we are changing the modulation index (named β or h): Therefore, we have the following values for the modulation index corresponding to the five values of Af:
1. For Af=100 Hz, h=0.1.
2. For Af=500 Hz, h=0.5.
3. For Af=1000 Hz, h=1.
4. For Af=2000 Hz, h=2.
5. For Af=5000 Hz, h=5.
Now, according to the previous calculations we have the following FM spectrum in Matlab for each case: Figure 1. FM signals’ spectrum (Group 1)
As you can observe, the properties studied in our previous posts are represented here: when β (also named h) is smaller than the unit, the coefficients J0 and J1  are the ones with a significant value. You can observe, by zooming the plot, that when β is smaller than the unit, the spectrum just have two deltas and when we increase β, the number of deltas increases.
When β<=1, the spectrum is formed by the carrier frequency and a couple of lateral frequencies.
When increasing the value of β, the number of lateral frequencies increases and the amplitude of the carrier component decreases: this happens because the signal envelope (in the time domain) is constant, according to the expression: In addition, you can observe from the previous graph than when Af is smaller, fm is closer to fc and when increasing Af, fm and fc are everytime more separated.

## EXERCISE 2: fc and Af have the same values and fm will change

Using the function fmmod study the following cases:
1. fc=100 kHz and fm=100 Hz and Af=10000 Hz.
2. fc=100 kHz and fm=500 Hz and Af=10000 Hz.
3. fc=100 kHz and fm=1000 Hz and Af=10000 Hz.
4. fc=100 kHz and fm=5000 Hz and Af=10000 Hz.
Therefore, in this case we are modifying the modulation frequency, fm. Also, note that the parameter Af represents the change in frequency that it’s produced in the carrier when the modulation signal is applied.
In this case, we have the following values for the modulation index corresponding to the five values of fm:
1. For fm=100 Hz, h=100.
2. For fm=500 Hz, h=20.
3. For fm=1000 Hz, h=10.
4. For fm=5000 Hz, h=2.
The spectrum of the modulated signal will present a different number of deltas inside a bandwidth of Af; when increasing fm, the number of deltas increases and the number of deltas will decrease: Figure 2. FM signals’ spectrum (Group 2)
If you zoom the image, you will see that the bandwidth, Af, is the same all the cases (in the first one, you can’t appreciate this effect properly, due to the sampling error produced by Matlab, as we explained in this post).

## EXERCISE 3: fm and Af have the same values and fc will change

Using the function fmmod study the following cases:
1. fc=200 kHz and fm=11000 Hz and Af=30000 Hz.
2. fc=210 kHz and fm=11000 Hz and Af=30000 Hz.
3. fc=220 kHz and fm=11000 Hz and Af=30000 Hz.
Therefore, in this case, we are changing the carrier frequency. By observing the expression for the modulated signal in the frequency domain, we can deduce that for different values of fc, the deltas will be placed in different frequencies: Also, if the frequency deviation and the frequency of the modulation signal stay constant, the phase deviation too. In this case, you can check that β=2’73.
Therefore, if β is constant we can conclude that the variation will be in the Bessel’s coefficients: Figure 3. Bessel’s functions of first order
In other words, for the same value of β, the amplitudes of the Bessel’s coefficients are different.
Given a modulation index β, the first Bessel functions, J0,J1….Jcorrespond with the amplitudes of the lateral bands in the following way:
• The Bessel function of order 0, J0,produces a scalar which is the coefficient for the amplitude of the carrier signal.
• The Bessel function of order 1, J1,produces the coefficients for the amplitudes of the first bands above and below of the carrier signal.
• The Bessel function of order 2, J2,produces the coefficients for the amplitudes of the second bands above and below of the carrier signal, and so on.
• The bigger the order, the bigger the modulation index needs to be for this frequency to have a significant amplitude.

For this case, we obtain the following spectra: Figure 4. FM signals’ spectrum (Group 3)
This means that if our FM carrier signal is: The coefficients ak can be calculated by using the Bessel’s functions of first order and order k, as we commented above.

### Conclusions

In this tutorial we have been working with some of the fundamental parameters of FM signals. We have studied the spectrum because the frequency domain provides the information and variation of this parameters.
If you found this tutorial useful or you have questions, please leave a comment below. Also, you can comment suggesting future topics. In the meantime, we are preparing an ASK Modulation Matlab tutorial 😉