Package: dsp
Translate digital signal from Intermediate Frequency (IF) band to baseband and decimate it
The DigitalDownConverter
object translates
digital signal from Intermediate Frequency (IF) band to baseband,
and decimates it.
To digitally downconvert the input signal:
Define and set up your digital down converter. See Construction.
Call step
to downconvert the input
according to the properties of dsp.DigitalDownConverter
.
The behavior of step
is specific to each object in
the toolbox.
h = dsp.DigitalDownConverter
returns a
digital downconverter (DDC) System object™, h
.
The object downconverts the input signal by multiplying it with a
complex exponential with center frequency equal to the value in the CenterFrequency
property.
The object downsamples the frequency downconverted signal using a
cascade of three decimation filters. In this case, the filter cascade
consists of a CIC decimator, a CIC compensator, and a third FIR decimation
stage. The following block diagram shows the architecture of the digital
down converter.
The scaling section normalizes the CIC gain and the oscillator
power. It may also contain a correction factor to achieve the desired
ripple specification. When you set the Oscillator property
to InputPort
, the normalization factor does not
include the oscillator power factor. Depending on the setting of the DecimationFactor property,
you may be able to bypass the third filter stage. When the input data
type is double or single, the object implements an Nsection
CIC decimation filter as an FIR filter with a response that corresponds
to a cascade of N boxcar filters. A true CIC filter
with actual comb and integrator sections is implemented when the input
data is of a fixedpoint type. The CIC filter is emulated with an
FIR filter so that you can run simulations with floatingpoint data.
The following block diagram represents the DDC arithmetic with single or doubleprecision, floatingpoint inputs.
The following block diagram represents the DDC arithmetic with signed fixedpoint inputs.
WL
is the word length of the input,
and FL
is the fraction length of the input.
The input of each filter is cast to the data type specified in the FiltersInputDataType and CustomFiltersInputDataType properties.
The oscillator output is cast to a word length equal to the input word length plus one. The fraction length is equal to the input word length minus one.
The scaling at the output of the CIC decimator consists
of coarse and finegain adjustments. The coarse gain is achieved
using the reinterpretcast
function
on the CIC decimator output. The fine gain is achieved using fullprecision
multiplication.
The following figure depicts the coarse and finegain operations.
If the normalization gain is G (where 0<G≦1), then:
WLcic
is the word length of the
CIC decimator output and FLcic
is the fraction
length of the CIC decimator output
F1 = abs(nextpow2(G))
, indicating
the part of G achieved using bit shifts (coarse gain)
F2
= fraction length specified
by the FiltersInputDataType and CustomFiltersInputDataType properties
fg = fi((2^F1)*G, true, 16)
, indicating
that the remaining gain cannot be achieved with a bit shift (fine
gain)
h = dsp.DigitalDownConverter(Name,Value)
returns
a DDC object, h
, with the specified property Name
set
to the specified Value
. You can specify additional
namevalue pair arguments in any order as (Name1
,Value1
,...,NameN
,ValueN
).

Sample rate of input signal Set this property to a positive scalar value, greater than or
equal to twice the value of the 

Decimation factor Set this property to a positive integer scalar, or to a 1by2 or 1by3 vector of positive integers. When you set this property to a scalar, the object automatically chooses the decimation factors for each of the three filtering stages. When you set this property to a 1by2 vector, the object bypasses
the third filter stage and sets the decimation factor of the first
and second filtering stages to the values in the first and second
vector elements respectively. Both elements of the When you set this property to a 1by3 vector, the i th
element of the vector specifies the decimation factor for the ith
filtering stage. The first and second elements of the 

Minimum order filter design When you set this property to When you set this property to 

Number of sections of CIC decimator Set this property to a positive integer scalar. This property
applies when you set the 

Order of CIC compensation filter stage Set this property to a positive integer scalar. This property
applies when you set the 

