Package: dsp
Interpolate digital signal and translate it from baseband to Intermediate Frequency (IF) band
The DigitalUpConverter
object interpolates
digital signal, and translates it from baseband to Intermediate Frequency
(IF) band.
To digitally up convert the input signal:
Define and set up your digital up converter. See Construction.
Call step
to upconvert the input
according to the properties of dsp.DigitalUpConverter
.
The behavior of step
is specific to each object in
the toolbox.
Note:
Starting in R2016b, instead of using the 
upConv = dsp.DigitalUpConverter
returns
a digital upconverter (DUC) System object, upConv
.
The object up samples the input signal using a cascade of three interpolation
filters. This object frequency upconverts the up sampled signal by
multiplying it with a complex exponential with center frequency equal
to the value in the CenterFrequency
property.
In this case, the filter cascade consists of a first FIR interpolation
stage, a CIC compensator, and a CIC interpolator. The following block
diagram shows the architecture of the digital up 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. Depending on the setting of the InterpolationFactor property, you may be able to bypass the first filter stage. When the input data type is double or single, the object implements an Nsection CIC interpolation 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 diagram represents the DUC arithmetic with single or doubleprecision, floatingpoint inputs.
The following block diagram represents the DUC arithmetic with signed fixedpoint inputs.
WL
is the word length of the input,
and FL
is the fraction length of the input.
The output of each filter is cast to the data type specified in the FiltersOutputDataType and CustomFiltersOutputDataType properties. The casting of the CIC output occurs after the scaling factor is applied.
The oscillator output is cast to a word length equal to the FiltersOutputDataType word length plus one. The fraction length is equal to the FiltersOutputDataType word length minus one.
The scaling at the output of the CIC interpolator
consists of coarse and finegain adjustments. The coarse gain is
achieved using the reinterpretcast
function
on the CIC interpolator 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 interpolator output and FLcic
is the fraction
length of the CIC interpolator output
F1 = abs(nextpow2(G))
, indicating
the part of G achieved using bit shifts (coarse gain)
F2
= fraction length specified
by the FiltersOutputDataType and CustomFiltersOutputDataType properties
fg = fi((2^F1)*G, true, 16)
, indicating
that the remaining gain cannot be achieved with a bit shift (fine
gain)
upConv = dsp.DigitalUpConverter('
returns
a DUC object, PropertyName
','PropertyValue'
)upConv
, with each specified property
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. The value of this property
multiplied by the total interpolation factor must be greater than
or equal to twice the value of the 

Interpolation 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 interpolation factors for each of the three filtering stages. When you set this property to a 1by2 vector, the object bypasses
the first filter stage and sets the interpolation factor of the second
and third 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 ith
element of the vector specifies the interpolation factor for the ith
filtering stage. The second and third elements of the 

Minimum order filter design. When you set this property to 

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

Order of first filter stage Set this property to a positive, integer, even scalar. When
you set the 

Number of sections of CIC interpolator Set this property to a positive, integer scalar. This property
applies 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 double precision positive scalar. This
property applies when you set the 

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

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

Type of oscillator. Specify the oscillator as one of 

Center frequency of output signal in Hz. Specify this property as a double precision, positive scalar.
The value of this property must be less than or equal to half the
product of the 

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

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

Dither control for NCO. When you set this property to See also 

Number of NCO dither bits. Specify this property as an integer scalar smaller than the
number of accumulator bits that you specify in the See also 
fvtool  Visualize response of filter cascade 
getFilterOrders  Get orders of interpolation filters 
getFilters  Get handles to interpolation filter objects 
getInterpolationFactors  Get interpolation factors of each filter stage 
groupDelay  Group delay of filter cascade 
step  Process inputs using the digital up converter 
visualizeFilterStages  Display response of filter stages 
Common to All System Objects  

clone  Create System object with same property values 
getNumInputs  Expected number of inputs to a System object 
getNumOutputs  Expected number of outputs of a System object 
isLocked  Check locked states of a System object (logical) 
release  Allow System object property value changes 
Create a digital up converter object that upsamples a 1 KHz sinusoidal signal by a factor of 20, and up converts it to 50 KHz.
Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step
syntax. For example, myObject(x) becomes step(myObject,x).
Initialization
Create a sine wave generator to obtain the 1 KHz sinusoidal signal with a sample rate of 6 KHz.
Fs = 6e3; % Sample rate sine = dsp.SineWave('Frequency',1000,'SampleRate', Fs,'SamplesPerFrame',1024); x = sine(); % generate signal
Create a DUC object. Use minimum order filter designs and set the passband ripple to 0.2 dB and the stopband attenuation to 55 dB. Set the double sided signal bandwidth to 2 KHz.
upConv = dsp.DigitalUpConverter(... 'InterpolationFactor', 20,... 'SampleRate', Fs,... 'Bandwidth', 2e3,... 'StopbandAttenuation', 55,... 'PassbandRipple',0.2,... 'CenterFrequency',50e3);
Create a spectrum estimator to visualize the signal spectrum before and after up converting.
window = hamming(floor(length(x)/10)); figure; pwelch(x,window,[],[],Fs,'centered') title('Spectrum of baseband signal x')
Upconvert the Signal and Visualize the Spectrum
xUp = upConv(x); % up convert window = hamming(floor(length(xUp)/10)); figure; pwelch(xUp,window,[],[],20*Fs,'centered') title('Spectrum of up converted signal xUp')
Visualize the response of the interpolation filters
visualizeFilterStages(upConv)