REW

What Is FM Signal In MATLAB?

Published Aug 29, 2025 6 min read
On this page

An FM (Frequency Modulation) signal in MATLAB is a digital representation of a signal where the instantaneous frequency of a carrier wave is varied in proportion to the amplitude of a message signal.

MATLAB provides robust, high-level functions and objects, primarily within the Communications Toolbox, to easily create, analyze, and process these signals without needing to code the underlying modulation principles from scratch.

The mathematical representation of an FM signal, y(t)y open paren t close paren

𝑦(𝑑)

, is given by:y(t)=Accos(2Ο€fct+2Ο€kf∫0tm(Ο„)dΟ„)y open paren t close paren equals cap A sub c cosine open paren 2 pi f sub c t plus 2 pi k sub f integral from 0 to t of m open paren tau close paren d tau close paren

𝑦(𝑑)=𝐴𝑐cos(2πœ‹π‘“π‘π‘‘+2πœ‹π‘˜π‘“π‘‘0π‘š(𝜏)π‘‘πœ)

Where:

  • Accap A sub c

    𝐴𝑐

    is the carrier amplitude (constant).

  • fcf sub c

    𝑓𝑐

    is the carrier frequency.

  • m(t)m open paren t close paren

    π‘š(𝑑)

    is the message signal (also called the modulating signal).

  • kfk sub f

    π‘˜π‘“

    is the frequency sensitivity, which determines how much the carrier frequency deviates for a given change in the message signal's amplitude.

  • The integral of the message signal represents the instantaneous phase of the FM signal, making it a form of phase modulation.

In MATLAB, this complex process is abstracted into simple function calls, allowing engineers and students to focus on the application and analysis rather than the low-level implementation.

Creating an FM signal in MATLAB

The most straightforward way to create an FM signal in MATLAB is by using the fmmod function, which is part of the Communications Toolbox.

Basic syntax:y = fmmod(x, Fc, Fs, freqdev)

  • x: The message signal (the information you want to transmit).
  • Fc: The carrier frequency.
  • Fs: The sampling frequency of the system.
  • freqdev: The frequency deviation, or the maximum shift in frequency away from the carrier frequency.

**Example:**To modulate a simple tone, you would follow these steps:

% --- Define signal parameters ---
Fs = 10000;              % Sampling frequency (Hz)
t = 0:1/Fs:0.2-1/Fs;     % Time vector for 0.2 seconds
Fc = 1000;               % Carrier frequency (Hz)
fDev = 500;              % Frequency deviation (Hz)
% --- Create a message signal (a simple sine wave) ---
fm = 50;                 % Message signal frequency (Hz)
x = sin(2*pi*fm*t);      % The message signal
% --- Perform frequency modulation ---
y = fmmod(x, Fc, Fs, fDev);
% --- Plot the results ---
subplot(2,1,1);
plot(t, x);
title('Original Message Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(2,1,2);
plot(t, y);
title('Frequency Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');

Use code with caution.

In this plot, you would observe that the FM signal's frequency is high when the message signal's amplitude is positive and high, and low when the message signal's amplitude is negative and low.

Analyzing an FM signal

MATLAB provides powerful tools for analyzing the characteristics of an FM signal.

Time-domain analysis

By plotting the signal against time, you can visually observe the frequency variation. As seen in the example code, plotting the message signal and the modulated signal together provides a clear, intuitive view of the modulation process.

Frequency-domain analysis

This is a critical step for understanding an FM signal's bandwidth. The Fast Fourier Transform (fft) function is used to convert the signal from the time domain to the frequency domain.

Example:

% ... (previous code to create FM signal y) ...
% --- Perform FFT to get the frequency spectrum ---
N = length(y);                   % Length of the signal
Y_fft = fft(y, N);               % Perform FFT
Y_fft_shifted = fftshift(Y_fft);  % Shift zero-frequency component to center
% --- Create frequency vector for plotting ---
f_axis = (-N/2:N/2-1) * (Fs/N);
% --- Plot the frequency spectrum ---
figure;
plot(f_axis, abs(Y_fft_shifted));
title('Frequency Spectrum of FM Signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
xlim([Fc-2*fDev, Fc+2*fDev]); % Zoom in on the relevant spectrum

Use code with caution.

The resulting plot will show the central carrier frequency with sidebands. According to Carson's Bandwidth Rule, the bandwidth of an FM signal can be estimated as BWβ‰ˆ2(Ξ”f+fm)cap B cap W is approximately equal to 2 open paren delta f plus f sub m close paren

π΅π‘Šβ‰ˆ2(Δ𝑓+π‘“π‘š)

, where Ξ”fdelta f

Δ𝑓

is the frequency deviation and fmf sub m

π‘“π‘š

is the maximum frequency of the message signal. The spectral plot will visually confirm this, showing a spread of frequencies around the carrier.

Demodulation

After creating and analyzing an FM signal, the next step is often to demodulate it to recover the original message signal. This can be done using the fmdemod function.

Example:

% ... (previous code to create FM signal y) ...
% --- Demodulate the FM signal ---
z = fmdemod(y, Fc, Fs, fDev);
% --- Plot original and demodulated signals for comparison ---
figure;
plot(t, x, 'b', t, z, 'r--');
title('Original vs. Demodulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
legend('Original Signal', 'Demodulated Signal');
grid on;

Use code with caution.

The plot will show that the demodulated signal closely approximates the original message signal, confirming that the modulation and demodulation process was successful.

Advanced FM processing with System Objects

For more complex or streaming applications, MATLAB's Communications Toolbox offers System objects like comm.FMModulator and comm.FMDemodulator. These objects provide several advantages:

  • Persistent state: The objects maintain properties from one function call to the next, which is useful for processing signals in a streaming fashion.
  • System-level design: They integrate seamlessly into larger system-level simulations, particularly within the Simulink environment.
  • Enhanced features: They offer more advanced properties and controls than the basic functions.

Example using comm.FMModulator:

% --- Create the modulator and demodulator objects ---
Fs = 10000;
fc = 1000;
fDev = 500;
fmModulator = comm.FMModulator('SampleRate', Fs, 'FrequencyDeviation', fDev);
fmDemodulator = comm.FMDemodulator(fmModulator); % Configure demod based on modulator
% --- Create a message signal ---
t = (0:1/Fs:0.5-1/Fs)';
x = sin(2*pi*50*t);
% --- Modulate, demodulate, and plot ---
y_obj = fmModulator(x);
z_obj = fmDemodulator(y_obj);
figure;
plot(t, [x, z_obj]);
title('Original vs. Demodulated Signal (System Objects)');
legend('Original Signal', 'Demodulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');

Use code with caution.

This example shows that System objects offer a more structured and organized way of handling modulation and demodulation, especially for complex systems.

Applications of FM in MATLAB

The ability to create, analyze, and process FM signals in MATLAB is fundamental for various applications:

  • Radio communication systems: Simulating and designing FM radio transmitters and receivers is a classic use case for MATLAB.
  • Spectrum analysis: FM signals can be used to study and analyze signal processing techniques, such as measuring bandwidth and observing sideband characteristics.
  • Noise reduction analysis: FM is known for its resistance to noise, and MATLAB allows engineers to simulate and quantify this advantage compared to other modulation schemes like AM.
  • Software-defined radio (SDR): Combining MATLAB with SDR hardware enables real-time reception, processing, and demodulation of live FM radio broadcasts.
  • Telecommunications education: MATLAB's visual and functional capabilities make it an excellent tool for teaching and learning the principles of frequency modulation.
Enjoyed this article? Share it with a friend.