dsp.DigitalUpConverter
Interpolate digital signal and translate it from baseband to IF band
Description
The dsp.DigitalUpConverter
System object™ interpolates a digital signal, and translates it from baseband to intermediate
frequency (IF) band.
To digitally upconvert the input signal:
Create the
dsp.DigitalUpConverter
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
This object supports C/C++ code generation and SIMD code generation under certain conditions. For more information, see Code Generation.
Creation
Description
returns a
digital up-converter (DUC) System object, upConv
= dsp.DigitalUpConverterupConv
.
returns a DUC System object with the specified property upConv
= dsp.DigitalUpConverter(Name=Value
)Name
set to the specified
value Value
. You can specify one or more name-value pair arguments in
any order as
(Name1
=Value1
,...,NameN
=ValueN
).
For example, create an object that upsamples the input signal by a factor of 20, using a
filter with the specified
qualities.
upConv = dsp.DigitalUpConverter(InterpolationFactor=20,... SampleRate=Fs,... Bandwidth=2e3,... StopbandAttenuation=55,... PassbandRipple=0.2,... CenterFrequency=50e3);
Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release
function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
InterpolationFactor
— Interpolation factor
100
(default) | positive integer | vector of positive integers
Interpolation factor, specified as a positive integer, or a 1-by-2 or 1-by-3 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 1-by-2 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 this
InterpolationFactor
vector must be greater than 1.
When you set this property to a 1-by-3 vector, the ith element of
the vector specifies the interpolation factor for the ith filtering
stage. The second and third elements of this InterpolationFactor
vector must be greater than 1 and the first element must equal 1
or
2
.
Data Types: double
MinimumOrderDesign
— Minimum order filter design
true
(default) | false
Minimum order filter design, specified as true
or
false
.
When you set this property to true
, the object designs filters
with the minimum order that meets the passband ripple, stopband attenuation, passband
frequency, and stopband frequency specifications that you set using the
PassbandRipple
, StopbandAttenuation
,
Bandwidth
, StopbandFrequencySource
, and
StopbandFrequency
properties.
When you set this property to false
, the object designs filters
with orders that you specify in the FirstFilterOrder
,
SecondFilterOrder
, and NumCICSections
properties. The filter designs meet the passband and stopband frequency specifications
that you set using the Bandwidth
,
StopbandFrequencySource
, and
StopbandFrequency
properties.
Data Types: logical
SecondFilterOrder
— Order of CIC compensation filter stage
12
(default) | positive integer
Order of CIC compensation filter stage, specified as a positive integer.
Dependencies
To enable this property, set the MinimumOrderDesign
property
to false
.
Data Types: double
FirstFilterOrder
— Order of first filter stage
10
(default) | positive even integer
Order of first filter stage, specified as a positive even integer.
Dependencies
To enable this property, set the MinimumOrderDesign
property
to false
. When you set the InterpolationFactor
property to a 1-by-2 vector, the object ignores the
FirstFilterOrder
property, because the first filter stage is
bypassed.
Data Types: double
NumCICSections
— Number of sections of CIC interpolator
3
(default) | positive integer
Number of sections of CIC interpolator, specified as a positive integer.
Dependencies
To enable this property, set the MinimumOrderDesign
property
to false
.
Data Types: double
Bandwidth
— Two-sided bandwidth of input signal in Hz
200000
(default) | positive integer
Two-sided bandwidth BW of the input signal, specified as a
positive integer in Hz or in normalized frequency
units (since R2024b). The object sets the passband frequency of the cascade of filters to
half of the value that you specify in this Bandwidth
property.
Data Types: double
StopbandFrequencySource
— Source of stopband frequency
Auto
(default) | Property
Source of the stopband frequency, specified as Auto
or
Property
.
When you set this property to Auto
and set:
NormalizedFrequency
tofalse
–– The object places the cutoff frequency of the cascade filter response at approximately Fc = Fs/2 Hz and computes the stopband frequency as Fstop = Fc + TW/2. TW is the transition bandwidth of the cascade response, computed as 2×(Fc–Fp). Fp is the passband frequency computed by BW/2, where BW is the two-sided bandwidth of the input signal.NormalizedFrequency
totrue
–– The object places the cutoff frequency of the cascade filter response at approximately Fc = 1/L, where L is the total interpolation factor specified in theInterpolationFactor
property, and computes the stopband frequency as Fstop = Fc + TW/2. TW is the transition bandwidth of the cascade response, computed as 2×(Fc–Fp), and the passband frequency Fp equals BW/2, where BW is the two-sided bandwidth of the input signal.
When you set this property to Property
, you can specify the
stopband frequency value using the StopbandFrequency
property.
StopbandFrequency
— Stopband frequency
150000
(default) | positive scalar
Stopband frequency Fstop, specified as a positive scalar in Hz or in normalized frequency units (since R2024b).
Dependencies
To enable this property, set the StopbandFrequencySource
property to Property
.
Data Types: double
PassbandRipple
— Passband ripple of cascade response in dB
0.1
(default) | positive scalar
Passband ripple of cascade response in dB, specified as a positive scalar. When you
set the MinimumOrderDesign
property to true
, the
object designs the filters so that the cascade response meets the passband ripple that
you specify in this PassbandRipple
property.
Dependencies
To enable this property, set the MinimumOrderDesign
property
to true
.
Data Types: double
StopbandAttenuation
— Stopband attenuation of cascade response in dB
60
(default) | positive scalar
Stopband attenuation of cascade response in dB, specified as a positive scalar. When
you set the MinimumOrderDesign
property to true
,
the object designs the filters so that the cascade response meets the stopband
attenuation that you specify in this StopbandAttenuation
property.
Dependencies
To enable this property, set the MinimumOrderDesign
property
to true
.
Data Types: double
Oscillator
— Type of oscillator
Sine wave
(default) | NCO
Type of oscillator, specified as one of these:
Sine wave
–– The object frequency-upconverts the output of the interpolation filter cascade by using a complex exponential signal obtained from samples of a sinusoidal trigonometric function.NCO
–– The object frequency-upconverts the output by using a complex exponential obtained from a numerically controlled oscillator (NCO).
CenterFrequency
— Center frequency of output signal in Hz
14000000
(default) | positive scalar
Center frequency of the output signal Fc, specified as a positive
scalar in Hz or in normalized frequency units (since R2024b). The
value of this property must be less than or equal to half the product of the
SampleRate
property and the total interpolation factor. The
object upconverts the input signal so that the output spectrum centers at the frequency
you specify in the CenterFrequency
property.
Data Types: double
NormalizedFrequency
— Option to set frequencies in normalized units
false
(default) | true
Since R2024b
Option to set frequencies in normalized units, specified as one of these values:
true
–– The center frequency, stopband frequency, and bandwidth must be in the normalized frequency units (0 to 1).When you set the
NormalizedFrequency
property totrue
while creating the object and you do not set the frequency specifications, the object automatically sets the default values to normalized frequency units. The object computes the frequencies in normalized units by normalizing the absolute frequency values in Hz with respect to the output sample rate, Fs×L, where L is the interpolation factor.duc = dsp.DigitalUpConverter(NormalizedFrequency=true)
duc = dsp.DigitalUpConverter with properties: InterpolationFactor: 100 MinimumOrderDesign: true Bandwidth: 0.0133 StopbandFrequencySource: 'Auto' PassbandRipple: 0.1000 StopbandAttenuation: 60 Oscillator: 'Sine wave' CenterFrequency: 0.9333 NormalizedFrequency: true
When you set the
NormalizedFrequency
property totrue
after you create the object, you must specify the center frequency, stopband frequency, and bandwidth in normalized units before you run the object algorithm.duc = dsp.DigitalUpConverter
duc = dsp.DigitalUpConverter with properties: InterpolationFactor: 100 MinimumOrderDesign: true Bandwidth: 200000 StopbandFrequencySource: 'Auto' PassbandRipple: 0.1000 StopbandAttenuation: 60 Oscillator: 'Sine wave' CenterFrequency: 14000000 NormalizedFrequency: false SampleRate: 300000
To specify the normalized frequency values, set
NormalizedFrequency
totrue
and manually convert the frequency values in Hz to the normalized values using the output sample rate in Hz, Fs×L. The bandwidth value in normalized units is BWHz/(Fs×L/2), the center frequency in normalized units is FcHz/(Fs×L/2), and the stopband frequency in normalized units is FstopHz/(Fs×L/2).duc = dsp.DigitalUpConverter; duc.NormalizedFrequency = true; duc.Bandwidth = 200000/(300e3*100/2); duc.CenterFrequency = 14e6/(300e3*100/2)
duc = dsp.DigitalUpConverter with properties: InterpolationFactor: 100 MinimumOrderDesign: true Bandwidth: 0.0133 StopbandFrequencySource: 'Auto' PassbandRipple: 0.1000 StopbandAttenuation: 60 Oscillator: 'Sine wave' CenterFrequency: 0.9333 NormalizedFrequency: true
false
–– The bandwidth, stopband frequency, and center frequency values are in Hz. You can specify the input sample rate through theSampleRate
property.
Data Types: logical
SampleRate
— Sample rate of input signal
300000
(default) | positive scalar
Sample rate of the input signal Fs, specified as a positive
scalar value. The value of this property multiplied by the total interpolation factor
must be greater than or equal to twice the value of the
CenterFrequency
property.
Dependencies
To enable this property, set
NormalizedFrequency
to false
. (since R2024b)
Data Types: single
| double
NCO Properties
NumAccumulatorBits
— Number of NCO accumulator bits
16
(default) | integer in the range [1, 128]
Number of NCO accumulator bits, specified as an integer in the range [1,128]. For
more details, see the dsp.NCO
System object.
Dependencies
To enable this property, set the Oscillator
property to
NCO
.
Data Types: double
NumQuantizedAccumulatorBits
— Number of NCO accumulator bits
12
(default) | integer in the range [1, 128]
Number of NCO accumulator bits, specified as an integer in the range [1,128]. The
value you specify for this property must be less than the value you specify in the
NumAccumulatorBits
property. For more details, see the dsp.NCO
System object.
Dependencies
To enable this property, set the Oscillator
property to
NCO
.
Data Types: double
Dither
— Dither control for NCO
true
(default) | false
Dither control for NCO, specified as true
or
false
. When you set this property to true
, the
object uses the number of dither bits specified in the
NumDitherBits
property when applying dither to the NCO signal.
When this property is false
, the NCO does not apply dither to the
signal. For more details, see the dsp.NCO
System object.
Dependencies
To enable this property, set the Oscillator
property to
NCO
.
Data Types: logical
NumDitherBits
— Number of NCO dither bits
4
(default) | positive integer
Number of NCO dither bits, specified as a positive integer scalar smaller than the
number of accumulator bits that you specify in the
NumAccumulatorBits
property. For more details, see the dsp.NCO
System object.
Dependencies
To enable this property, set the Oscillator
property to
NCO
and the Dither
property to
true
.
Data Types: double
Fixed-Point Properties
FiltersOutputDataType
— Data type at output of each filter stage
Same as input
(default) | Custom
Data type at the output of the first (if it has not been bypassed), second, and
third filter stages, specified as Same as input
or
Custom
. The object casts the data at the output of each filter
stage according to the value you set in this property. For the CIC stage, the casting
is done after the signal is scaled by the normalization factor.
CustomFiltersOutputDataType
— Fixed-point data type at output of each filter stage
numerictype([],16,15)
(default) | numerictype
object
Fixed-point data type at output of each filter stage, specified as a scaled
numerictype
(Fixed-Point Designer) object with the
Signedness
property set to Auto
.
Dependencies
To enable this property, set the FiltersOutputDataType
property to Custom
.
OutputDataType
— Data type of output
Same as input
(default) | Custom
Data type of output, specified as Same as input
or
Custom
.
CustomOutputDataType
— Fixed-point data type of output
numerictype([],16,15)
(default) | numerictype
object
Fixed-point data type of output, specified as a scaled
numerictype
object the Signedness
property
set to Auto
.
Dependencies
To enable this property, set the OutputDataType
property to
Custom
.
Usage
Syntax
Description
Input Arguments
x
— Input signal
column vector
Input signal, specified as a column vector of real or complex values.
When the data type of x
is double
or
single
, the data type of y
is the same as
that of x
. When the data type of x
is of a
fixed-point type, the data type of y
is defined by the
OutputDataType
property.
Data Types: single
| double
| int8
| int16
| int32
| int64
| fi
Complex Number Support: Yes
Output Arguments
y
— Upconverted and upsampled signal
column vector
Upconverted and upsampled signal, returned as a column vector. The length of
y
is equal to the length of x
multiplied
by the value in the InterpolationFactor
property. When the data
type of x
is double
or
single
, the data type of y
is the same as
that of x
. When the data type of x
is of a
fixed-point type, the data type of y
is defined by the
OutputDataType
property.
Data Types: single
| double
| int8
| int16
| int32
| int64
| fi
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Specific to dsp.DigitalUpConverter
getInterpolationFactors | Get interpolation factors of each filter stage of digital upconverter |
getFilterOrders | Get orders of digital down converter or digital up converter filter cascade |
getFilters | Get handles to digital down converter or digital up converter filter cascade objects |
groupDelay | Group delay of digital down converter or digital up converter filter cascade |
visualize | Display response of digital down converter or digital up converter filter cascade |
generatehdl | Generate HDL code for quantized DSP filter (requires Filter Design HDL Coder) (To be removed) |
Examples
Upconvert Sine Wave Signal
Create a DUC System object™ that upsamples a 1-kHz sinusoidal signal by a factor of 20 and upconverts it to 50 kHz.
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 System object. Use minimum order filter designs and set the passband ripple to 0.2 dB and 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 upconverting.
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); window = hamming(floor(length(xUp)/10)); figure; pwelch(xUp,window,[],[],20*Fs,'centered') title('Spectrum of upconverted signal xUp')
Visualize the response of the interpolation filters.
visualize(upConv)
More About
Fixed Point
The block diagram represents the DUC arithmetic with signed fixed-point 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 filter output data type. In the
dsp.DigitalUpConverter
object, you can specify the filter output data type through theFiltersOutputDataType
andCustomFiltersOutputDataType
properties. In the Digital Up-Converter block, you can specify the filter output data type through the Stage output parameter. 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 filter output data type word length plus one. The fraction length is equal to the filter output data type word length minus one.
The scaling at the output of the CIC interpolator consists of coarse-gain and fine-gain adjustments. The coarse gain is achieved using the
reinterpretcast
(Fixed-Point Designer) function on the CIC interpolator output. The fine gain is achieved using full-precision multiplication.
The figure shows the coarse-gain and fine-gain 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 by using bit shifts (coarse gain).F2 is the fraction length specified by the filter output data type.
fg = fi((2^F1)*G,true,16)
, which indicates that the remaining gain cannot be achieved with a bit shift (fine gain).
Algorithms
The digital up converter upsamples the input signal using a cascade of three interpolation filters. This algorithm frequency-upconverts the upsampled signal by multiplying it with a complex exponential that has the specified center frequency. In this case, the filter cascade consists of an FIR interpolation stage, a second stage for CIC compensation, and a CIC interpolator. The block diagram shows the architecture of the digital up converter.
The scaling section normalizes the CIC gain and the oscillator power. It can also contain a correction factor to achieve the desired ripple specification. Depending on how you set the interpolation factor, the block bypasses the first filter stage. When the input data type is floating point, the algorithm implements an N-section CIC interpolation filter as a FIR filter with a response that corresponds to a cascade of N boxcar filters. The algorithm emulates a CIC filter with an FIR filter so that you can run simulations with floating-point data. When the input data type is a fixed-point type, the algorithm implements a true CIC filter with actual comb and integrator sections.
This block diagram represents the DUC arithmetic with floating-point inputs.
For details about fixed-point operation, see Fixed Point.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
This object also supports SIMD code generation using Intel® AVX2 code replacement library when the input signal has a data type of
single
or double
.
The SIMD technology significantly improves the performance of the generated code. For more information, see SIMD Code Generation. To generate SIMD code from this object, see Use Intel AVX2 Code Replacement Library to Generate SIMD Code from MATLAB Algorithms.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
This object supports HDL code generation with the Filter Design HDL Coder™ product. For workflows and limitations, see Generate HDL Code for Filter System Objects (Filter Design HDL Coder).
Version History
Introduced in R2012aR2024b: visualizeFilterStages
has been renamed to
visualize
The visualizeFilterStages
function has been renamed to
visualize
. Existing instances of this function continue to run. For
new instances, use visualize
.
R2024b: visualize
launches MATLAB figure
The visualize
function now launches a MATLAB® figure to display the magnitude response of the digital up converter filter
cascade.
R2024b: Support for normalized frequencies
When you set the NormalizedFrequency
property to
true
, you must specify the bandwidth, stopband frequency, and the
center frequency in normalized frequency units (0 to 1). For more information, see the
NormalizedFrequency
property description.
See Also
Functions
Objects
Blocks
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)