Order of third filter stage Set this property to an even positive integer scalar. When you
set the 

Twosided bandwidth of input signal in Hz Set this property to a positive integer scalar. The object sets
the passband frequency of the cascade of filters to onehalf of the
value that you specify in the 

Source of stopband frequency Specify the source of the stopband frequency as one of 

Stopband frequency in Hz Set this property to a doubleprecision positive scalar. This
property applies when you set the 

Passband ripple of cascade response in dB. Set this property to a doubleprecision positive scalar. When
you set the 

Stopband attenuation of cascade response in dB Set this property to a doubleprecision positive scalar. When
you set the 

Type of oscillator Specify the oscillator as one of 

Center frequency of input signal in Hz Specify this property as a doubleprecision positive scalar
that is less than or equal to half the value of the 

Number of NCO accumulator bits Specify this property as an integer scalar in the range 

Number of NCO quantized accumulator bits Specify this property as an integer scalar in the range 

Dither control for NCO When you set this property to 

Number of NCO dither bits Specify this property as an integer scalar smaller than the
number of accumulator bits that you specify in the 
clone  Create digital down converter object with same property values 
fvtool  Visualize response of filter cascade 
getDecimationFactors  Get decimation factors of each filter stage 
getFilterOrders  Get orders of decimation filters 
getFilters  Get handles to decimation filter objects 
getNumInputs  Number of expected inputs to step method 
getNumOutputs  Number of outputs of step method 
groupDelay  Group delay of filter cascade 
isLocked  Locked status for input attributes and nontunable properties 
release  Allow property value and input characteristics changes 
step  Digitally down convert input signal 
visualizeFilterStages  Display response of filter stages 
Create a digital up converter object that up samples a 1 KHz sinusoidal signal by a factor of 20 and up converts it to 50 KHz. Create a digital down converter object that down converts the signal to 0 Hz and down samples it by a factor of 20.
% Create a sine wave generator to obtain the 1 KHz % sinusoidal signal with a sample rate of 6 KHz. Fs = 6e3; % Sample rate hSig = dsp.SineWave('Frequency',1000,'SampleRate',... Fs,'SamplesPerFrame',1024); x = step(hSig); % generate signal % Create a DUC object. Use minimum order filter designs and set % passband ripple to 0.2 dB and the stopband attenuation to 55 dB. % Set the double sided signal bandwidth to 2 KHz. hDUC = dsp.DigitalUpConverter(... 'InterpolationFactor', 20,... 'SampleRate', Fs,... 'Bandwidth', 2e3,... 'StopbandAttenuation', 55,... 'PassbandRipple',0.2,... 'CenterFrequency',50e3); % Create a DDC object. Use minimum order filter designs and set the % passband ripple to 0.2 dB and the stopband attenuation to 55 dB. hDDC = dsp.DigitalDownConverter(... 'DecimationFactor',20,... 'SampleRate', Fs*20,... 'Bandwidth', 3e3,... 'StopbandAttenuation', 55,... 'PassbandRipple',0.2,... 'CenterFrequency',50e3); % Create a spectrum estimator to visualize the signal spectrum before % up converting, after up converting, and after down converting. window = hamming(floor(length(x)/10)); figure; pwelch(x,window,[],[],Fs,'centered') title('Spectrum of baseband signal x') % Up convert the signal and visualize the spectrum xUp = step(hDUC,x); % up convert window = hamming(floor(length(xUp)/10)); figure; pwelch(xUp,window,[],[],20*Fs,'centered'); title('Spectrum of up converted signal xUp') % Down convert the signal and visualize the spectrum xDown = step(hDDC,xUp); % down convert window = hamming(floor(length(xDown)/10)); figure; pwelch(xDown,window,[],[],Fs,'centered') title('Spectrum of down converted signal xDown') % Visualize the response of the decimation filters visualizeFilterStages(hDDC)
For additional examples using this System object, see the following demos: