Main Content

comm.FMDemodulator

Demodulate baseband FM signal

Description

The comm.FMDemodulator System object™ demodulates a baseband FM signal.

To demodulate a baseband FM signal:

  1. Create the comm.FMDemodulator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

fmdemodulator = comm.FMDemodulator creates an FM demodulator System object.

fmdemodulator = comm.FMDemodulator(Name,Value) sets properties using one or more name-value arguments. For example, 'Samplerate',400e3 specifies a sample rate of 400 kHz.

example

fmdemodulator = comm.FMDemodulator(fmmodulator) sets properties based on the configuration of the input comm.FMModulator System object, fmmodulator.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Sample rate of the input signal in Hz, specified as a positive scalar. This property specifies the sample rate at the output of a modulator or at the input of a demodulator. The sample rate must be greater than twice the frequency deviation (that is, SampleRate > 2×FrequencyDeviation).

Data Types: double

Peak deviation of the output signal frequency in Hz, specified a positive scalar. The frequency deviation must be less than half the sample rate (that is, FrequencyDeviation < SampleRate/2).

The system bandwidth is BT = 2×(FrequencyDeviation + BM), where BM is the message bandwidth in Hz. For more information, see Algorithms.

Data Types: double

Usage

Description

example

outsig = fmdemodulator(insig) demodulates a baseband FM signal and outputs message data.

Input Arguments

expand all

Baseband FM signal, specified as a scalar or column vector.

This object accepts variable-size inputs. After the object is locked, you can change the size of each input channel, but you cannot change the number of channels. For more information, see Variable-Size Signal Support with System Objects.

Data Types: double | single | fi
Complex Number Support: Yes

Output Arguments

expand all

Message data, returned as a scalar or column vector of the same data type and size as the input insig.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Play back an audio file after applying FM modulation and demodulation by using System objects to process the data in streaming mode.

Load the audio file guitartune.wav by using an audio file reader System object™.

audiofilereader = dsp.AudioFileReader('guitartune.wav', ...
    'SamplesPerFrame',4410);

Create an audio device writer System object for audio playback.

audioplayer = audioDeviceWriter;

Create default FM modulator and demodulator System objects.

fmmod = comm.FMModulator;
fmdemod = comm.FMDemodulator;

Read the audio data, FM-modulate the audio data, FM-demodulate the FM-modulated signal, and play back the demodulated signal (z).

while ~isDone(audiofilereader)
    x = audiofilereader();
    y = fmmod(x);
    z = fmdemod(y);
    audioplayer(z);
end

Modulate and demodulate a sinusoidal signal. Plot the demodulated signal and compare it to the original signal.

Initialize parameters for the example.

fs = 100;  % Sample rate (Hz)
ts = 1/fs; % Sample period (s)
fd = 25;   % Frequency deviation (Hz)

Create a sinusoidal signal with a duration of 0.5 s and frequency of 4 Hz.

t = (0:ts:0.5-ts)';
x = sin(2*pi*4*t);

Create an FM modulator System object™, setting the sample rate and frequency deviation. Then, create an FM demodulator System object, using the FM modulator configuration to set the demodulator properties.

fmmodulator = comm.FMModulator( ...
    'SampleRate',fs, ...
    'FrequencyDeviation',fd);
fmdemodulator = comm.FMDemodulator(fmmodulator);

FM-modulate the signal and plot the real component of the complex signal. The frequency of the modulated signal changes with the amplitude of the input signal.

y = fmmodulator(x);
plot(t,[x real(y)])
title('Input Sinusoid and FM-Modulated Signals')
xlabel('Time (seconds)'); ylabel('Amplitude')
legend('Input signal','Modulated signal (real component)')

Demodulate the FM-modulated signal.

z = fmdemodulator(y);

Plot the original and demodulated signals. The demodulator output signal exactly aligns with the original signal.

plot(t,x,'r',t,z,'ks')
legend('Original signal','Demodulated signal')
xlabel('Time (s)')
ylabel('Amplitude')

Create an FM demodulator System object™ from an FM modulator System object. Modulate and demodulate audio data loaded from a file and compare the spectrum for the demodulated data and the input data.

Initialize parameters for the example.

fd = 50e3;  % Frequency deviation (Hz)
fs = 300e3; % Sample rate (Hz)

Create an FM modulator System object.

mod = comm.FMModulator( ...
    FrequencyDeviation=fd, ...
    SampleRate=fs);

Create an FM demodulator object by using the modulator to configure it.

demod = comm.FMDemodulator(mod);

Verify that the properties are identical in the two System objects.

mod
mod = 
  comm.FMModulator with properties:

            SampleRate: 300000
    FrequencyDeviation: 50000

demod
demod = 
  comm.FMDemodulator with properties:

            SampleRate: 300000
    FrequencyDeviation: 50000

Load audio data into the workspace.

S = load("handel.mat");
data = S.y;
fsamp = S.Fs;

Create a spectrum analyzer System object.

sa = spectrumAnalyzer( ...
    SampleRate=fsamp, ...
    ShowLegend=true);

FM-modulate and -demodulate the audio data.

modData = mod(data);
demodData = demod(modData);

Verify that the spectrum plot of the input data (Channel 1) aligns with that of the demodulated data (Channel 2).

sa([data demodData])
release(sa)

Algorithms

A frequency-modulated passband signal, Y(t), is given as

Y(t)=Acos(2πfct+2πfΔ0tx(τ)dτ),

where:

  • A is the carrier amplitude.

  • fc is the carrier frequency.

  • x(τ) is the baseband input signal.

  • fΔ is the frequency deviation in Hz.

The frequency deviation is the maximum shift from fc in one direction, assuming |x(τ)| ≤ 1.

A baseband FM signal can be derived from the passband representation by downconverting the passband signal by fc such that

ys(t)=Y(t)ej2πfct=A2[ej(2πfct+2πfΔ0tx(τ)dτ)+ej(2πfct+2πfΔ0tx(τ)dτ)]ej2πfct=A2[ej2πfΔ0tx(τ)dτ+ej4πfctj2πfΔ0tx(τ)dτ].

Removing the component at -2fc from yS(t) leaves the baseband signal representation, y(t), which is given as

y(t)=A2ej2πfΔ0tx(τ)dτ.

The expression for y(t) can be rewritten as y(t)=A2ejϕ(t), where ϕ(t)=2πfΔ0tx(τ)dτ. Expressing y(t) this way implies that the input signal is a scaled version of the derivative of the phase, ϕ(t).

To recover the input signal from y(t), use a baseband delay demodulator, as this figure shows.

Baseband FM demodulator

References

[1] Hatai, I., and I. Chakrabarti. “A New High-Performance Digital FM Modulator and Demodulator for Software-Defined Radio and Its FPGA Implementation.” International Journal of Reconfigurable Computing (December 25, 2011): 1–10. https://doi.org/10.1155/2011/342532.

[2] Taub, H., and D. Schilling. Principles of Communication Systems. McGraw-Hill Series in Electrical Engineering. New York: McGraw-Hill, 1971, pp. 142–155.

Extended Capabilities

Version History

Introduced in R2015a