Engee documentation

modulate

Page in progress.

Modulation for modeling communication systems.

Library

EngeeDSP

Syntax

Function call

  • (y,t) = modulate(x, fc, fs, method, opt) — modulates a real useful signal x using carrier frequency usage 'fc`, sampling rates fs and the method method with additional parameters specified in opt and returns the internal time vector t.

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

  • (y,t) = modulate(x, fc, fs) — modulates a real useful signal x using carrier frequency usage 'fc` and sampling rates fs. If x is a matrix, then the modulated signal is calculated independently for each column and stored in the corresponding column y.

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 modulation, two side bands, suppressed carrier. Multiplies x on a sinusoid with a frequency fc.

    y = x.*cos(2*pi*fc*t)
  • amdsb-tc — amplitude modulation, two side bands, transmitted carrier. Subtracts the scalar value opt from x and multiplies the result by a sinusoid with a frequency fc.

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

    If you do not specify opt, then modulate uses the default value min(min(x)) so that the useful signal (x-opt) is non-negative and has a minimum value of `0'.

  • amssb — amplitude modulation, single sideband. Multiplies x on a sinusoid with frequency fc and adds the result to the Hilbert transform x multiplied by a phase - shifted sinusoid with frequency fc.

    y = x.*cos(2*pi*fc*t)+imag(hilbert(x)).*sin(2*pi*fc*t)

    This method effectively eliminates the upper sideband.

  • "fm" — frequency modulation. Creates a sinusoid with an instantaneous frequency that varies depending on the useful signal x.

    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 modulation. Creates a sinusoid with a frequency of fc`the phase of which varies depending on the useful signal `x.

    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" is pulse width modulation. Creates a modulated pulse width signal based on the pulse lengths in `x. Elements of x are in the range from 0 to 1 and determine the duration of each pulse in fractions of a period. The pulses start at the beginning of each carrier period, meaning they are aligned to the left. When calling the function modulate(x,fc,fs,"pwm","centered")"the pulses are centered at the beginning of each period. The length of `_(y,t) is equal to length(x)*fs/fc.

  • "ppm" — pulse-position modulation. Creates a pulse-position modulated signal from the pulse positions in x. Elements of x are in the range from 0 to 1, setting the left edge of each pulse in fractions of a period. The value opt is a scalar from 0 to 1, which defines the length of each pulse in fractions of a period. The default value for opt is 0.1'. The length of `_(y,t) is equal to length(x)*fs/fc.

  • "qam" is quadrature amplitude modulation. Creates a signal using quadrature amplitude modulation from the signals x and opt.

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

    The input argument opt must be of the same dimension as x.

# x — a useful signal
Arbitrary type

Details

a useful signal defined as a real vector or matrix.

# fc — carrier frequency
Arbitrary type

Details

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

Output arguments

# y — modulated useful signal

Details

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

# t — the internal time vector

Details

The internal time vector.