Syntax
x = demod(y,fc,fs,'method'
)
x = demod(y,fc,fs,'method'
,opt)
x = demod(y,fc,fs,'pwm','centered')
Description
demod
performs
demodulation, that is, it obtains the original signal from a modulated
version of the signal. demod
undoes the operation
performed by modulate
.
x = demod(y,fc,fs,'method'
)
and
x = demod(y,fc,fs,'method'
,opt)
demodulate
the real carrier signal y
with a carrier frequency fc
and
sampling frequency fs
, using one of the options
listed below for method
. (Note that some
methods accept an option, opt
.)
Note:
Use demod and modulate in
the Signal Processing Toolbox™ with realvalued signals to obtain
realvalued outputs. demod and modulate are
not intended to accept complexvalued inputs or produce complexvalued
outputs. 
Method  Description 
amdsbsc
or am
 Amplitude demodulation, double sideband, suppressed
carrier. Multiplies y by a sinusoid of frequency fc and
applies a fifthorder Butterworth lowpass filter using filtfilt .
x = y.*cos(2*pi*fc*t);
[b,a]
= butter(5,fc*2/fs);
x = filtfilt(b,a,x);

amdsbtc
 Amplitude demodulation, double sideband, transmitted
carrier. Multiplies y by a sinusoid of frequency fc and
applies a fifthorder Butterworth lowpass filter using filtfilt . x = y.*cos(2*pi*fc*t);
[b,a]
= butter(5,fc*2/fs);
x = filtfilt(b,a,x);
If
you specify opt , demod subtracts
scalar opt from x . The default
value for opt is 0. 
amssb
 Amplitude demodulation, single sideband. Multiplies y by
a sinusoid of frequency fc and applies a fifthorder
Butterworth lowpass filter using filtfilt . x
= y.*cos(2*pi*fc*t);
[b,a] = butter(5,fc*2/fs);
x
= filtfilt(b,a,x);

fm
 Frequency demodulation. Demodulates the FM waveform by
modulating the Hilbert transform of y by a complex
exponential of frequency fc Hz
and obtains the instantaneous frequency of the result. 
pm
 Phase demodulation. Demodulates the PM waveform by modulating
the Hilbert transform of y by a complex exponential
of frequency fc Hz and obtains
the instantaneous phase of the result. 
ppm
 Pulseposition demodulation. Finds the pulse positions
of a pulseposition modulated signal y . For correct
demodulation, the pulses cannot overlap. x is length length(t)*fc/fs . 
pwm
 Pulsewidth demodulation. Finds the pulse widths of a
pulsewidth modulated signal y . demod returns
in x a vector whose elements specify the width
of each pulse in fractions of a period. The pulses in y should
start at the beginning of each carrier period, that is, they should
be left justified. 
qam
 Quadrature amplitude demodulation. [x1,x2]
= demod(y,fc,fs,'qam') multiplies y by
a cosine and a sine of frequency fc and applies
a fifthorder Butterworth lowpass 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 default method is 'am'
. In all cases
except 'ppm'
and 'pwm'
, x
is
the same size as y
.
If y
is a matrix, demod
demodulates
its columns.
x = demod(y,fc,fs,'pwm','centered')
finds
the pulse widths assuming they are centered at the beginning of each
period. x
is length length(y)*fc/fs
.