Engee documentation

demod

Page in progress.

Demodulation for modeling communication systems.

Library

EngeeDSP

Syntax

Function call

  • x = demod(y, fc, fs, method, opt) — demodulates a real useful signal y using carrier frequency usage 'fc`, sampling rates fs and the method method with additional parameters specified in opt.

  • x = demod(y, fc, fs, method) — demodulates a real useful signal y using carrier frequency usage 'fc`, sampling rates fs and the method method.

Arguments

Input arguments

# opt — additional parameters for some methods
Arbitrary type

Details

Additional parameters for some methods. For more information, see method.

Data types

Float32, Float64, Char, String

Support for complex numbers

Yes

# fs — sampling rate
Arbitrary type

Details

The sampling rate specified as a real positive scalar.

# method — The modulation method
Arbitrary type

Details

The modulation method used, possible values:

  • "am" or "amdsb-sc" — amplitude demodulation, two side bands, suppressed carrier. Multiplies y on a sinusoid with frequency fc and applies a fifth-order Butterworth low-pass filter using the filtfilt function.

    x = y.*cos(2*pi*fc*t);
    [b,a] = butter(5,fc*2/fs);
    x = filtfilt(b,a,x);
  • amdsb-tc — amplitude demodulation, two side bands, transmitted carrier. Multiplies y on a sinusoid with frequency fc and applies a fifth-order Butterworth low-pass filter using the filtfilt function.

    x = y.*cos(2*pi*fc*t);
    [b,a] = butter(5,fc*2/fs);
    x = filtfilt(b,a,x);

    If you specify opt, demod will subtract the scalar value opt from x. The default value for the opt parameter is `0'.

  • "amssb" — amplitude demodulation. Multiplies y on a sinusoid with frequency fc and applies a fifth-order Butterworth low-pass filter using the filtfilt function.

    x = y.*cos(2*pi*fc*t);
    [b,a] = butter(5,fc*2/fs);
    x = filtfilt(b,a,x);
  • "fm" — frequency demodulation. Demodulates the shape of a frequency-modulated (FM) signal by modulating the Hilbert transform y using a complex exponential frequency`-fc` Hz and gets an instantaneous frequency as a result.

    y=cos(2*pi*fc*t + opt*cumsum(x))

    The function cumsum is a rectangular approximation of the integral of x. The modulate function uses opt as a frequency modulation constant. If you do not specify the value opt, then modulate uses the default value opt=(fc/fs)*2*pi/(max(max(x))), therefore the maximum frequency deviation from fc`will be `fc Hz.

  • "pm" — phase demodulation. Demodulates the shape of a phase-modulated (FM) signal by modulating the Hilbert transform y using a complex exponential frequency`-fc` Hz and gets an instantaneous phase as a result.

    y=cos(2*pi*fc*t + opt*x)

    The modulate function uses opt as a phase modulation constant. If you do not specify the value opt, then modulate uses the default value opt=pi/(max(max(x))), so the maximum phase deviation will be glad.

  • pwm" ` pulse width demodulation. Defines the pulse width of the pulse width modulated signal `y. The demod function returns to x is a vector whose elements determine the duration of each pulse in fractions of a period. Pulses in y must start from the beginning of each carrier period, meaning they must be aligned to the left. When calling the function modulate(x,fc,fs,"pwm","centered")"the pulses are centered at the beginning of each period. Length `y is equal to `length(x)*fs/fc'.

  • "ppm" — positional pulse demodulation. Defines the pulse positions in the pulse-position modulated signal y. For proper demodulation, the pulses should not overlap. Length x is equal to `length(t)*fc/fs'.

  • "qam" is quadrature amplitude demodulation. The function [x1,x2] = demod(y,fc,fs,"qam") multiplies y by cosine and sine with frequency fc and applies a fifth-order Butterworth low-pass filter using `filtfilt'.

    x1 = y.*cos(2*pi*fc*t);
    x2 = y.*sin(2*pi*fc*t);
    [b,a] = butter(5,fc*2/fs);
    x1 = filtfilt(b,a,x1);
    x2 = filtfilt(b,a,x2);

    The input argument opt must be of the same dimension as `y'.

# fc — carrier frequency
Arbitrary type

Details

The carrier frequency used to modulate the useful signal is given as a real positive scalar.

# y — modulated signal
Arbitrary type

Details

A modulated useful signal specified as a real vector or matrix. The signal y has the same dimension as x, except for the methods method: "pwm" and "ppm".

Output arguments

# x — demodulated useful signal

Details

A demodulated useful signal returned as a real vector or matrix.