DSP System Toolbox™ Reference
DSP System Toolbox™ Reference
Reference
R2014a
Web
Newsgroup
www.mathworks.com/contact_TS.html Technical Support
www.mathworks.com
comp.soft-sys.matlab
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
DSP System Toolbox Reference
COPYRIGHT 20122014 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
governments needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
April 2011
September 2011
March 2012
September 2012
March 2013
September 2013
March 2014
Online
Online
Online
Online
Online
Online
Online
only
only
only
only
only
only
only
Revised
Revised
Revised
Revised
Revised
Revised
Revised
for
for
for
for
for
for
for
Version
Version
Version
Version
Version
Version
Version
8.0
8.1
8.2
8.3
8.4
8.5
8.6
(R2011a)
(R2011b)
(R2012a)
(R2012b)
(R2013a)
(R2013b)
(R2014a)
Contents
Blocks Alphabetical List
1
Analysis Methods for Filter System Objects
2
Analysis Methods for Filter System Objects . . . . . . . . . .
2-2
Alphabetical List
3
Functions Alphabetical List
4
Reference for the Properties of Filter Objects
5
Fixed-Point Filter Properties . . . . . . . . . . . . . . . . . . . . . . .
Overview of Fixed-Point Filters . . . . . . . . . . . . . . . . . . . . . .
Fixed-Point Objects and Filters . . . . . . . . . . . . . . . . . . . . . .
Summary Fixed-Point Filter Properties . . . . . . . . . . . . .
Property Details for Fixed-Point Filters . . . . . . . . . . . . . . .
5-2
5-2
5-2
5-5
5-18
5-115
5-115
5-120
5-130
Glossary
vi
Contents
1
Blocks Alphabetical List
Allpole Filter
Purpose
Library
Description
The Allpole Filter block independently filters each channel of the input
signal with the specified allpole filter. The block can implement static
filters with fixed coefficients, as well as time-varying filters with
coefficients that change over time. You can tune the coefficients of a
static filter during simulation.
This block filters each channel of the input signal independently
over time. The Input processing parameter allows you to specify
whether the block treats each element of the input as an independent
channel (sample-based processing), or each column of the input as an
independent channel (frame-based processing).
The outputs of this block numerically match the outputs of the DSP
System Toolbox Digital Filter block.
This block supports the Simulink state logging feature. See States in
the Simulink Users Guide for more information.
1-2
Allpole Filter
To determine the number of initial states you must specify and how to
specify them, see the table on valid initial states. The Initial states
parameter can take one of the forms described in the next table.
Valid Initial States
Initial Condition
Description
Scalar
The block initializes all delay elements in the filter to the scalar
value.
Vector or matrix
(for applying different
delay elements to each
channel)
Data Type
Support
The Allpole Filter block accepts and outputs real and complex signals
of any numeric data type supported by Simulink. The block supports
the same types for the coefficients.
The following diagrams show the filter structure and the data types
used within the Allpole Filter block for fixed-point signals.
Direct Form
You cannot specify the state data type on the block mask for this
structure because the output states have the same data types as the
output.
1-3
Allpole Filter
1-4
Allpole Filter
1-5
Allpole Filter
1-6
Allpole Filter
1-7
Allpole Filter
1-8
Allpole Filter
1-9
Allpole Filter
Lattice AR
1-10
Allpole Filter
Parameters
and
Dialog
Box
The Main pane of the Allpole Filter block dialog box appears as follows.
1-11
Allpole Filter
Coefficient source
Select whether you want to specify the filter coefficients on the
block mask or through an input port.
1-12
Allpole Filter
Filter structure
Select the filter structure you want the block to implement. You
can select Direct form, Direct form transposed, or Lattice
AR.
Coefficients
Specify the row vector of coefficients of the filters transfer
function.
This parameter is visible only when you set the Coefficient
source to Dialog parameters.
Input processing
Specify whether the block performs sample- or frame-based
processing. You can select one of the following options:
Elements as channels (sample based) Treat each
element of the input as an independent channel (sample-based
processing).
Columns as channels (frame based) Treat each column of
the input as an independent channel (frame-based processing).
Initial states
Specify the initial conditions of the filter states. To learn how to
specify initial states, see Specifying Initial States on page 1-2.
The Data Types pane of the Allpole Filter block dialog box appears
as follows.
1-13
Allpole Filter
Coefficients
Specify the coefficient data type. You can set it to:
A rule that inherits a data type, for example, Inherit:
word length as input
1-14
Same
Allpole Filter
1-15
Allpole Filter
1-16
Same
Allpole Filter
Same
as accumulator
1-17
Allpole Filter
Output minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Output maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Integer rounding mode
Specify the rounding mode for fixed-point operations.
Saturate on integer overflow
Action
Example
Select this
check box.
Overflows saturate to
either the minimum
or maximum value
that the data type can
represent.
An overflow associated
with a signed 8-bit
integer can saturate to
-128 or 127.
Do not select
this check
box.
1-18
Allpole Filter
Action
Example
a block handles
out-of-range signals.
For more information,
see Checking for
Signal Range Errors.
When you select this check box, saturation applies to every
internal operation on the block, not just the output or result. In
general, the code generation process can detect when overflow is
not possible. In this case, the code generator does not produce
saturation code.
Supported
Data
Types
See Also
Digital Filter
Filter Realization
Wizard
fdatool
fvtool
1-19
Purpose
Library
Description
Description
Butterworth
Chebyshev
type I
Chebyshev
type II
Elliptic
The following table lists the available parameters for each design/band
combination. For lowpass and highpass band configurations, these
parameters include the passband edge frequency p, the stopband edge
frequency s, the passband ripple Rp, and the stopband attenuation Rs.
For bandpass and bandstop configurations, the parameters include the
1-20
lower and upper passband edge frequencies, p1 and p2, the lower and
upper stopband edge frequencies, s1 and s2, the passband ripple Rp,
and the stopband attenuation Rs. Frequency values are in rad/s, and
ripple and attenuation values are in dB.
Lowpass
Highpass
Bandpass
Bandstop
Butterworth
Order, p
Order, p
Order, p1, p2
Order, p1, p2
Chebyshev
Type I
Order, p, Rp
Order, p, Rp
Chebyshev
Type II
Order, s, Rs
Order, s, Rs
Elliptic
Order, p, Rp,
Rs
Order, p, Rp,
Rs
The analog filters are designed using the filter design commands in
Signal Processing Toolbox softwares buttap, cheb1ap, cheb2ap, and
ellipap functions, and are implemented in state-space form. Filters
of order 8 or less are implemented in controller canonical form for
improved efficiency.
1-21
Dialog
Box
1-22
References
1-23
Supported
Data
Types
See Also
buttap
cheb1ap
cheb2ap
ellipap
1-24
Analytic Signal
Purpose
Library
Transforms
dspxfrm3
Description
y = u + jH {u}
where j = 1 and H{ } denotes the Hilbert transform. The real part
of the output in each channel is a replica of the real input in that
channel; the imaginary part is the Hilbert transform of the input. In the
frequency domain, the Fourier transform of the analytic signal doubles
the positive frequency content of the original signal while zeroing-out
negative frequencies and retaining the DC component.
The block computes the Hilbert transform using an equiripple FIR
filter with the order specified by the Filter order parameter, n. The
linear phase filter is designed using the Remez exchange algorithm, and
imposes a delay of n/2 on the input samples.
The output has the same dimensions as the input.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block performs frame-based processing.
In this mode, the block treats an M-by-N matrix input as N independent
channels containing M sequential time samples. The block computes
the analytic signal for each channel over time.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block performs sample-based
processing. In this mode, the block treats an M-by-N matrix input as
1-25
Analytic Signal
M*N independent channels and computes the analytic signal for each
channel (matrix element) over time.
Dialog
Box
Filter order
The length of the FIR filter used to compute the Hilbert transform.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-26
Analytic Signal
Supported
Data
Types
1-27
Purpose
Library
1-28
Description
Dialog
Box
1-29
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop down list, where FIR is
the default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Order mode
Select Minimum or Specify from the drop-down list. Selecting
Specify enables the Order option so you can enter the filter
order. When you set the Impulse response to IIR, you can
specify different numerator and denominator orders. To specify a
different denominator order, you must select the Denominator
order check box.
Order
Enter the order for FIR filter, or the order of the numerator for
the IIR filter.
Denominator order
Select the check box and enter the denominator order. This option
is enabled only if IIR is selected for Impulse response.
1-30
Filter type
This option is available for FIR filters only. Select Single-rate,
Decimator, Interpolator, or Sample-rate converter. Your
choice determines the type of filter as well as the design methods
and structures that are available to implement your filter. By
default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Response Specification
Number of Bands
Select the number of bands in the filter. Multiband design is
available for both FIR and IIR filters.
Specify response as
Specify the response as Amplitudes, Magnitudes and phases,
Frequency response, or Group delay. Group delay is only
available for IIR designs.
Frequency units
Specify frequency units as either Normalized, which means
normalized by the input sampling frequency, or select from Hz,
kHz, MHz, or GHz.
1-31
Input Fs
Enter the input sampling frequency in the units specified in the
Frequency units drop-down list. When you select the frequency
units, this option is available.
Band Properties
These properties are modified automatically depending on the
response chosen in the Specify response as drop-down list. Two or
three columns are presented for input. The first column is always
Frequencies. The other columns are Amplitudes, Magnitudes, Phases,
or Frequency Response. Enter the corresponding vectors of values for
each column.
Frequencies and Amplitudes These columns are presented for
input if the response chosen in the Specify response as drop-down
list is Amplitudes.
Frequencies, Magnitudes, and Phases These columns are
presented for input if the response chosen in the Specify response
as drop-down list is Magnitudes and phases.
Frequencies and Frequency response These columns are
presented for input if the response chosen in the Specify response
as drop-down list is Frequency response.
Algorithm
Design Method
Select the design method for the filter. Different methods are
enabled depending on the defining parameters entered in the
previous sections.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications.
1-32
Filter Implementation
Structure
Select the structure for the filter, available for the corresponding
design method.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
1-33
1-34
Supported
Data
Types
Port
Input
Output
1-35
Array-Vector Add
Purpose
Library
Description
The Array-Vector Add block adds the values in the specified dimension
of the N-dimensional input array A to the values in the input vector V.
The length of the input V must be the same as the length of the specified
dimension of A. The Array-Vector Add block adds each element of V to
the corresponding element along that dimension of A.
Consider a 3-dimensional M-by-N-by-P input array A(i,j,k) and a N-by-1
input vector V. When the Add along dimension parameter is set to 2,
the output of the block Y(i,j,k) is
Y (i, j, k) = A(i, j, k) + V ( j)
where
1i M
1 j N
1k P
The output of the Array-Vector Add block is the same size as the
input array, A. This block accepts real and complex floating-point and
fixed-point inputs.
1-36
Array-Vector Add
Cast
Accumulator
data type
When you specify the vector V on the Main pane of the block mask,
you must specify the data type and scaling properties of its elements
in the Vector (V) parameter on the Data Types tab. When the vector
comes in through the block port, its elements inherit their data type
and scaling from the driving block.
You can set the vector, accumulator, and output data types in the block
dialog as discussed below.
Dialog
Box
The Main pane of the Array-Vector Add block dialog appears as follows.
1-37
Array-Vector Add
1-38
Array-Vector Add
1-39
Array-Vector Add
1-40
Array-Vector Add
Rounding mode
Select the rounding mode for fixed-point operations. If
Accumulator Data Type is Inherit: Inherit via internal rule and
Output Data Type is Inherit: Same as accumulator, the value of
Rounding mode does not affect the numerical results.
Note The Rounding mode and Overflow mode settings
have no effect on numerical results when both of the following
conditions exist:
Accumulator data type is Inherit:
Inherit via
internal rule
Same
1-41
Array-Vector Add
Note The Vector (V) parameter on the Data Types pane is only
visible when you select Dialog parameter for the Vector (V)
source parameter on the Main pane of the block mask. When the
vector comes in through the blocks input port, the data type and
scaling of its elements are inherited from the driving block.
Accumulator data type
Specify the accumulator data type. See Fixed-Point Data Types
on page 1-36 for illustrations depicting the use of the accumulator
data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
Same
as accumulator
1-42
Array-Vector Add
Supported
Data
Types
Port
1-43
Array-Vector Add
Port
Output
See Also
1-44
Array-Vector Divide
Array-Vector
Multiply
Array-Vector
Subtract
Array-Vector Divide
Purpose
Library
Description
Y (i, j, k) =
A(i, j, k)
V ( j)
where
1i M
1 j N
1k P
The output of the Array-Vector Divide block is the same size as the
input array, A. This block accepts real and complex floating-point and
fixed-point input arrays, and real floating-point and fixed-point input
vectors.
1-45
Array-Vector Divide
When you specify the vector V on the Main pane of the block mask,
you must specify the data type and scaling properties of its elements
in the Vector (V) parameter on the Data Types tab. When the vector
comes in through the block port, its elements inherit their data type
and scaling from the driving block.
You can set the vector and output data types in the block dialog as
discussed below.
Dialog
Box
1-46
Array-Vector Divide
1-47
Array-Vector Divide
Vector (V)
Specify the vector, V. This parameter is visible only when you
select Dialog parameter for the Vector (V) source parameter.
The Data Types pane of the Array-Vector Divide block dialog appears
as follows.
1-48
Array-Vector Divide
Same
1-49
Array-Vector Divide
Same
as first input
1-50
Array-Vector Divide
Supported
Data
Types
Port
Output
See Also
Array-Vector Add
Array-Vector
Multiply
Array-Vector
Subtract
1-51
Array-Vector Multiply
Purpose
Library
Description
Y (i, j, k) = A(i, j, k) * V ( j)
where
1i M
1 j N
1k P
The output of the Array-Vector Multiply block is the same size as the
input array, A. This block accepts real and complex floating-point and
fixed-point inputs.
1-52
Array-Vector Multiply
Cast
Accumulator
or product
output data type
When you specify the vector V on the Main pane of the block mask,
you must specify the data type and scaling properties of its elements
in the Vector (V) parameter on the Data Types tab. When the vector
comes in through the block port, its elements inherit their data type
and scaling from the driving block.
The output of the multiplier is in the product output data type when
at least one of the inputs to the multiplier is real. When both of the
inputs to the multiplier are complex, the result of the multiplication is
in the accumulator data type. For details on the complex multiplication
performed, see Multiplication Data Types.
You can set the vector, accumulator, product output, and output data
types in the block dialog as discussed below.
Dialog
Box
1-53
Array-Vector Multiply
1-54
Array-Vector Multiply
1-55
Array-Vector Multiply
1-56
Array-Vector Multiply
Same
1-57
Array-Vector Multiply
1-58
Array-Vector Multiply
Same
as product output
1-59
Array-Vector Multiply
Supported
Data
Types
Port
Output
See Also
1-60
Array-Vector Add
Array-Vector Divide
Array-Vector
Subtract
Array-Vector Subtract
Purpose
Library
Description
Y (i, j, k) = A(i, j, k) V ( j)
where
1i M
1 j N
1k P
The output of the Array-Vector Subtract block is the same size as the
input array, A. This block accepts real and complex floating-point and
fixed-point inputs.
1-61
Array-Vector Subtract
Cast
Accumulator
data type
When you specify the vector V on the Main pane of the block mask,
you must specify the data type and scaling properties of its elements
in the Vector (V) parameter on the Data Types tab. When the vector
comes in through the block port, its elements inherit their data type
and scaling from the driving block.
The output of the subtractor is in the accumulator data type.
You can set the vector, accumulator, and output data types in the block
dialog as discussed below.
Dialog
Box
1-62
Array-Vector Subtract
1-63
Array-Vector Subtract
1-64
Array-Vector Subtract
1-65
Array-Vector Subtract
Rounding mode
Select the rounding mode for fixed-point operations.
Note The Rounding mode and Overflow mode settings
have no effect on numerical results when both of the following
conditions exist:
Accumulator data type is Inherit:
Inherit via
internal rule
Same
1-66
Array-Vector Subtract
Note The Vector (V) parameter on the Data Types pane is only
visible when you select Dialog parameter for the Vector (V)
source parameter on the Main pane of the block mask. When the
vector comes in through the blocks input port, the data type and
scaling of its elements are inherited from the driving block.
Accumulator data type
Specify the accumulator data type. See Fixed-Point Data Types
on page 1-61 for illustrations depicting the use of the accumulator
data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
Same
as accumulator
1-67
Array-Vector Subtract
Supported
Data
Types
Port
1-68
Array-Vector Subtract
Port
Output
See Also
Array-Vector Add
Array-Vector Divide
Array-Vector
Multiply
1-69
Purpose
Library
1-70
Description
Dialog
Box
See Audio Weighting Filter Design Dialog Box Main Pane on page
4-686 for more information about the parameters of this block. The
Data Types and Code panes are not available for blocks in the DSP
System Toolbox Filter Designs library.
1-71
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Weighting type
The weighting type defines the frequency response of the filter.
The valid weighting types for this filter are A, C , C-message, ITU-R
468 4, and ITU-T 0.41. For definitions of the available weighting
types, see the fdesign.audioweighting reference page.
Class
The filter class describes the frequency-dependent tolerances
specified in the relevant standards [1], [2]. There are two possible
class values: 1 and 2. Class 1 weighting filters have stricter
tolerances than class 2 filters. The filter class value does not affect
the design. The class value is only used to provide a specification
mask in fvtool for the analysis of the filter design. The default
value of this parameter is 1.
The filter class is only applicable for A weighting and C weighting
filters.
1-72
Impulse response
Specify the impulse response type as one of IIR or FIR. For A, C ,
C-message, and ITU-R 4684 filter, IIR is the only option. For a
ITU-T 0.41 weighting filter, FIR is the only option.
Frequency units
Specify the frequency units as Hertz (Hz), kilohertz (kHz),
megahertz (MHz), or gigahertz (GHz). Normalized frequency
designs are not supported for audio weighting filters. The default
value of this parameter is Hz.
Input Fs
Specify the input sampling frequency. The units correspond to the
setting of the Frequency units parameter.
Algorithm
Design Method
Valid design methods depend on the weighting type. For type
A and C weighting filters, the only valid design type is ANSI
S1.42. This is an IIR design method that follows ANSI standard
S1.422001. For a C message filter, the only valid design method
is Bell 41009, which is an IIR design method following the Bell
System Technical Reference PUB 41009. For a ITU-R 4684
weighting filter, you can design an IIR or FIR filter. If you choose
an IIR design, the design method is IIR least p-norm. If you
choose an FIR design, the design method choices are Equirriple
or Frequency Sampling. For an ITU-T 0.41 weighting filter,
the available FIR design methods are Equirriple or Frequency
Sampling.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
1-73
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. For audio weighting IIR filter designs, you can choose direct
form I or II biquad (SOS). You can also choose to implement these
structures in transposed form.
For FIR designs, you can choose a direct form, direct-form
transposed, direct-form symmetric, or direct-form asymmetric
structure.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Optimize for unit-scale values
Select this check box to scale unit gains between sections in SOS
filters. This parameter is available only for SOS filters.
1-74
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
For more information about sample- and frame-based processing,
see Sample- and Frame-Based Concepts.
Use symbolic names for coefficients
Select this check box to enable the specification of coefficients
using MATLAB variables. The available coefficient names differ
depending on the filter structure. Using symbolic names allows
tuning of filter coefficients in generated code. By default, this
check box is cleared.
References
1-75
Supported
Data
Types
Port
Input
Output
1-76
See Also
How To
Autocorrelation
Purpose
Library
Statistics
dspstat3
Description
yi, j =
M l 1
k =0
0 i l
1-77
Autocorrelation
Multiplier
Cast
Adder
Cast
Output
data type
Input
data type
Accumulator
or Product
output data type
Accumulator
data type
Multiplier
Cast
Adder
Accumulator
or Product
output data type
1-78
Divider
Output
data type
Input
data type
Accumulator
data type
Autocorrelation
You can set the product output, accumulator, and output data types
on the Data Types pane of the block dialog as discussed in the next
section.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Dialog
Box
1-79
Autocorrelation
1-80
Autocorrelation
yibiased
=
,j
yi, j
M
yiunbiased
=
,j
yi, j
M i
y0, j = 1
Computation domain
This parameter sets the domain in which the block computes
convolutions to one of the following settings:
Time Computes in the time domain, which minimizes
memory use
Frequency Computes in the frequency domain, which
might require fewer computations than computing in the time
domain, depending on the input length
1-81
Autocorrelation
1-82
Autocorrelation
Note Fixed-point signals are only supported for the time domain. To
use the parameters on this pane, make sure Time is selected for the
Computation domain parameter on the Main pane.
Rounding mode
Select the rounding mode for fixed-point operations.
Note The Rounding mode and Overflow mode settings have
no effect on numerical results when all the following conditions
exist:
Product output data type is Inherit:
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
1-83
Autocorrelation
Same
as accumulator
1-84
Autocorrelation
Supported
Data
Types
Port
Input
1-85
Autocorrelation
Port
Output
See Also
1-86
Correlation
xcorr
Autocorrelation LPC
Purpose
Library
Description
1-87
Autocorrelation LPC
port A and K are enabled, and each port outputs its respective set of
prediction coefficients for each channel.
When you select Output prediction error power (P), port P is
enabled. The prediction error power is output at port P as a vector
whose length is the number of input channels.
Algorithm
minn Ua b
i
u1
u
2
U=
u
M
0
0
0
u1
u2
, a =
0 uM
0
u1
u2
u2
u
3
a2
, b = u
M
0
an + 1
U Ua = U b
leads to the system of equations
1-88
Autocorrelation LPC
r1
r2
r
n
r2 rn a2
r1 a3
=
r2
r2 r1 an+1
r2
r
3
rn+1
1-89
Autocorrelation LPC
Dialog
Box
Output(s)
The type of prediction coefficients output by the block. The block
can output polynomial coefficients (A), reflection coefficients (K),
or both (A and K).
Output prediction error power (P)
When selected, enables port P, which outputs the output
prediction error power.
Inherit prediction order from input dimensions
When selected, the block inherits the prediction order from the
input dimensions.
1-90
Autocorrelation LPC
References
Supported
Data
Types
See Also
Autocorrelation
Levinson-Durbin
Yule-Walker Method
lpc
1-91
Backward Substitution
Purpose
Library
Description
1-92
Backward Substitution
1
z
Output
data type
Accumulator or
product output
data type
MULTIPLIER
CAST
Input U
data type
ADDER
ADDER
DIVIDER
Output
data type
Accumulator
data type
Input B
data type
CAST
Input U
data type
1-93
Backward Substitution
1
z
Output
data type
Accumulator or
product output
data type
MULTIPLIER
CAST
Input U
data type
ADDER
ADDER
CAST
Output
data type
Accumulator
data type
Input B
data type
CAST
You can set the product output, accumulator, and output data types in
the block dialog as discussed in the following section.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Dialog
Box
1-94
The Main pane of the Backward Substitution block dialog box appears
as follows.
Backward Substitution
1-95
Backward Substitution
1-96
Backward Substitution
1-97
Backward Substitution
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-92 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-98
Backward Substitution
Same
as first input
1-99
Backward Substitution
Supported
Data
Types
Port
See Also
Cholesky Solver
Forward Substitution
LDL Solver
Levinson-Durbin
LU Solver
QR Solver
1-100
Bandpass Filter
Purpose
Library
Description
Dialog
Box
See Bandpass Filter Design Dialog Box Main Pane on page 4-689
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
1-101
Bandpass Filter
1-102
Bandpass Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify. Selecting Specify
enables the Order option so you can enter the filter order. When
you set the Impulse response to IIR, you can specify different
numerator and denominator orders. To specify a different
denominator order, you must select the Denominator order
check box.
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify.
1-103
Bandpass Filter
Denominator order
Select this check box to specify a different denominator order.
This option is enabled only if you set the Impulse response to
IIR and the Order mode to Specify.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
1-104
Bandpass Filter
1-105
Bandpass Filter
1-106
Bandpass Filter
Fstop2
Enter the frequency at the edge of the start of the second
stopband. Specify the value in either normalized frequency units
or the absolute units you select in Frequency units.
F3dB1
When Frequency constraints is 3 dB points, 3 dB points
and passband width, or 3 dB points and stopband width,
specify the lower-frequency 3 dB point.
F3dB2
When Frequency constraints is 3 dB points, 3 dB points
and passband width, or 3 dB points and stopband width,
specify the higher-frequency 3 dB point.
F6dB1
When Frequency constraints is 6 dB points, specify the
lower-frequency 6 dB point.
F6dB2
When Frequency constraints is 6 dB points, specify the
higher-frequency 6 dB point.
Passband width
When Frequency constraints is 3 dB points and passband
width, specify the width of the passband, in units corresponding
to the Frequency units parameter.
Stopband width
When Frequency constraints is 3 dB points and stopband
width, specify the width of the stopband, in units corresponding
to the Frequency units parameter.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude constraints
This option is only available when you specify the order of your
filter design. The options for Magnitude constraints depend
1-107
Bandpass Filter
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
1-108
Bandpass Filter
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is Equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
20 represents a reasonable trade between the accurate
approximation to the ideal filter and the time to design the
filter.
1-109
Bandpass Filter
Phase constraint
Specify the phase constraint of the filter as Linear, Maximum,
or Minimum.
Minimum order
When you select this parameter, the design method
determines and design the minimum order filter to meet
your specifications. Some filters do not provide this
parameter. Select Any, Even, or Odd from the drop-down list
to direct the design to be any minimum order, or minimum
even order, or minimum odd order.
Match Exactly
Specifies that the resulting filter design matches either
the passband or stopband or both bands when you select
passband or stopband or both from the drop-down list.
Minimum order
When you select this parameter, the design method
determines and design the minimum order filter to meet
your specifications. Some filters do not provide this
parameter. Select Any, Even, or Odd from the drop-down list
to direct the design to be any minimum order, or minimum
even order, or minimum odd order.
Note Generally, Minimum order designs are not
available for IIR filters.
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
1-110
Bandpass Filter
1-111
Bandpass Filter
Supported
Data
Types
Port
Input
Output
1-112
Bandstop Filter
Purpose
Library
Description
Dialog
Box
See Bandstop Filter Design Dialog Box Main Pane on page 4-697
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
1-113
Bandstop Filter
1-114
Bandstop Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify. Selecting Specify
enables the Order option so you can enter the filter order. When
you set the Impulse response to IIR, you can specify different
numerator and denominator orders. To specify a different
denominator order, you must select the Denominator order
check box.
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify.
1-115
Bandstop Filter
Denominator order
Select this check box to specify a different denominator order.
This option is enabled only if you set the Impulse response to
IIR and the Order mode to Specify.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
1-116
Bandstop Filter
Frequency constraints
When Order mode is Specify, select the filter features that the
block uses to define the frequency response characteristics. The
list contains the following options, when available for the filter
specifications.
Passband and stopband edges Define the filter by
specifying the frequencies for the edges for the stop- and
passbands.
Passband edges For IIR filters, define the filter by
specifying frequencies for the edges of the passband.
Stopband edges For IIR filters, define the filter by
specifying frequencies for the edges of the stopbands.
3 dB points For IIR filters, define the filter response by
specifying the locations of the 3 dB points. The 3 dB point is the
frequency for the point three decibels below the passband value.
3 dB points and passband width For IIR filters, define
the filter by specifying frequencies for the 3 dB points in the
filter response and the width of the passband.
3 dB points and stopband widths For IIR filters, define
the filter by specifying frequencies for the 3 dB points in the
filter response and the width of the stopband.
1-117
Bandstop Filter
1-118
Bandstop Filter
Fpass2
Enter the frequency at the edge of the start of the second
passband. Specify the value in either normalized frequency units
or the absolute units you select in Frequency units.
F3dB1
When Frequency constraints is 3 dB points, 3 dB points
and passband width, or 3 dB points and stopband width,
specify the lower-frequency 3 dB point.
F3dB2
When Frequency constraints is 3 dB points, 3 dB points
and passband width, or 3 dB points and stopband width,
specify the higher-frequency 3 dB point.
F6dB1
When Frequency constraints is 6 dB points, specify the
lower-frequency 6 dB point.
F6dB2
When Frequency constraints is 6 dB points, specify the
higher-frequency 6 dB point.
Passband width
When Frequency constraints is 3 dB points and passband
width, specify the width of the passband, in units corresponding
to the Frequency units parameter.
Stopband width
When Frequency constraints is 3 dB points and stopband
width, specify the width of the stopband, in units corresponding
to the Frequency units parameter.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude constraints
This option is only available when you specify the order of your
filter design. The options for Magnitude constraints depend on
1-119
Bandstop Filter
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is Equiripple.
1-120
Bandstop Filter
1-121
Bandstop Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
1-122
Bandstop Filter
1-123
Bandstop Filter
Supported
Data
Types
Port
Input
Output
1-124
Biquad Filter
Purpose
Library
Description
The Biquad Filter block independently filters each channel of the input
signal with the specified biquadratic IIR filter. When you specify the
filter coefficients in the dialog box, the block implements static filters
with fixed coefficients. When you provide the filter coefficients through
an input port, you can tune the coefficients during simulation.
The block filters an M-by-N input matrix as follows:
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each column as a
separate channel. In this mode, the block creates M instances of the
same filter, each with its own independent state buffer. Each of the
M filters process N input samples at every Simulink time step.
When you set the Input processing parameter to Elements as
channels (sample based), the block treats each element as a
separate channel. In this mode, the block creates M*N instances of
the same filter, each with its own independent state buffer. Each
filter processes one input sample at every Simulink time step.
This block supports variable-size input. This means that while the
block is simulating, the frame size (number of rows) can change. The
output dimensions always equal those of the input signal. The outputs
of this block numerically match the outputs of the dfilt object.
The Biquad Filter block supports the Simulink state logging feature.
See States in the Simulink Users Guide for more information.
1-125
Biquad Filter
Direct form I
Direct form I transposed
Direct form II
Direct form II transposed
If you select Input port(s), you enter information about the filter
structure in the block mask using the Filter structure parameter,
but the filter coefficients come into the block via input ports. The
following additional ports appear on the block icon:
1-126
dfilt.df1sos
dfilt.df1tsos
Biquad Filter
dfilt.df2sos
dfilt.df2tsos
b01
b
02
b0 M
b11
b12
b21
b22
a01
a02
a11
a12
b1 M
b2 M
a0 M
a1 M
a21
a22
a2 M
You can use the ss2sos and tf2sos functions from Signal Processing
Toolbox software to convert a state-space or transfer function
description of your filter into the second-order section description used
by this block.
The Scale values parameter specifies the scale values the block uses
between each SOS section. You can specify a real-valued scalar or a
vector of length M+1.
If you enter a scalar, the value specifies the gain value before the
first section of the second-order filter. The rest of the gain values
default to 1.
If you enter a vector of M+1 values, each value specifies a separate
section of the filter. For example, the first element is the first gain
value, the second element is the second gain value, and so on.
1
Section
input
g1
Scale value 1
g2
Section 1
Scale value 2
gM+1
...
Section M
1
Section
output
Select the Optimize unity scale values check box to optimize your
simulation when one or more scale values equal 1. Selecting this option
1-127
Biquad Filter
removes the unity gains so that the values are treated like Simulink
lines or wires. In some fixed-point cases when there are unity scale
values, selecting this parameter also omits certain casts. Refer to
Filter Structure Diagrams on page 1-148 for more information.
Description
Scalar
The block initializes all delay elements in the filter to the scalar
value.
Vector or matrix
(for applying different
delay elements to each
channel)
1-128
Biquad Filter
Examples
Dialog
Box
Coefficient Source
The Biquad Filter block can operate in three different modes. Select the
mode in the Coefficient source group box.
If you select Dialog parameters, you enter information about the
filter such as structure and coefficients in the block mask. In this
mode, you can choose the following filter structures in the Filter
structure parameter:
Direct form I
Direct form I transposed
Direct form II
Direct form II transposed
If you select Input port(s), you enter information about the filter
structure in the block mask using the Filter structure parameter,
but the filter coefficients come into the block via input ports. The
following additional ports appear on the block icon:
1-129
Biquad Filter
dfilt.df1sos
dfilt.df1tsos
dfilt.df2sos
dfilt.df2tsos
1-130
Biquad Filter
1-131
Biquad Filter
Filter structure
Select the filter structure.
This parameter is only visible when Dialog parameters or
Input port(s) is selected.
SOS Matrix
Specify an M-by-6 matrix, where M is the number of sections
in the second-order section filter. Each row of the SOS matrix
contains the numerator and denominator coefficients (bik and aik)
of the corresponding section in the filter.
b01
b
02
b0 M
b11
b12
b21
b22
a01
a02
a11
a12
b1 M
b2 M
a0 M
a1 M
a21
a22
a2 M
1-132
Biquad Filter
Initial conditions
Specify the initial conditions of the filter states. To learn how
to specify initial conditions, see Specifying Initial Conditions
on page 1-128.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
II or Direct form II transposed.
Initial conditions on zeros side
Specify the initial conditions for the filter states on the side of the
filter structure with the zeros (b0, b1,b2, ...); see the next diagram.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
I or Direct form I transposed. To learn how to specify initial
conditions, seeSpecifying Initial Conditions on page 1-128.
Initial conditions on poles side
Specify the initial conditions for the filter states on the side of the
filter structure with the poles (a0, a1,a2, ...); see the next diagram.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
I or Direct form I transposed. To learn how to specify initial
conditions, see Specifying Initial Conditions on page 1-128.
1-133
Biquad Filter
Action when the a0 values of the SOS matrix are not one
Specify the action the block should perform when the SOS matrix
a0j values do not equal one; None, Error, or Warn.
This parameter is only visible when Dialog parameters is
selected.
Optimize unity scale values
Select this check box to optimize your simulation when one or
more scale values equal 1. Selecting this option removes the unity
gains so that the values are treated like Simulink lines or wires.
In some fixed-point cases when there are unity scale values,
selecting this parameter also omits certain casts. Refer to Filter
Structure Diagrams on page 1-148 for more information.
This parameter is only visible when Dialog parameters is
selected.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
1-134
Biquad Filter
1-135
Biquad Filter
1-136
Biquad Filter
Filter structure
Select the filter structure.
This parameter is only visible when Dialog parameters or
Input port(s) is selected.
Initial conditions
Specify the initial conditions of the filter states. To learn how
to specify initial conditions, see Specifying Initial Conditions
on page 1-128.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
II or Direct form II transposed.
Initial conditions on zeros side
Specify the initial conditions for the filter states on the side of the
filter structure with the zeros (b0, b1,b2, ...); see the next diagram.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
I or Direct form I transposed. To learn how to specify initial
conditions, see Specifying Initial Conditions on page 1-128.
Initial conditions on poles side
Specify the initial conditions for the filter states on the side of the
filter structure with the poles (a0, a1,a2, ...); see the next diagram.
This parameter is only visible when Dialog parameters or
Input port(s) is selected and the filter structure is Direct form
I or Direct form I transposed. To learn how to specify initial
conditions, see Specifying Initial Conditions on page 1-128.
1-137
Biquad Filter
1-138
Biquad Filter
1-139
Biquad Filter
1-140
Biquad Filter
Filter
Specify the discrete-time filter object (dfilt) that you would like
the block to implement. You can do so in one of three ways:
You can fully specify the dfilt object in the block mask.
You can enter the variable name of a dfilt object that is
defined in any workspace.
You can enter a variable name for a dfilt object that is not
yet defined.
For more information on creating dfilt objects, see the dfilt
reference page.
View filter response
This button opens the Filter Visualization Tool (fvtool) from the
Signal Processing Toolbox product and displays the filter response
of the dfilt object specified in the Discrete-time filter object
(DFILT) parameter. For more information on FVTool, see the
Signal Processing Toolbox documentation.
Note If you specify a filter in the Discrete-time filter object
(DFILT) parameter, you must click the Apply button to apply
the filter before using the View filter response button.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-141
Biquad Filter
1-142
Biquad Filter
1-143
Biquad Filter
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; instead, they always
round to Nearest.
Overflow mode
Select the overflow mode for fixed-point operations. The filter
coefficients do not obey this parameter; instead, they are always
saturated.
Multiplicand
Choose how you specify the word length and the fraction length
of the multiplicand data type of a Direct form I transposed
filter structure. See Fixed-Point Data Types on page 1-128 and
the Direct Form I Transposed on page 1-151 filter structure
diagram for illustrations depicting the use of the multiplicand
data type in this block.
This parameter is only visible when the Filter structure
parameter is set to Direct form I transposed.
When you select Same as output, these characteristics match
those of the output of the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the product output, in
bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output. This
block requires power-of-two slope and a bias of zero.
Section input
Choose how you specify the word length and the fraction length of
the fixed-point data type going into each section of a biquadratic
filter. See Fixed-Point Data Types on page 1-128 for illustrations
depicting the use of the section input data type in this block.
When you select Same as input, these characteristics match
those of the input to the block.
1-144
Biquad Filter
When you select Binary point scaling, you can enter the
word and fraction lengths of the section input and output, in
bits.
When you select Slope and bias scaling, you can enter the
word lengths, in bits, and the slopes of the section input and
output. This block requires power-of-two slope and a bias of
zero.
Section output
Choose how you specify the word length and the fraction length
of the fixed-point data type coming out of each section of a
biquadratic filter. See Fixed-Point Data Types on page 1-128
for illustrations depicting the use of the section input data type
in this block.
When you select Same as input, these characteristics match
those of the input to the block.
When you select Binary point scaling, you can enter the
word and fraction lengths of the section input and output, in
bits.
When you select Slope and bias scaling, you can enter the
word lengths, in bits, and the slopes of the section input and
output. This block requires power-of-two slope and a bias of
zero.
Coefficients
Choose how you specify the word length and the fraction length
of the filter coefficients (numerator, denominator, and scale
value) when Dialog parameters is selected in the Coefficient
source group box. See Fixed-Point Data Types on page 1-128
for illustrations depicting the use of the coefficient data types
in this block:
When you select Same word length as input, the word
length of the filter coefficients match that of the input to the
block. In this mode, the block automatically sets the fraction
length of the coefficients to the binary-point only scaling that
1-145
Biquad Filter
provides you with the best precision possible given the value
and word length of the coefficients.
When you select Specify word length, you can enter the
word length of the coefficients, in bits. In this mode, the block
automatically sets the fraction length of the coefficients to
the binary-point only scaling that provides you with the best
precision possible given the value and word length of the
coefficients.
When you select Binary point scaling, you can enter the
word length and the fraction length of the coefficients, in bits.
If applicable, you can enter separate fraction lengths for the
numerator and denominator coefficients.
When you select Slope and bias scaling, you can enter
the word length, in bits, and the slope of the coefficients. If
applicable, you can enter separate slopes for the numerator
and denominator coefficients. This block requires power-of-two
slope and a bias of zero.
The filter coefficients do not obey the Rounding mode and
the Overflow mode parameters; instead, they are always
saturated and rounded to Nearest.
Product output
Use this parameter to specify how you would like to designate
the product output word and fraction lengths. See Fixed-Point
Data Types on page 1-128 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block:
When you select Same as input, these characteristics match
those of the input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the product output, in
bits.
1-146
Biquad Filter
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output. This
block requires power-of-two slope and a bias of zero.
Accumulator
Use this parameter to specify how you would like to designate
the accumulator word and fraction lengths. See Fixed-Point
Data Types on page 1-128 and Multiplication Data Types for
illustrations depicting the use of the accumulator data type in
this block:
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as product output, these
characteristics match those of the product output.
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulator. This
block requires power-of-two slope and a bias of zero.
State
Use this parameter to specify how you would like to designate
the state word and fraction lengths when Dialog parameters is
selected in the Coefficient source group box. See Fixed-Point
Data Types on page 1-128 for illustrations depicting the use of
the state data type in this block.
This parameter is not visible for Direct form I and Direct
form I transposed filter structures.
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as accumulator, these characteristics
match those of the accumulator.
1-147
Biquad Filter
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulator. This
block requires power-of-two slope and a bias of zero.
Output
Choose how you specify the output word length and fraction
length. See Fixed-Point Data Types on page 1-128 for
illustrations depicting the use of the output data type in this block.
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as accumulator, these characteristics
match those of the accumulator.
When you select Binary point scaling, you can enter the
word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the output. This block
requires power-of-two slope and a bias of zero.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Filter
Structure
Diagrams
1-148
Biquad Filter
Direct Form I
b0
1
Section
input
+
++
1
Section
output
+
--
z-1
z-1
b1
a1
z-1
z-1
b2
1
Section
input
a2
g1
Scale value 1
g2
Section 1
Scale value 2
gM+1
...
Section M
1
Section
output
1-149
Biquad Filter
The following diagram shows the data types for one section of the filter
for fixed-point signals.
Section input
data type
1
Section
input
z-1
b0
Cast
Numerator
accumulator
data type
Denominator
accumulator
data type
+
Cast
+
+
Denominator
accumulator
data type
+
-
Cast
Section output
data type
Numerator
coefficient
data type
b1
z-1
Numerator
product output
data type
z-1
Numerator
product output
data type
Cast
Denominator
accumulator
data type
Numerator
accumulator
data type
Cast
Denominator
product output
data type
Numerator
coefficient
data type
b2
1
Section
output
a1
Denominator
coefficient
data type
Numerator
product output
data type
Cast
Numerator
accumulator
data type
Cast
Denominator
accumulator
data type
Numerator
coefficient
data type
Denominator
product output
data type
z-1
a2
Denominator
coefficient
data type
The following diagrams show the fixed-point data types between filter
sections.
When the data is not optimized:
1
Input
Input
data type
g1
Section input
data type
Scale value
data type
Section output
data type
Section 1
g2
Section input
data type
Section output
data type
...
Section M
Scale value
data type
gM+1
Output
data type
Scale value
data type
1
Output
When you select Optimize unity scale values and scale values equal
1:
Input
data type
1
Input
1-150
Section input
data type
Section output
data type
Section input
data type
Cast
Cast
Section 1
...
Output
data type
Section output
data type
Cast
Section M
1
Output
Biquad Filter
b0
+
-
+
+
z-1
z-1
+
+
a1
b1
z-1
g1
Scale value 1
+
+
z-1
b2
a2
1
Section
input
1
Section
output
g2
Section 1
Scale value 2
gM+1
...
Section M
1
Section
output
1-151
Biquad Filter
The following diagram shows the data types for one section of the filter
for fixed-point signals.
Section input
data type
1
Section
input
Cast
Denominator
accumulator
data type
Cast
Multiplicand
data type
Numerator
product output
data type
b0
Cast
Numerator
accumulator
data type
Cast
+
+
Denominator
accumulator
data type
Numerator
accumulator
data type
Cast
Cast
z-1
z-1
Numerator
state data type
Denominator
state data type
Cast
Cast
Denominator
accumulator
data type
+
+
Section ouput
data type
Denominator
product output
data type
a1
Cast
b1
Numerator
product output
data type
Numerator
accumulator
data type
Cast
+
+
Denominator
accumulator
data type
Numerator
accumulator
data type
Cast
Cast
z-1
z-1
Denominator
state data type
Numerator
state data type
Cast
Cast
Denominator
product output
data type
a2
Denominator
coefficient
data type
b2
Numerator
product output
data type
Cast
Numerator
accumulator
data type
Numerator
coefficient
data type
The dashed casts are omitted when Optimize unity scale values is
selected and scale values equal one.
1-152
1
Section
output
Biquad Filter
The following diagrams show the fixed-point data types between filter
sections.
When the data is not optimized:
1
Input
Input
data type
g1
Section input
data type
Scale value
data type
Section output
data type
Section 1
g2
Section input
data type
Section output
data type
...
Scale value
data type
Section M
gM+1
Output
data type
Scale value
data type
1
Output
When you select Optimize unity scale values and scale values equal
1:
Denominator
accumulator
data type
Input
data type
1
Input
Numerator
accumulator
data type
Cast
Section 1
Denominator
accumulator
data type
...
Cast
Numerator
accumulator
data type
Output
data type
Cast
Section M
1
Output
1-153
Biquad Filter
Direct Form II
1
Section
input
b0
+
--
+
++
1
Section
output
z-1
a1
b1
z-1
b2
a2
1
Section
input
1-154
g1
Scale value 1
g2
Section 1
Scale value 2
gM+1
...
Section M
1
Section
output
Biquad Filter
The following diagram shows the data types for one section of the filter
for fixed-point signals.
Section input
data type
1
Section
input
Cast
Denominator
accumulator
data type
+
-
Denominator
accumulator
data type
Cast
State
data type
b0
Numerator
product output
data type
Cast
Numerator
accumulator
data type
+
+
Cast
Section output
data type
1
Section
output
z-1
Denominator
product output
data type
Cast
a1
b1
Denominator
coefficient
data type
Denominator
accumulator
data type
Cast
Numerator
product output
data type
Cast
Numerator
accumulator
data type
Numerator
coefficient
data type
z-1
Denominator
product output
data type
a2
Denominator
coefficient
data type
b2
Numerator
product output
data type
Cast
Numerator
accumulator
data type
Numerator
coefficient
data type
The dashed casts are omitted when Optimize unity scale values is
selected and scale values equal one.
1-155
Biquad Filter
The following diagrams show the fixed-point data types between filter
sections.
When the data is not optimized:
1
Input
Input
data type
g1
Section input
data type
Scale value
data type
Section output
data type
Section 1
g2
Section input
data type
Section output
data type
...
Scale value
data type
Section M
gM+1
Output
data type
Scale value
data type
1
Output
When you select Optimize unity scale values and scale values equal
1:
Denominator
accumulator
data type
Input
data type
1
Input
1-156
Numerator
accumulator
data type
Cast
Section 1
Denominator
accumulator
data type
...
Cast
Numerator
accumulator
data type
Output
data type
Cast
Section M
1
Output
Biquad Filter
1
Section
input
1
Section
output
+
+
z-1
b1
a1
a2
z-1
b2
1
Section
input
g1
Scale value 1
g2
Section 1
Scale value 2
gM+1
...
Section M
1
Section
output
1-157
Biquad Filter
The following diagram shows the data types for one section of the filter
for fixed-point signals.
Section input
data type
1
Section
input
b0
Numerator
product output
data type
Cast
Numerator
accumulator
data type
Cast
Section output
data type
Numerator
accumulator
data type
Numerator
coefficient
data type
Cast
z-1
State
data type
Cast
Denominator
accumulator
data type
Denominator
product output
data type
Cast
Denominator
accumulator
data type
b1
Numerator
product output
data type
Cast
Numerator
accumulator
data type
a1
Denominator
coefficient
data type
Cast
+
+
Numerator
accumulator
data type
Numerator
coefficient
data type
Cast
z-1
State
data type
b2
Numerator
coefficient
data type
1-158
Numerator
product output
data type
Cast
Denominator
accumulator
data type
Cast
Denominator
accumulator
data type
Cast
Denominator
product output
data type
a2
Denominator
coefficient
data type
1
Section
output
Biquad Filter
The following diagrams show the fixed-point data types between filter
sections.
When the data is not optimized:
1
Input
Input
data type
g1
Section input
data type
Scale value
data type
Section output
data type
Section 1
g2
Section input
data type
Section output
data type
...
Section M
Scale value
data type
gM+1
Output
data type
Scale value
data type
1
Output
When you select Optimize unity scale values and scale values equal
1:
Input
data type
1
Input
Supported
Data
Types
Section input
data type
Section output
data type
Section input
data type
Cast
Cast
Section 1
Output
data type
Section output
data type
...
Cast
Section M
Port
Input
1
Output
See Also
dfilt.df1sos
dfilt.df1tsos
1-159
Biquad Filter
1-160
dfilt.df2sos
dfilt.df2tsos
Purpose
Library
Description
n = kN + i
y(n) = w T (k 1)u(n)
e(n) = d(n) y(n)
w(k) = w(k 1) + f (u(n),e(n), )
The weight update function for the Block LMS adaptive filter algorithm
is defined as
f (u(n), e(n), ) =
N 1
u (kN + i)e(kN + i)
i =0
1-161
Variable
Description
u(n)
w(n)
y(n)
e(n)
d(n)
Use the Filter length parameter to specify the length of the filter
weights vector.
The Block size parameter determines how many samples of the input
signal are acquired before the filter weights are updated. The number
of rows in the input must be an integer multiple of the Block size
parameter.
The adaptation Step-size (mu) parameter corresponds to in the
equations. You can either specify a step-size using the input port,
Step-size, or enter a value in the Block Parameters: Block LMS Filter
dialog box.
Use the Leakage factor (0 to 1) parameter to specify the leakage
factor, 0 < 1 1 , in the leaky LMS algorithm shown below.
1-162
has length equal to the filter length and all of its values are equal to
the scalar value
When you select the Adapt port check box, an Adapt port appears on
the block. When the input to this port is greater than zero, the block
continuously updates the filter weights. When the input to this port is
zero, the filter weights remain at their current values.
When you want to reset the value of the filter weights to their initial
values, use the Reset input parameter. The block resets the filter
weights whenever a reset event is detected at the Reset port. The reset
signal rate must be the same rate as the data signal input.
From the Reset input list, select None to disable the Reset port. To
enable the Reset port, select one of the following from the Reset input
list:
Rising edge Triggers a reset operation when the Reset input
does one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
1-163
Falling edge
Falling edge
Falling edge
Falling edge
1-164
Dialog
Box
Filter length
Enter the length of the FIR filter weights vector.
1-165
Block size
Enter the number of samples to acquire before the filter weights
are updated. The number of rows in the input must be an integer
multiple of the Block size.
Specify step-size via
Select Dialog to enter a value for mu in the Block parameters:
LMS Filter dialog box. Select Input port to specify mu using
the Step-size input port.
Step-size (mu)
Enter the step-size. Tunable.
Leakage factor (0 to 1)
Enter the leakage factor, 0 < 1 1 . Tunable.
Initial value of filter weights
Specify the initial values of the FIR filter weights.
Adapt port
Select this check box to enable the Adapt input port.
Reset port
Select this check box to enable the Reset input port.
Output filter weights
Select this check box to export the filter weights from the Wts port.
References
Supported
Data
Types
Port
Input
Desired
1-166
Port
Adapt
Reset
See Also
Output
Same as Input
Error
Same as Input
Wts
Same as Input
LMS Filter
RLS Filter
1-167
Buffer
Purpose
Library
Description
The block coordinates the output frame size and frame rate of
nonoverlapping buffers such that the sample period of the signal is the
same at both the input and output: Tso = Tsi.
This block supports triggered subsystems when the block input and
output rates are the same.
1-168
Buffer
Output Dimensions
1-by-1 (scalar)
Mo-by-1
Mo-by-1
The input frame period is Mi Tsi, where Mi is the input frame size and
Tsi is the input sample period. The output frame period is ( Mo L ) Tsi ,
where L is the value of the Buffer overlap parameter and Tsi is the
input sample period. When you set the Buffer overlap parameter to
Mo 1, the output frame period equals the input sample period.
Output Dimensions
Mo-by-N
Mi-by-N (matrix)
Mo-by-N
The input frame period is Mi Tsi, where Mi is the input frame size and
Tsi is the input sample period. The output frame period is ( Mo L ) Tsi ,
which equals the sequence sample period when the Buffer overlap is
1-169
Buffer
Tso =
( Mo L ) Tsi
Mi
Latency
Zero-tasking latency means that the first input sample, received at t =
0, appears as the first output sample. In the Simulink single-tasking
mode, the Buffer block has zero-tasking latency for the following special
cases:
Scalar input and output ( Mo = Mi = 1 ) with zero or negative Buffer
overlap ( L 0 )
Input frame size is an integer multiple of the output frame size
Mi = kMo
where k is an integer with zero Buffer overlap ( L = 0 ); notable
cases of this include
1-170
Buffer
For all cases of single-tasking operation other than those listed above,
the Buffer blocks buffer is initialized to the value(s) specified by the
Initial conditions parameter. The block reads from this buffer to
generate the first D output samples, where
Mo + L ( L 0)
D=
( L < 0)
Mo
The dimensions of the Initial conditions parameter depend on
the Buffer overlap, L, and whether the input is single-channel or
multichannel:
When L 0 , the Initial conditions parameter must be a scalar.
When L = 0 , the Initial conditions parameter can be a scalar, or it
can be a vector with the following constraints:
1-171
Buffer
where the input is a 1-by-N row vector, and the output of the block is
an Mo-by-N matrix, Initial conditions can be
An Mo-by-N matrix
A length-Mo vector to be repeated across all columns of the initial
output(s)
A scalar to be repeated across all elements of the initial output(s)
In the special case where the output is a 1-by-N row vector, which is the
result of unbuffering an Mi-by-N matrix, the Initial conditions can be
A vector containing Mi samples to output sequentially for each
channel during the first Mi sample times
A scalar to be repeated across all elements of the initial output(s)
Note For more information on latency and the Simulink tasking modes,
see Excess Algorithmic Delay (Tasking Latency) and Scheduling in
the Simulink Coder Users Guide.
1-172
Buffer
with a buffer that accepts input every second and outputs every three
seconds. If you place this buffer inside an enabled subsystem that
is disabled every three seconds at t = 3s, t = 6s, and so on, the buffer
accumulates data in its internal reservoir without being able to empty
it. This condition results in overrun.
Underrun occurs when the buffer runs out of data to output. For
example, again consider buffering a scalar input to a frame size of three
with a buffer that accepts input every second and outputs every three
seconds. If you place this buffer inside an enabled subsystem that is
disabled at t = 10s, t = 11s, t = 13s, t = 14s, t = 16s, and t = 17s, its
internal reservoir becomes drained, and there is no data to output at t =
18s. This condition results in underrun.
To protect from overrun and underrun, the Buffer block keeps a record
of the amount of data in its internal reservoir. When the Buffer block
reads data, the amount of data in its reservoir goes up. When data is
output from the Buffer block, the amount of data in its reservoir goes
down. To protect from overrun, the oldest samples in the reservoir are
discarded whenever amount of data in the reservoir is larger than the
actual buffer size. To protect from underrun, the most recent samples
are repeated whenever an output is due and there is no data in the
reservoir.
Examples
1-173
Buffer
1-174
Buffer
Notice that the input vectors do not begin appearing at the output
until the second row of the second matrix. This is due to latency in the
Buffer block. The first output matrix (all zeros in this example) reflects
the value of the Initial conditions parameter, while the first row of
zeros in the second output is a result of the one-sample overlap between
consecutive output frames.
You can use the rebuffer_delay function with a frame size of 1 to
precisely compute the delay (in samples). For the previous example,
d = rebuffer_delay(1,3,1)
d =
4
This agrees with the four samples of delay (zeros) per channel shown in
the previous figure.
1-175
Buffer
Dialog
Box
1-176
Buffer
Supported
Data
Types
Port
Input
1-177
Buffer
Port
Output
See Also
Delay Line
Unbuffer
rebuffer_delay
See Convert Sample and Frame Rates in Simulink and Buffering and
Frame-Based Processing for more information.
1-178
Burg AR Estimator
Purpose
Library
Description
H ( z) =
G
G
=
1
A( z) 1 + a(2) z + + a( p + 1) z p
1-179
Burg AR Estimator
Characteristics
Advantages
1-180
Modified
Covariance
AR
Yule-Walker
Estimator
AR Estimator
Burg AR
Estimator
Covariance
AR Estimator
Does not
apply
window to
data
Applies window
to data
Minimizes
the forward
and backward
prediction errors
in the least squares
sense, with the
AR coefficients
constrained to
satisfy the L-D
recursion
Minimizes
the forward
prediction
error in the
least squares
sense
Minimizes
the forward
and
backward
prediction
errors in
the least
squares
sense
Minimizes
the forward
prediction error
in the least
squares sense
(also called
autocorrelation
method)
Always produces a
stable model
Always
produces a
stable model
Burg AR Estimator
Burg AR
Estimator
Covariance
AR Estimator
Modified
Covariance
AR
Yule-Walker
Estimator
AR Estimator
Disadvantages
May produce
unstable
models
May
produce
unstable
models
Performs
relatively
poorly for short
data records
Conditions for
Nonsingularity
Order must
be less than
or equal to half
the input frame
size
Order must
be less than
or equal to
2/3 the input
frame size
Because of
the biased
estimate, the
autocorrelation
matrix is
guaranteed to
positive-definite,
hence
nonsingular
1-181
Burg AR Estimator
Dialog
Box
Output(s)
The realization to output, model coefficients, reflection
coefficients, or both.
Inherit estimation order from input dimensions
When selected, sets the estimation order p to one less than the
length of the input vector.
Estimation order
The order of the AR model, p. This parameter is enabled when
you do not select Inherit estimation order from input
dimensions.
References
1-182
Burg AR Estimator
Supported
Data
Types
Port
Input
See Also
Burg Method
Covariance AR Estimator
Modified Covariance AR
Estimator
Yule-Walker AR Estimator
arburg
1-183
Burg Method
Purpose
Library
Description
The Burg Method block estimates the power spectral density (PSD)
of the input frame using the Burg method. This method fits an
autoregressive (AR) model to the signal by minimizing (least squares)
the forward and backward prediction errors. Such minimization occurs
with the AR parameters constrained to satisfy the Levinson-Durbin
recursion.
The input is a sample-based vector (row, column, or 1-D) or frame-based
vector (column only). This input represents a frame of consecutive time
samples from a single-channel signal. The block outputs a column
vector containing the estimate of the power spectral density of the
signal at Nfft equally spaced frequency points. The frequency points are
in the range [0,Fs), where Fs is the sampling frequency of the signal.
When you select the Inherit estimation order from input
dimensions parameter, the order of the all-pole model is one less than
the input frame size. Otherwise, the Estimation order parameter
specifies the order. The block computes the spectrum from the FFT of
the estimated AR model parameters.
Selecting the Inherit FFT length from estimation order parameter
specifies that Nfft is one greater than the estimation order. Clearing the
Inherit FFT length from estimation order check box, allows you
to use the FFT length parameter to specify Nfft as a power of 2. The
block zero-pads or wraps the input to Nfft before computing the FFT.
The output is always sample based.
When you select the Inherit sample time from input check box, the
block computes the frequency data from the sample period of the input
signal. For the block to produce valid output, the following conditions
must hold:
1-184
Burg Method
The input to the block is the original signal, with no samples added
or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time from
input check box. You can then specify a sample time using the Sample
time of original time series parameter.
The Burg Method and Yule-Walker Method blocks return similar results
for large frame sizes. The following table compares the features of the
Burg Method block to the Covariance Method, Modified Covariance
Method, and Yule-Walker Method blocks.
Characteristics
Burg
Covariance
Modified
Covariance
Yule-Walker
Applies window
to data
Minimizes
the forward
and backward
prediction
errors in the
least squares
sense, with the
AR coefficients
constrained to
satisfy the L-D
recursion
Minimizes
the forward
prediction
error in the
least squares
sense
Minimizes
the forward
and backward
prediction
errors in the
least squares
sense
Minimizes
the forward
prediction error
in the least
squares sense
(also called
autocorrelation
method)
1-185
Burg Method
Advantages
Modified
Covariance
Burg
Covariance
Yule-Walker
High resolution
for short data
records
Better
resolution than
Y-W for short
data records
(more accurate
estimates)
High resolution
for short data
records
Performs as
well as other
methods for
large data
records
Always
produces a
stable model
Able to extract
frequencies
from data
consisting of
p or more pure
sinusoids
Able to extract
frequencies
from data
consisting of
p or more pure
sinusoids
Always
produces a
stable model
Does not
suffer spectral
line-splitting
Disadvantages
1-186
Peak locations
highly
dependent on
initial phase
May produce
unstable
models
May produce
unstable
models
Performs
relatively
poorly for short
data records
May suffer
spectral
line-splitting
for sinusoids in
noise, or when
order is very
large
Frequency bias
for estimates
of sinusoids in
noise
Peak locations
slightly
dependent on
initial phase
Frequency bias
for estimates
of sinusoids in
noise
Burg Method
Burg
Covariance
Examples
Yule-Walker
Minor
frequency bias
for estimates
of sinusoids in
noise
Frequency bias
for estimates
of sinusoids in
noise
Conditions for
Nonsingularity
Modified
Covariance
Order must
be less than
or equal to half
the input frame
size
Order must be
less than or
equal to 2/3 the
input frame
size
Because of
the biased
estimate, the
autocorrelation
matrix is
guaranteed
to be
positive-definite,
hence
nonsingular
The dspsacomp example compares the Burg method with several other
spectral estimation methods.
1-187
Burg Method
Dialog
Box
1-188
Burg Method
FFT length
Enter the number of data points on which to perform the FFT,
Nfft. When Nfft is larger than the input frame size, the block
zero-pads each frame as needed. When Nfft is smaller than the
input frame size, the block wraps each frame as needed. This
parameter becomes visible only when you clear the Inherit FFT
length from input dimensions check box.
Inherit sample time from input
If you select the Inherit sample time from input check box, the
block computes the frequency data from the sample period of the
input signal. For the block to produce valid output, the following
conditions must hold:
The input to the block is the original signal, with no samples
added or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time
from input check box. You can then specify a sample time using
the Sample time of original time series parameter.
Sample time of original time series
Specify the sample time of the original time-domain signal. This
parameter becomes visible only when you clear the Inherit
sample time from input check box.
References
1-189
Burg Method
Supported
Data
Types
Port
Input
Output
See Also
Burg AR Estimator
Covariance Method
Short-Time FFT
Yule-Walker Method
1-190
Purpose
Error when input signal does or does not match selected attributes
exactly
Library
Description
Signal Attributes
The Check Signal Attributes block can test for up to five different signal
attributes, as specified by the following parameters. When you select
Ignore for any parameter, the block does not check the signal for the
corresponding attribute. For example, when you set Complexity to
Ignore, neither real nor complex inputs cause the block to generate an
error. The attributes are:
Complexity
Check whether the input is real or complex. You can display this
information in a model by attaching a Probe block with Probe
complex signal selected. Alternatively, you can select Port Data
Types from the Display > Signals & Ports menu.
Frame status
1-191
1-192
Dimensions
Is...
Is not...
1-D
1-D vector,
1-D scalar
M-by-N matrix,
1-by-N matrix (row vector),
M-by-1 matrix (column vector),
1-by-1 matrix (2-D scalar)
2-D
M-by-N matrix,
1-by-N matrix (row vector),
M-by-1 matrix (column vector),
1-by-1 matrix (2-D scalar)
1-D vector,
1-D scalar
Scalar
(1-D or 2-D)
1-D scalar,
1-by-1 matrix (2-D scalar)
Vector
(1-D or 2-D)
1-D vector,
1-D scalar,
1-by-N matrix (row vector),
M-by-1 matrix (column vector),
1-by-1 matrix (2-D scalar)
Vector (1-D or 2-D) or scalar
Row Vector
(2-D)
1-D vector,
1-D scalar,
M-by-N matrix with M>1
Column Vector
(2-D)
1-D vector,
1-D scalar,
M-by-N matrix with N>1
Dimensions
Is...
Is not...
Full matrix
1-D vector,
1-D scalar,
1-by-N matrix (row vector),
M-by-1 matrix (column vector),
1-by-1 matrix (2-D scalar)
Square matrix
When you select Signal Dimensions from the Display > Signals &
Ports menu, Simulink displays the size of a 1-D vector signal as an
unbracketed integer, and displays the dimension of a 2-D signal as
a pair of bracketed integers, [MxN]. Simulink does not display any
size information for a 1-D or 2-D scalar signal. You can also display
dimension information for a signal in a model by attaching a Probe
block with Probe signal dimensions selected.
Data type
Check the signal data type for compliance (Is...) or noncompliance
(Is not...) with the attributes in the subordinate General data
type menu. See the following table. You can individually select
any of the specific data types listed in the Is... column from the
subordinate Specific data type menu.
1-193
General Data
Type
Is...
Is not...
Boolean
boolean
enumerated
Enumerated
Floating point
single,
double
Floating point
or Boolean
single,
double,
boolean
fixed point,
Fixed point
Integer
uint8, int8,
uint16,
int16,
uint32,
int32
enumerated
Signed integer
int8, int16,
int32
Unsigned
integer
uint8, uint16,
uint32
1-194
enumerated
1-195
Dialog
Box
1-196
Dimensionality
Specify whether you want to check the input for compliance
or noncompliance with the attributes in the subordinate
Dimensions menu. When you select Ignore from the list, the
block does not check the dimensionality of the input.
Dimensions
Specify the dimensions for which you want to check the input.
This parameter is only visible when you set the Dimensionality
parameter to Is... or Is not....
Data type
Specifies whether you want to check the input for compliance or
noncompliance with the attributes in the subordinate General
data type menu. When you select Ignore from the list, the block
does not check the input data type.
General data type
Specify the general data type for which you want to check the
input. This parameter is only visible when you set the Data type
to Is... or Is not....
Specific floating-point
Specify the floating-point data type for which you want to check
the input. This parameter is only visible when you set the
General data type to Floating-point or Floating-point or
boolean.
Specific fixed-point
Specify the fixed-point data type for which you want to check the
input. This parameter is only visible when you set the General
data type to Fixed-point.
Specific integer
Specify the integer data type for which you want to check the
input. This parameter is only visible when you set the General
data type to Integer.
1-197
Sample time
Specify the sample time for which you want to check the input,
Discrete or Continuous. When you select Ignore from the list,
the block does not check the sample time of the input.
Supported
Data
Types
Port
Input
Output
See Also
1-198
Buffer
Simulink
Inherit Complexity
Probe
Simulink
Reshape
Simulink
Submatrix
1-199
Chirp
Purpose
Library
Sources
dspsrcs4
Description
1-200
Chirp
fi(tg)
tg
Tsw
0
(t)
fi(t)
fi(actual)(t)
ychirp(t)
Sample based
1-201
Chirp
Possible Setting
Parameter
Description
Frequency sweep
Linear
Determines whether
the sweep frequencies
vary linearly,
quadratically, or
logarithmically.
Linear and swept
cosine sweeps both
vary linearly.
Quadratic
Logarithmic
Swept cosine
Sweep mode
Unidirectional
Bidirectional
Determines whether
the sweep is
unidirectional
or bidirectional.
For details, see
Unidirectional and
Bidirectional Sweep
Modes on page 1-203
1-202
Chirp
For information on how to set the frequency values in your sweep, see
Setting Instantaneous Frequency Sweep Values on page 1-204.
1-203
Chirp
Sweep Mode
Parameter
Settings
Sweep Characteristics
Unidirectional
Bidirectional
1-204
Chirp
Frequency
Sweep
Sweep Value
at
t= 0
Sweep Value
at
t = tg
Time when
Sweep Value
Is Target
Frequency,
fi(tg)
Linear
f0
fi(tg)
tg
Quadratic
f0
fi(tg)
tg
Logarithmic
f0
fi(tg)
tg
Swept cosine
f0
2fi(tg) - f0
tg/2
1-205
Chirp
fi (t) =
1 d (t)
2
dt
1-206
Chirp
Frequency
Sweep
Linear
Quadratic
Block Output
Chirp Signal
User-Specified
Frequency
Sweep, fi(t)
fi (t) = f0 + t
Same as Linear
fi (t) = f0 + t2
=
Logarithmic Same as Linear
( )
t
tg
fi t g
Fi (t) = f0
f0
Actual
Frequency
Sweep, fi(actual)(t)
fi (t g ) f0
tg
fi (t g ) f0
N/A
t2g
fi( actual) (t) = fi (t)
Same as Linear
Same as
Linear
fi (t) =
1 d (t)
2
dt
1-207
Chirp
Linear, and tune the linear sweep values by setting other parameters
appropriately. The block outputs a chirp signal, the phase derivative of
which is the specified linear sweep. This ensures that the instantaneous
frequency of the output is the linear sweep you desired. For equations
describing the linear, quadratic, and logarithmic sweeps, see Equations
for Output Computation on page 1-206.
Swept cosine
chirp output
(Instantaneous
frequency equation,
shown above, does
not hold.)
Note that the instantaneous frequency equation, shown above, does not
hold for the swept cosine chirp, so the user-defined frequency sweep,
fi(t), is not the actual output frequency sweep, fi(actual)(t), of the swept
cosine chirp. Thus, the swept cosine output might not behave as you
expect. To learn more about swept cosine chirp behavior, see Cautions
Regarding the Swept Cosine Sweep on page 1-208 and Equations for
Output Computation on page 1-206.
1-208
Chirp
1-209
Chirp
Dialog
Box
1-210
Frequency sweep
The type of output instantaneous frequency sweep, fi(t): Linear,
Logarithmic, Quadratic, or Swept cosine.
Chirp
Sweep mode
The directionality of the chirp signal: Unidirectional or
Bidirectional.
Initial frequency (Hz)
For Linear, Quadratic, and Swept cosine sweeps, the initial
frequency, f0, of the output chirp signal. For Logarithmic sweeps,
Initial frequency is one less than the actual initial frequency of
the sweep. Also, when the sweep is Logarithmic, you must set
the Initial frequency to be less than the Target frequency.
Tunable.
Target frequency (Hz)
For Linear, Quadratic, and Logarithmic sweeps, the
instantaneous frequency, fi(tg), of the output at the Target
time, tg. For a Swept cosine sweep, Target frequency is the
instantaneous frequency of the output at half the Target time,
tg/2. When Frequency sweep is Logarithmic, you must set the
Target frequency to be greater than the Initial frequency.
Tunable.
Target time (s)
For Linear, Quadratic, and Logarithmic sweeps, the time, tg,
at which the Target frequency, fi(tg), is reached by the sweep.
For a Swept cosine sweep, Target time is the time at which
the sweep reaches 2fi(tg) - f0. You must set Target time to be no
greater than Sweep time , Tsw t g . Tunable.
Sweep time (s)
In Unidirectional Sweep mode, the Sweep time, Tsw, is the
period of the output frequency sweep. In Bidirectional Sweep
mode, the Sweep time is half the period of the output frequency
sweep. You must set Sweep time to be no less than Target
time, Tsw t g . Tunable.
Initial phase (rad)
The phase, 0 , of the cosine output at t=0; ychirp (t) = cos(0 ) .
Tunable.
1-211
Chirp
Sample time
The sample period, Ts, of the output. The output frame period is
Mo*Ts.
Samples per frame
The number of samples, Mo, to buffer into each output frame.
When the value of this parameter is 1, the block outputs a
sample-based signal.
Output data type
The data type of the output, single-precision or double-precision.
Examples
The first few examples demonstrate how to use the Chirp blocks main
parameters, how to view the output in the time domain, and how to
view the output spectrogram:
Example 1: Setting a Final Frequency Value for Unidirectional
Sweeps on page 1-212
Example 2: Bidirectional Sweeps on page 1-216
Example 3: When Sweep Time is Greater Than Target Time on
page 1-218
Examples 4 and 5 illustrate Chirp block settings that might produce
unexpected outputs:
Example 4: Output Sweep with Negative Frequencies on page 1-220
Example 5: Output Sweep with Frequencies Greater Than Half the
Sampling Frequency on page 1-221
1-212
Chirp
This technique might not work for swept cosine sweeps. For details, see
Cautions Regarding the Swept Cosine Sweep on page 1-208.
Open the Example 1 model by typing ex_chirp_ref at the MATLAB
command line. You can also rebuild the model yourself; see the
following list for model parameter settings (leave unlisted parameters
in their default states).
Since Target time is set to equal Sweep time (1 second), the Target
frequency (25 Hz) is the final frequency of the unidirectional sweep.
Run your model to see the time domain output:
1-213
Chirp
1-214
Chirp
Linear
Sweep mode
Unidirectional
Initial frequency
Target frequency
25
Target time
Sweep time
1-215
Chirp
Initial phase
Sample time
1/400
400
Time
dsp_examples_yout
1-216
Chirp
1-217
Chirp
1-218
Chirp
1-219
Chirp
1-220
Chirp
1-221
Chirp
1-222
Chirp
Supported
Data
Types
See Also
Signal From
Workspace
Signal Generator
Simulink
1-223
Chirp
1-224
Sine Wave
chirp
spectrogram
Cholesky Factorization
Purpose
Library
Description
S = LL*
where L is a lower triangular square matrix with positive diagonal
elements and L* is the Hermitian (complex conjugate) transpose of L.
The block outputs a matrix with lower triangle elements from L and
upper triangle elements from L*. The output is not in the same form
as the output of the MATLAB chol function. In order to convert the
output of the Cholesky Factorization block to the MATLAB form, use
the following equation:
R = triu(LL');
1-225
Cholesky Factorization
1-226
Cholesky Factorization
Dialog
Box
1-227
Cholesky Factorization
References
Supported
Data
Types
Port
LL'
See Also
Autocorrelation LPC
Cholesky Inverse
Cholesky Solver
LDL Factorization
LU Factorization
QR Factorization
chol
MATLAB
1-228
Cholesky Inverse
Purpose
Library
Description
S 1 = ( LL )1
L is a lower triangular square matrix with positive diagonal elements
and L* is the Hermitian (complex conjugate) transpose of L. Only the
diagonal and upper triangle of the input matrix are used, and any
imaginary component of the diagonal entries is disregarded. Cholesky
factorization requires half the computation of Gaussian elimination (LU
decomposition), and is always stable.
1-229
Cholesky Inverse
Dialog
Box
References
Supported
Data
Types
See Also
1-230
Cholesky
Factorization
Cholesky Solver
LDL Inverse
Cholesky Inverse
LU Inverse
Pseudoinverse
inv
MATLAB
1-231
Cholesky Solver
Purpose
Library
Description
The Cholesky Solver block solves the linear system SX=B by applying
Cholesky factorization to input matrix at the S port, which must be
square (M-by-M) and Hermitian positive definite. Only the diagonal and
upper triangle of the matrix are used, and any imaginary component
of the diagonal entries is disregarded. The input to the B port is the
right side M-by-N matrix, B. The M-by-N output matrix X is the unique
solution of the equations.
A length-M vector input for right side B is treated as an M-by-1 matrix.
1-232
Cholesky Solver
Algorithm
S = LL
where L is a lower triangular square matrix with positive diagonal
elements.
The equation SX=B then becomes
LL X = B
which is solved for X by making the substitution Y = L X , and
solving the following two triangular systems by forward and backward
substitution, respectively.
LY = B
L X = Y
Dialog
Box
1-233
Cholesky Solver
Supported
Data
Types
See Also
Autocorrelation LPC
Cholesky Factorization
Cholesky Inverse
LDL Solver
LU Solver
QR Solver
chol
MATLAB
1-234
CIC Compensator
Purpose
Library
Description
Dialog
Box
See CIC Compensator Filter Design Dialog Box Main Pane on page
4-710 for more information about the parameters of this block. The
Data Types and Code Generation panes are not available for blocks
in the DSP System Toolbox Filter Designs library.
1-235
CIC Compensator
1-236
CIC Compensator
Filter Specifications
In this group, you specify your filter format, such as the filter order
mode and the filter type.
Filter order mode
Select either Minimum (the default) or Specify from the drop-down
list. Selecting Specify enables the Order option (see the
following sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Filter order mode.
1-237
CIC Compensator
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Number of CIC sections
Specify the number of sections in the CIC filter for which you are
designing this compensator. Select the number of sections from
the drop-down list or enter the number.
Differential Delay
Specify the differential delay of your target CIC filter. The default
value is 1. Most CIC filters use 1 or 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve.
Frequency Specifications
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
1-238
CIC Compensator
available when you select one of the frequency options from the
Frequency units list.
Output Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter output. When you
provide an output sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available only when you design interpolators.
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select in Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select in Frequency units.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels
1-239
CIC Compensator
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default method is Equiripple.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
20 represents a reasonable trade between the accurate
approximation to the ideal filter and the time to design the
filter.
Phase constraint
Specify the phase constraint of the filter as Linear, Maximum,
or Minimum.
1-240
CIC Compensator
Minimum order
When you select this parameter, the design method
determines and design the minimum order filter to meet
your specifications. Some filters do not provide this
parameter. Select Any, Even, or Odd from the drop-down list
to direct the design to be any minimum order, or minimum
even order, or minimum odd order.
Match Exactly
Specifies that the resulting filter design matches either
the passband or stopband or both bands when you select
passband or stopband or both from the drop-down list.
Stopband Shape
Stopband shape lets you specify how the stopband changes
with increasing frequency. Choose one of the following
options:
Flat Specifies that the stopband is flat. The
attenuation does not change as the frequency increases.
Linear Specifies that the stopband attenuation
changes linearly as the frequency increases. Change the
slope of the stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in
Stopband decay.
Stopband Decay
When you set Stopband shape, Stopband decay specifies
the amount of decay applied to the stopband. the following
conditions apply to Stopband decay based on the value of
Stopband Shape:
When you set Stopband shape to Flat, Stopband
decay has no affect on the stopband.
1-241
CIC Compensator
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, the filter uses direct-form structure.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
1-242
CIC Compensator
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed
see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
Rate options
When the Filter type parameter specifies a multirate filter,
select the rate processing rule for the block from following options:
Enforce single-rate processing When you select this
option, the block maintains the sample rate of the input.
Allow multirate processing When you select this option,
the block adjusts the rate at the output to accommodate an
increased or reduced number of samples. To select this option,
you must set the Input processing parameter to Elements as
channels (sample based).
Use symbolic names for coefficients
Select this check box to enable the specification of coefficients
using MATLAB variables. The available coefficient names differ
depending on the filter structure. Using symbolic names allows
1-243
CIC Compensator
Supported
Data
Types
Port
Input
Output
1-244
CIC Decimation
Purpose
Library
Description
1 z RM )
(
N
N
H ( z) = H I ( z) H c ( z) =
N
(1 z1 )
RM 1
= z k
k=0
where
HI is the transfer function of the integrator part of the filter.
HC is the transfer function of the comb part of the filter.
N is the number of sections. The number of sections in a CIC filter
is defined as the number of sections in either the comb part or the
integrator part of the filter. This value does not represent the total
number of sections throughout the entire filter.
R is the decimation factor.
M is the differential delay.
The CIC Decimation block requires a Fixed-Point Designer license.
The block supports real and complex fixed-point inputs. In its normal
mode of operation, the CIC Decimation block allows the adders
numeric values to overflow and wrap around [1] [3]. The Fixed-Point
infrastructure then causes overflow warnings to appear on the
command line. This overflow is of no consequence.
1-245
CIC Decimation
Examples
See GSM Digital Down Converter for an example using the CIC
Decimation block.
Dialog
Box
Coefficient Source
The CIC Decimation block can operate in two different modes. Select
the mode in the Coefficient source group box. If you select
Dialog parameters, you enter information about the filter such as
structure and coefficients in the block mask.
Multirate filter object (MFILT), you specify the filter using an
mfilt object.
Different items appear on the CIC Decimation block dialog depending
on whether you select Dialog parameters or Multirate filter object
(MFILT) in the Coefficient source group box. See the following
sections for details:
Specify Filter Characteristics in Dialog on page 1-247
1-246
CIC Decimation
1-247
CIC Decimation
1-248
CIC Decimation
1-249
CIC Decimation
Rate options
Specify the rate processing rule for the block. You can select one
of the following options:
Enforce single-rate processing When you select this
option, the block performs frame-based processing and produces
an output that has the same sample rate as the input. To
decimate the signal while maintaining the input sample rate,
the block decreases the output frame size. In this mode, the
input column size must be a multiple of the decimation factor, R.
Allow multirate processing When you select this option,
the block performs sample-based processing. In this mode, the
block produces an output with a sample rate that is R times
slower than the input sample rate.
Note The option Inherit from input (this choice will be
removed - see release notes) will be removed in a future
release. See Frame-Based Processing in the DSP System
Toolbox Release Notes for more information.
View filter response
This button opens the Filter Visualization Tool (fvtool) from the
Signal Processing Toolbox product and displays the filter response
of the filter defined in the block. For more information on FVTool,
see the Signal Processing Toolbox documentation.
Note If you specify an mfilt object in the Multirate filter
variable parameter, you must click the Apply button to apply
the filter before using the View filter response button.
1-250
CIC Decimation
1-251
CIC Decimation
1-252
CIC Decimation
References
Supported
Data
Types
See Also
CIC Interpolation
FIR Decimation
FIR Interpolation
filter
1-253
CIC Decimation
1-254
mfilt.cicdecim
mfilt.cicinterp
CIC Filter
Purpose
Library
Description
Dialog
Box
Main Pane
See CIC Filter Design Dialog Box Main Pane on page 4-706 for
more information about the parameters of this block. The Data Types
and Code Generation panes are not available for blocks in the DSP
System Toolbox Filter Designs library.
1-255
CIC Filter
1-256
CIC Filter
In this group, you specify your CIC filter format, such as the filter type
and the differential delay.
Filter type
Select whether your filter will be a decimator or an interpolator.
Your choice determines the type of filter and the design methods
and structures that are available to implement your filter.
Selecting decimator or interpolator activates the Factor
option. When you design an interpolator, you enable the Output
Fs parameter.
When you design either a decimator or interpolator, the resulting
filter is a CIC filter that decimates or interpolates your input
signal.
Differential delay
Specify the differential delay of your CIC filter as an integer value
greater than or equal to 1. The default value is 1. The differential
delay changes the shape, number, and location of nulls in the
1-257
CIC Filter
1-258
CIC Filter
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Filter Implementation
1-259
CIC Filter
1-260
CIC Filter
Supported
Data
Types
Port
Input
Output
Fixed point
1-261
CIC Interpolation
Purpose
Library
Description
H ( z) = H I N ( z) HC N ( z) =
(1 z RM ) N
(1 z1 ) N
RM 1
= z k
k=0
where
HI is the transfer function of the integrator part of the filter.
HC is the transfer function of the comb part of the filter.
N is the number of sections. The number of sections in a CIC filter
is defined as the number of sections in either the comb part or the
integrator part of the filter. This value does not represent the total
number of sections throughout the entire filter.
R is the interpolation factor.
M is the differential delay.
The CIC Interpolation block requires a Fixed-Point Designer license.
The block supports real and complex fixed-point inputs. In its normal
mode of operation, the CIC Interpolation block allows the adders
numeric values to overflow and wrap around [1] [3]. The Fixed-Point
infrastructure then causes overflow warnings to appear on the
command line. This overflow is of no consequence.
1-262
CIC Interpolation
Dialog
Box
Coefficient Source
The CIC Interpolation block can operate in two different modes. Select
the mode in the Coefficient source group box. If you select:
Dialog parameters, you enter information about the filter such as
structure and coefficients in the block mask
Multirate filter object (MFILT), you specify the filter using an
mfilt object.
Different items appear on the CIC Interpolation block dialog depending
on whether you select Dialog parameters or Multirate filter object
(MFILT) in the Coefficient source group box. See the following
sections for details:
Specify Filter Characteristics in Dialog on page 1-264
Specify Multirate Filter Object on page 1-268
1-263
CIC Interpolation
1-264
CIC Interpolation
( R M) N
)) + I
R
where
I = input word length
M = differential delay
N = number of sections
R = interpolation factor
The other section word lengths are set is such a way as to
accommodate the bit growth, as described in Hogenauers paper
[1]. All fraction lengths are set to the input fraction length.
Minimum section word lengths In this mode, you specify
the word length of the filter output in the Output word
1-265
CIC Interpolation
1-266
CIC Interpolation
1-267
CIC Interpolation
1-268
CIC Interpolation
1-269
CIC Interpolation
1-270
CIC Interpolation
References
Supported
Data
Types
See Also
CIC Decimation
FIR Decimation
1-271
CIC Interpolation
1-272
FIR Interpolation
filter
mfilt.cicdecim
mfilt.cicinterp
Comb Filter
Purpose
Library
Description
Dialog
Box
See Comb Filter Design Dialog BoxMain Pane on page 4-717 for
more information about the parameters of this block. The Data Types
and Code Generation panes are not available for blocks in the DSP
System Toolbox Filter Designs library.
1-273
Comb Filter
1-274
Comb Filter
Filter Specifications
In this group, you specify the type of comb filter and the number of
peaks or notches.
Comb Type
Select either Notch or Peak from the drop-down list. Notch
creates a comb filter that attenuates a set of harmonically related
frequencies. Peak creates a comb filter that amplifies a set of
harmonically related frequencies.
Order mode
Select either Order or Number of Peaks/Notches from the
drop-down menu.
Select Order to enter the desired filter order in the dialog box.
The comb filter has notches or peaks at increments of 2/Order
in normalized frequency units.
Select Number of Peaks or Number of Notches to specify the
number of peaks or notches and the Shelving filter order
1-275
Comb Filter
.
Shelving filter order
The Shelving filter order is a positive integer that determines
the sharpness of the peaks or notches. Larger values result in
sharper peaks or notches.
Frequency specifications
In this group, you specify the frequency constraints and frequency units.
Frequency specifications
Select either Quality factor or Bandwidth.
Quality factor is the ratio of the center frequency of the peak or
notch to the bandwidth calculated at the 3 dB point.
Bandwidth specifies the bandwidth of the peak or notch. By
Magnitude specifications
Specify the units for the magnitude specification and the gain at which
the bandwidth is measured. This menu is disabled if you specify a filter
order. Select one of the following magnitude units from the drop down
list:
1-276
Comb Filter
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
The IIR Butterworth design is the only option for peaking or
notching comb filters.
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
1-277
Comb Filter
1-278
Comb Filter
Supported
Data
Types
Port
Input
Output
1-279
Complex Cepstrum
Purpose
Library
Transforms
dspxfrm3
Description
When you select the Inherit FFT length from input port
dimensions check box, the output frame size matches the input frame
size (Mo=M). In this case, the block processes sample-based length-M
row vector inputs as a single channel (that is, as an M-by-1 column
vector), and returns the result as a length-M column vector. The block
always processes unoriented vector inputs as a single channel, and
returns the result as a length-M column vector.
The output port rate is the same as the input port rate.
1-280
Complex Cepstrum
Dialog
Box
Supported
Data
Types
See Also
DCT
FFT
Real Cepstrum
cceps
1-281
Complex Exponential
Purpose
Library
Description
y = e ju = cos u + j sin u
where j = 1 . The output is complex and the same size as the input.
Dialog
Box
Supported
Data
Types
See Also
1-282
Math Function
Simulink
Sine Wave
exp
MATLAB
Constant
Purpose
Library
Sources
dspsrcs4
Description
1-283
Purpose
Library
Sources
dspsrcs4
Description
Dialog
Box
1-284
The Main pane of the Constant Diagonal Matrix block dialog appears
as follows.
1-285
1-286
Supported
Data
Types
See Also
Create Diagonal
Matrix
Constant
Simulink
Identity Matrix
diag
MATLAB
1-287
Constant Ramp
Purpose
Library
Signal Operations
dspsigops
Description
1-288
Constant Ramp
Dialog
Box
The Main pane of the Constant Ramp block dialog appears as follows.
1-289
Constant Ramp
Offset
Specify the scalar y-intercept of the ramp.
The Data Types pane of the Constant Ramp block dialog appears as
follows.
Same
1-290
Constant Ramp
Supported
Data
Types
See Also
Create Diagonal
Matrix
Constant
Simulink
Ramp
Simulink
Identity Matrix
1-291
Purpose
Library
dspobslib
Description
Dialog
Box
1-292
Supported
Data
Types
1-293
Purpose
Library
Description
1-294
Dialog
Box
Supported
Data
Types
Port
Input
1-295
Port
Output
See Also
1-296
Buffer
Frame Conversion
Reshape
Simulink
Submatrix
Purpose
Library
Description
The Convert 2-D to 1-D block reshapes an M-by-N matrix input to a 1-D
vector with length M*N.
y = u(:)
Dialog
Box
1-297
Supported
Data
Types
Port
Input
Output
See Also
1-298
Buffer
Frame Status
Conversion
(Obsolete)
Reshape
Simulink
Submatrix
Convolution
Purpose
Library
Signal Operations
dspsigops
Description
There are two DSP System Toolbox blocks that can be used for this
purpose:
Convolution
Digital Filter
The Convolution block assumes that all of u and h are available at each
Simulink time step, and computes the entire convolution at every one.
The Digital Filter block can be used for convolving signals in situations
where all of h is available at each time step, but u is a sequence that
comes in over the life of the simulation. When you use the Digital Filter
block, the convolution is computed only once. To convolve inputs with
the Digital Filter block, you must set the Transfer function type to
FIR (all zeros).
Use the following questions to help you determine which block best
fits your needs:
1-299
Convolution
Question
Answer
Recommended Block(s)
Convolution block
Convolution block
Convolution block
None
Convolution block
1-300
Convolution
yi, j =
max( Mu , Mv ) 1
uk, j v( i k ), j
k =0
0 i ( Mu + Mv 2 )
Inputs u and v are zero when indexed outside of their valid ranges.
When both inputs are real, the output is real; when one or both inputs
are complex, the output is complex.
yi, j =
max( Mu , Mv ) 1
k =0
uk v( i k ), j
0 i ( Mu + Mv 2 )
yi =
max( Mu , Mv ) 1
k =0
uk v( i k )
0 i ( Mu + Mv 2 )
1-301
Convolution
You can set the product output, accumulator, and output data types in
the block dialog as discussed in the next section.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Note When one or both of the inputs are signed fixed-point signals, all
internal block data types are signed fixed point. The internal block
data types are unsigned fixed point only when both inputs are unsigned
fixed-point signals.
Dialog
Box
1-302
Convolution
Computation domain
Set the domain in which the block computes convolutions:
Time The block computes in the time domain, which
minimizes memory use.
1-303
Convolution
1-304
Convolution
Note Fixed-point signals are only supported for the time domain. To
use the parameters on this pane, make sure Time is selected for the
Computation domain parameter on the Main pane.
1-305
Convolution
Rounding mode
Select the rounding mode for fixed-point operations.
Note The Rounding mode and Overflow mode settings have
no effect on numerical results when all the following conditions
exist:
Product output data type is Inherit:
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
1-306
Convolution
Same
as accumulator
1-307
Convolution
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Output
1-308
Convolution
See Also
Correlation
Digital Filter
conv
MATLAB
1-309
Correlation
Purpose
Library
Statistics
dspstat3
Description
yuv(i, j) =
max( Mu , Mv ) 1
k =0
*
yuv(i, j) = yvu
( i, j )
uk, j v(*ki), j
0 i < Mv
Mu < i < 0
where * denotes the complex conjugate. Inputs u and v are zero when
indexed outside of their valid ranges. When both inputs are real,
the output is real; when one or both inputs are complex, the output
is complex.
1-310
Correlation
yuv(i, j) =
max( Mu , Mv ) 1
k =0
uk v(*ki), j
0 i < Mv
*
yuv(i, j) = yvu
( i, j )
Mu < i < 0
yuv(i) =
max( Mu , Mv ) 1
k =0
uk v(*ki)
yuv(i) = yv*u(i)
0 i < Mv
Mu < i < 0
1-311
Correlation
You can set the product output, accumulator, and output data types in
the block dialog as discussed in the next section.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Note When one or both of the inputs are signed fixed-point signals, all
internal block data types are signed fixed point. The internal block
data types are unsigned fixed point only when both inputs are unsigned
fixed-point signals.
Dialog
Box
1-312
Correlation
Computation domain
Set the domain in which the block computes correlations:
Time The block computes in the time domain, which
minimizes memory use.
1-313
Correlation
1-314
Correlation
Note Fixed-point signals are only supported for the time domain. To
use the parameters on this pane, make sure Time is selected for the
Computation domain parameter on the Main pane.
1-315
Correlation
Rounding mode
Select the rounding mode for fixed-point operations.
Note The Rounding mode and Overflow mode settings have
no effect on numerical results when all the following conditions
exist:
Product output data type is Inherit:
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
1-316
Correlation
Same
as accumulator
1-317
Correlation
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Output
1-318
Correlation
See Also
Autocorrelation
Convolution
xcorr
1-319
Counter
Purpose
Library
Description
1-320
Counter
Rising edge
Rising edge
Rising edge
Rising edge
1-321
Counter
Falling edge
Falling edge
Falling edge
Falling edge
1-322
Counter
When you set the Count direction parameter to Down and the
counter reaches zero, the block restarts the counter at the upper-limit
of the counter range.
You can set the Counter size parameter to one of the following options:
8 bits Specifies a counter with a range of 0 to 255.
16 bits Specifies a counter with a range of 0 to 65535.
32 bits Specifies a counter with a range of 0 to 2321.
User defined Enables the Maximum count parameter, which
allows you to specify the upper-count limit as any arbitrary unsigned
integer that the Count data type can represent. The counter values
range from 0 to the value of the Maximum count parameter.
Specify via input port Enables the Max input port, which
allows you to specify the upper-count limit as any arbitrary unsigned
integer that the Count data type can represent. The counter values
range from 0 to the value you specify as an input to the Max port.
1-323
Counter
Between triggering events, the block holds the output at its most recent
value. The block resets the counter to its initial state when the trigger
event specified by the Count event parameter occurs at the optional
Rst input port. When the Inc/Dec and Rst ports receive trigger events
simultaneously, the block first resets the counter, and then increments
or decrements the counter appropriately. If you do not need to reset the
counter during simulation, you can disable the Rst port by clearing
the Reset input check box.
The Output parameter allows you to specify which values the block
outputs.
Count enables a Cnt output port on the block, which provides the
current value of the counter as a scalar value. The Cnt output port
has the same port sample time as the Inc/Dec input port.
Hit enables a Hit output port on the block. The Hit port produces
zeros while the value of the counter does not equal any of the integers
you specify for the Hit values parameter. You can specify an integer
or a vector of integers for the Hit values parameter. When the
counter value does equal one or more of the values you specify for
the Hit values parameter, the block outputs a value of 1 at the Hit
output port. The Hit output port has the same port sample time as
the Inc/Dec input port.
Count and Hit enables both the Cnt and Hit output ports.
1-324
Counter
When a trigger event splits across two consecutive vectors, that event is
counted in the vector that contains the conclusion of the event. When
the Rst port receives a trigger event at the same time as the Inc/Dec
port, the block first resets the counter. The block then increments or
decrements the counter by the number of trigger events contained in
the Inc/Dec input vector.
When the input to the Inc/Dec port is a length N vector, the port sample
time of the Inc/Dec input port is equal to the frame period of the input,
or N times the sample time of the input signal. The port sample time of
the Cnt and Hit output ports equals that of the Inc/Dec input port.
Free-Running Operation
The block operates in free-running mode when you select Free running
for the Count event parameter.
The Inc/Dec input port is disabled in this mode, and the block simply
increments or decrements the counter at the constant interval, Ts,
which you specify using the Sample time parameter.
In this mode, the Rst port always behaves as if the Count event
parameter were set to Non-zero sample. Thus, the block triggers a
reset event at each sample time that the Rst input is not zero.
In this mode, the Cnt output is an M-by-1 vector containing the count
value at each of M consecutive sample times, where M is the value you
specify for the Samples per output frame parameter. The Hit output
is an M-by-1 vector containing the hit status (0 or 1) at each of those M
consecutive sample times. Both the Cnt and Hit output ports have a
port sample time of M*Ts.
Examples
1-325
Counter
1-326
Counter
You can see that the seventh input sample to both the Dec and Rst ports
of the Counter block represent trigger events (rising edges). When this
occurs, the block first resets the counter to its initial value of 5, and then
immediately decrements the counter to 4. When the counter reaches
its minimum value of 0, the block restarts the counter at its maximum
value of 20 the next time a trigger event occurs at the Dec port.
1-327
Counter
Dialog
Box
1-328
Count direction
Specify whether to count Up or Down. The port label on the block
icon changes to Inc (increment) or Dec (decrement) based on the
value of this parameter.
When you set the Count direction parameter to Up and the
counter reaches the upper-limit of the counter range, the block
Counter
restarts the counter at zero the next time a trigger event occurs
at the Inc port.
When you set the Count direction parameter to Down and
the counter reaches zero, the block restarts the counter at the
upper-limit of the counter range the next time a trigger event
occurs at the Dec port.
This parameter is tunable in Simulink Normal mode.
Count event
Specify the type of event that triggers the block to increment,
decrement, or reset the counter when received at the Inc/Dec or
Rst ports. When you set this parameter to Free running, the
block disables the Inc/Dec port and counts at the constant interval
specified by the Sample time parameter. For more information
on all the possible settings of this parameter, see Setting the
Count Event Parameter on page 1-321.
Counter size
Specify the range of integer values the block counts through.
For more information about the valid values of this parameter,
see Setting the Counter Size and Initial Count Parameters on
page 1-322.
Maximum count
Specify the maximum value of the counter as any unsigned integer
representable by the data type you specify for the Counter data
type parameter. This parameter appears only when you set the
Counter size parameter to User defined. Tunable in Simulink
Normal mode.
Initial count
Specify the initial value of the counter. The block uses the initial
value of the counter at the start of simulation and resets the
counter back to that initial value each time a trigger event occurs
at the Rst port. Tunable.
1-329
Counter
Output
Select the output ports to enable. You can choose to enable the
Count, Hit, or Count and Hit ports.
Hit values
Specify an integer or vector of integers whose occurrence in the
count should be flagged by a 1 at the (optional) Hit output port.
This parameter appears only when you set the Output parameter
to Hit or Count and Hit. Tunable.
Reset input
Select this check box to enable the Rst input port. When you
enable the Rst port, the block resets the counter to its initial value
each time a trigger event occurs at the Rst port. To specify the
type of event that triggers a reset of the counter, set the Count
event parameter. When you clear the Reset input check box,
you cannot reset the counter during simulation.
Samples per output frame
Specify the number of samples, M, in each output vector.
This parameter appears only when you set the Count event
parameter to Free running.
Sample time
Specify the constant interval, Ts, at which the block increments or
decrements the counter when in free-running mode. For example,
to have the block increment the counter every 5 seconds, set the
Count direction parameter to Up, the Count event parameter
to Free running, and specify a value of 5 for the Sample time
parameter. In free running mode, the sample time of the output
ports is always M*Ts.
This parameter appears only when you set the Count event
parameter to Free running.
Count data type
Specify the data type of the output at the Cnt port. This
parameter appears only when you set the Output parameter to
Count or Count and Hit.
1-330
Counter
Supported
Data
Types
Port
Inc/Dec
Rst
Max
Cnt
Hit
Logical
Boolean The block might output Boolean values from
the Hit output port depending on the setting of the Hit
data type parameter.
1-331
Counter
See Also
1-332
Edge Detector
N-Sample Enable
N-Sample Switch
Covariance AR Estimator
Purpose
Library
Description
H ( z) =
G
G
=
1
A( z) 1 + a(2) z + + a( p + 1) z p
1-333
Covariance AR Estimator
Dialog
Box
References
Estimation order
The order of the AR model, p. To guarantee a nonsingular output,
you must set p to be less than or equal to half the input length.
Otherwise, the output might be singular.
Kay, S. M. Modern Spectral Estimation: Theory and Application.
Englewood Cliffs, NJ: Prentice-Hall, 1988.
Marple, S. L., Jr., Digital Spectral Analysis with Applications.
Englewood Cliffs, NJ: Prentice-Hall, 1987.
Supported
Data
Types
Port
Input
1-334
Covariance AR Estimator
See Also
Burg AR Estimator
Covariance Method
Modified Covariance AR
Estimator
Yule-Walker AR Estimator
arcov
1-335
Covariance Method
Purpose
Library
Description
1-336
Covariance Method
If these conditions do not hold, clear the Inherit sample time from
input check box. You can then specify a sample time using the Sample
time of original time series parameter.
See the Burg Method block reference for a comparison of the Burg
Method, Covariance Method, Modified Covariance Method, and
Yule-Walker Method blocks.
Dialog
Box
Estimation order
The order of the AR model. To guarantee a nonsingular output,
the value of this parameter must be less than or equal to half
the input length.
Inherit FFT length from estimation order
When selected, this option specifies that the FFT length is one
greater than the estimation order.
1-337
Covariance Method
FFT length
Enter the number of data points on which to perform the FFT,
Nfft. When Nfft is larger than the input frame size, the block
zero-pads each frame as needed. When Nfft is smaller than the
input frame size, the block wraps each frame as needed. This
parameter becomes visible only when you clear the Inherit FFT
length from estimation order check box.
Inherit sample time from input
When you select the Inherit sample time from input check box,
the block computes the frequency data from the sample period
of the input signal. For the block to produce valid output, the
following conditions must hold:
The input to the block is the original signal, with no samples
added or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time
from input check box. You can then specify a sample time using
the Sample time of original time series parameter.
Sample time of original time series
Specify the sample time of the original time-domain signal. This
parameter becomes visible only when you clear the Inherit
sample time from input check box.
References
1-338
Covariance Method
Supported
Data
Types
Port
Input
Output
See Also
Burg Method
Covariance AR Estimator
Short-Time FFT
Yule-Walker Method
1-339
Purpose
Library
Description
The Create Diagonal Matrix block populates the diagonal of the M-by-M
matrix output with the elements contained in the length-M vector
input, D. The elements off the diagonal are zero.
A = diag(D)
Dialog
Box
Supported
Data
Types
Port
1-340
Port
See Also
Constant Diagonal
Matrix
Extract Diagonal
diag
MATLAB
1-341
Cumulative Product
Purpose
Library
Description
The optional reset port, Rst, accepts scalar values, which can be any
built-in Simulink data type including boolean. The rate of the input
to the Rst port must be the same or slower than that of the input data
signal. The sample time of the input to the Rst port must be a positive
integer multiple of the input sample time.
Output Characteristics
The output always has the same dimensions, rate, data type, and
complexity as the data signal input.
1-342
Cumulative Product
the block computes a running product for each element of the input
across time. See the following sections for more information:
Computing the Running Product for Each Column of the Input on
page 343
Computing the Running Product for Each Element of the Input on
page 344
Resetting the Running Product on page 345
Computing the Running Product for Each Column of the Input
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each input column as an
y1, j ( t ) = u1, j ( t ) yM , j t Tf
1-343
Cumulative Product
1-344
1i M
1 j N
Cumulative Product
When you are computing the running product, you can configure the
block to reset the running product whenever it detects a reset event at
the optional Rst port. The rate of the input to the Rst port must be the
same or slower than that of the input data signal. The sample time of
the input to the Rst port must be a positive integer multiple of the input
sample time. The input to the Rst port can be of the Boolean data type.
If a reset event occurs while the block is performing sample-based
processing, the block initializes the current output to the values of the
current input. If a reset event occurs while the block is performing
frame-based processing, the block initializes the first row of the current
output to the values in the first row of the current input.
The Reset port parameter specifies the reset event, which can be one
of the following:
None disables the Rst port.
1-345
Cumulative Product
Rising edge Triggers a reset operation when the Rst input does
one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-346
Cumulative Product
Falling edge
Falling edge
Falling edge
Falling edge
The output has the same size, dimension, data type, and complexity
as the input. The mth output row is the element-wise product of the
first m input rows.
1-347
Cumulative Product
yi, j = uk, j
1i M
k=1
The output has the same size, dimension, and data type as the input.
The nth output column is the element-wise product of the first n input
columns.
Given an M-by-N matrix input, u, the output, y, is an M-by-N matrix
whose ith row has elements
1-348
Cumulative Product
yi, j = ui,k
1 j N
k=1
When you multiply along rows, the block treats length-N unoriented
vector inputs as 1-by-N row vectors.
The output of the multiplier is in the product output data type when
at least one of the inputs to the multiplier is real. When both of the
inputs to the multiplier are complex, the result of the multiplication is
1-349
Cumulative Product
Dialog
Box
1-350
Cumulative Product
1-351
Cumulative Product
sample time of the input to the Rst port must be a positive integer
multiple of the input sample time. This parameter appears only
when you set the Multiply input along parameter to Channels
(running product). For more information, see Resetting the
Running Product on page 345.
The Data Types pane of the Cumulative Product block dialog appears
as follows.
1-352
Cumulative Product
Same
as input
Same
as input
1-353
Cumulative Product
Same
as input
Same
as input
1-354
Cumulative Product
Supported
Data
Types
Input and
Output
Ports
Data input
port, In
1-355
Cumulative Product
Input and
Output
Ports
Reset input
port, Rst
Output port
See Also
1-356
Cumulative Sum
Matrix Product
cumprod
MATLAB
Cumulative Sum
Purpose
Library
Description
The Cumulative Sum block computes the cumulative sum along the
specified dimension of the input or across time (running sum).
The inputs can be a vector or a matrix. The output always has the same
dimensions, rate, data type, and complexity as the input.
The optional reset port, Rst, accepts scalar values, which can be any
built-in Simulink data type including boolean. The rate of the input
to the Rst port must be the same or slower than that of the input data
signal. The sample time of the input to the Rst port must be a positive
integer multiple of the input sample time.
Output Characteristics
The output always has the same dimensions, rate, data type, and
complexity as the data signal input.
1-357
Cumulative Sum
a running sum for each element of the input across time. See the
following sections for more information:
Computing the Running Sum for Each Column of the Input on page
358
Computing the Running Sum for Each Element of the Input on page
359
Resetting the Running Sum on page 360
Computing the Running Sum for Each Column of the Input
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each input column as an
1-358
Cumulative Sum
1i M
1 j N
1-359
Cumulative Sum
When you are computing the running sum, you can configure the block
to reset the running sum whenever it detects a reset event at the
optional Rst port. The rate of the input to the Rst port must be the
same or slower than that of the input data signal. The sample time
of the input to the Rst port must be a positive integer multiple of the
input sample time. The reset sample time must be a positive integer
multiple of the input sample time. The input to the Rst port can be
of the boolean data type.
If a reset event occurs while the block is performing sample-based
processing, the block initializes the current output to the values of the
current input. If a reset event occurs while the block is performing
frame-based processing, the block initializes the first row of the current
output to the values in the first row of the current input.
The Reset port parameter specifies the reset event, which can be one
of the following:
None disables the Rst port.
1-360
Cumulative Sum
Rising edge Triggers a reset operation when the Rst input does
one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-361
Cumulative Sum
Falling edge
Falling edge
Falling edge
Falling edge
The output has the same size, dimension, data type, and complexity as
the input. The mth output row is the sum of the first m input rows.
1-362
Cumulative Sum
yi, j =
uk, j
1i M
k=1
The output has the same size, dimension, and data type as the input.
The nth output column is the sum of the first n input columns.
Given an M-by-N input, u, the output, y, is an M-by-N matrix whose
ith row has elements
j
yi, j =
ui,k
1 j N
k=1
1-363
Cumulative Sum
When you sum along rows, the block treats length-N unoriented vector
inputs as 1-by-N row vectors.
You can set the accumulator and output data types in the block dialog
as discussed in Dialog Box on page 1-364.
Dialog
Box
1-364
The Main pane of the Cumulative Sum block dialog appears as follows.
Cumulative Sum
1-365
Cumulative Sum
Input processing
Specify how the block should process the input when computing
the running sum along the channels of the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The option Inherit from input (this choice will be
removed - see release notes) will be removed in a future
release. See Frame-Based Processing in the DSP System
Toolbox Release Notes for more information.
This parameter is available only when you set the Sum input
along parameter to Channels (running sum).
Reset port
Determines the reset event that causes the block to reset the
sum along channels. The rate of the input to the Rst port must
be the same or slower than that of the input data signal. The
sample time of the input to the Rst port must be a positive integer
multiple of the input sample time. This parameter appears only
when you set the Sum input along parameter to Channels
(running sum). For more information, see Resetting the Running
Sum on page 360.
The Data Types pane of the Cumulative Sum block dialog appears
as follows.
1-366
Cumulative Sum
1-367
Cumulative Sum
Same
as input
Same
as accumulator
1-368
Cumulative Sum
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Input and
Output Ports
Data input
port, In
Reset input
port, Rst
1-369
Cumulative Sum
Input and
Output Ports
Output port
See Also
1-370
Cumulative Product
Difference
Matrix Sum
cumsum
MATLAB
Purpose
Library
Description
1-371
dB Conversion
Purpose
Library
Description
Power Inputs
Select Power as the Input signal parameter when the input, u, is a
real, nonnegative, power signal (units of watts). When the Convert to
parameter is set to dB, the block performs the dB conversion
y = 10*log10(u)
When the Convert to parameter is set to dBm, the block performs the
dBm conversion
y = 10*log10(u) + 30
Voltage Inputs
Select Amplitude as the Input signal parameter when the input, u,
is a real voltage signal (units of volts). The block uses the scale factor
specified in ohms by the Load resistance parameter, R, to convert the
voltage input to units of power (watts) before converting to dB or dBm.
1-372
dB Conversion
When the Convert to parameter is set to dB, the block performs the
dB conversion
y = 10*log10(abs(u)^2/R)
When the Convert to parameter is set to dBm, the block performs the
dBm conversion
y = 10*log10(abs(u)^2/R) + 30
1-373
dB Conversion
Dialog
Box
Convert to
The logarithmic scaling to which the input is converted, dB or dBm.
The reference power is 1 W for conversions to dB and 1 mW for
conversions to dBm. Tunable.
Input signal
The type of input signal, Power or Amplitude.
Load resistance
The scale factor used to convert voltage inputs to units of power.
Tunable.
Add eps to input to protect against log(0) = -inf
When selected, adds eps to all input values (power or voltage).
Tunable.
1-374
dB Conversion
Supported
Data
Types
See Also
dB Gain
Math Function
Simulink
log10
MATLAB
1-375
dB Gain
Purpose
Library
Description
The dB Gain block multiplies the input by the decibel values specified
in the Gain parameter. For an M-by-N input matrix u with elements
uij, the Gain parameter can be a real M-by-N matrix with elements gij
to be multiplied element-wise with the input, or a real scalar.
( gij / k)
yij = 10uij
The value of k is 10 for power signals (select Power as the Input signal
parameter) and 20 for voltage signals (select Amplitude as the Input
signal parameter).
The value of the equivalent linear gain
gijlin = 10
( gij / k)
is displayed in the block icon below the dB gain value. The output is
the same size as the input.
The dB Gain block supports real and complex floating-point and
fixed-point data types.
The settings for the fixed-point parameters of the Gain block in the
diagram above are as follows:
1-376
dB Gain
Dialog
Box
Gain
The dB gain to apply to the input, a scalar or a real M-by-N
matrix. Tunable.
Input signal
The type of input signal: Power or Amplitude. Tunable.
Note This block does not support tunability in generated code.
Supported
Data
Types
1-377
dB Gain
See Also
1-378
dB Conversion
Math Function
Simulink
log10
MATLAB
DCT
Purpose
Library
Transforms
dspxfrm3
Description
The DCT block computes the unitary discrete cosine transform (DCT) of
each channel in the M-by-N input matrix, u.
y = dct(u)
When the input is a sample-based row vector, the DCT block computes
the discrete cosine transform across the vector dimension of the input.
For all other N-D input arrays, the block computes the DCT across the
first dimension. The size of the first dimension (frame size), must be a
power of two. To work with other frame sizes, use the Pad block to pad
or truncate the frame size to a power-of-two length.
When the input to the DCT block is an M-by-N matrix, the block treats
each input column as an independent channel containing M consecutive
samples. The block outputs an M-by-N matrix whose lth column
contains the length-M DCT of the corresponding input column.
M
(2m 1)(k 1)
, k = 1,..., M
2M
where
1
M,
w(k) =
2,
M
k=1
2k M
1-379
DCT
Sine and
Cosine
Computation
Parameter
Setting
Table lookup
Trigonometric
fcn
1-380
DCT
The output of the multiplier is in the product output data type when
at least one of the inputs to the multiplier is real. When both of the
1-381
DCT
Dialog
Box
1-382
DCT
1-383
DCT
The Data Types pane of the DCT block dialog appears as follows.
Rounding mode
Select the rounding mode for fixed-point operations. The sine table
values do not obey this parameter; they always round to Nearest.
1-384
DCT
Overflow mode
Select the overflow mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they are always
saturated.
Sine table data type
Choose how you specify the word length of the values of the sine
table. The fraction length of the sine table values always equals
the word length minus one. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Same
The sine table values do not obey the Rounding mode and
Overflow mode parameters; instead, they are always saturated
and rounded to Nearest.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-380 and Multiplication Data Types for
illustrations depicting the use of the product output data type in
this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-385
DCT
1-386
DCT
Supported
Data
Types
Port
Input
Output
See Also
Complex Cepstrum
FFT
1-387
DCT
1-388
IDCT
Real Cepstrum
dct
DC Blocker
Purpose
Block DC component
Library
Signal Operations
dspsigops
Description
Dialog
Box
1-389
DC Blocker
The dialog box for the Subtract mean method is shown below.
1-390
DC Blocker
Examples
1-391
DC Blocker
1-392
DC Blocker
In the model, run the simulation. The spectrum of the input signal
shows tones at 150 Hz and 250 Hz and a significant (0 dBW) DC
component.
1-393
DC Blocker
Using the default IIR setting for the DC Blocker estimation algorithm,
the tones at 150 Hz and 250 Hz are unaffected while the DC component
has been attenuated by 30 dB.
1-394
DC Blocker
1-395
DC Blocker
Try all three estimation methods. Modify the IIR and FIR parameters
to illustrate the performance of the DC Blocker using the various
estimation techniques.
1-396
DC Blocker
Algorithms
Supported
Data
Types
Port
Input
Output
Selected
Bibliography
See Also
Biquad Filter
1-397
Delay
Purpose
Library
Signal Operations
dspsigops
Description
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each column of the M-by-N
input matrix as an independent channel. The block delays each channel
of the input as specified by the Delay parameter.
The Delay parameter can be a scalar integer by which the block equally
delays all channels or a vector whose length is equal to the number
of channels.
There are four different choices for initial conditions. The initial
conditions can be the same or different for each channel. They can also
be constant or varying along each channel. See the Frame-Based
Processing Examples on page 1-401 section for more information.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats each element of the N-D
input array as an independent channel. Thus, the total number of
channels in the input is equal to the product of the input dimensions.
The dimension of the output is the same as that of the input.
The Delay parameter can be a scalar integer by which to equally delay
all channels or an N-D array of the same dimensions as the input array,
1-398
Delay
Rising edge
Rising edge
Rising edge
Rising edge
1-399
Delay
Falling edge triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
Either edge triggers a reset operation when the Rst input is Rising
edge or Falling edge (as described earlier).
Non-zero sample triggers a reset operation at each sample time that
the Rst input is not zero.
Note When running simulations in the Simulink MultiTasking mode,
reset signals have a one-sample latency. Therefore, when the block
detects a reset event, there is a one-sample delay at the reset port rate
before the block applies the reset. For more information on latency and
the Simulink tasking modes, see Excess Algorithmic Delay (Tasking
Latency) and Scheduling in the Simulink Coder Users Guide.
This block supports Simulink virtual buses.
1-400
Delay
Examples
1 1 1 4 4 4 7 7 7
2 2 2 , 5 5 5 , 8 8 8 ,...
3 3 3 6 6 6 9 9 9
You want the initial conditions of your three-channel signal to be
identical and zero for the first frame:
1 Set the Delay (frames) parameter to 1.
2 Clear the Specify different initial conditions for each channel
1-401
Delay
0 0 0 1 1 1 4 4 4 7 7 7
0 0 0 , 2 2 2 , 5 5 5 , 8 8 8 ,...
0 0 0 3 3 3 6 6 6 9 9 9
0, the scalar initial condition value, is used across the channels and
within the channels for the first frame. This frame is the output
at sample time zero.
1 1 1 4 4 4 7 7 7
2 2 2 , 5 5 5 , 8 8 8 ,...
3 3 3 6 6 6 9 9 9
You want the initial conditions of your three-channel signal to be [0
10 20] for the first frame:
1 Set the Delay (frames) parameter to 1.
2 Select the Specify different initial conditions for each channel
check box.
3 Clear the Specify different initial conditions within a channel
check box.
1-402
Delay
0 10 20 1 1 1 4 4 4 7 7 7
0 10 20 , 2 2 2 , 5 5 5 , 8 8 8 ,...
0 10 20 3 3 3 6 6 6 9 9 9
The initial condition vector expands to create the frame that is output
at sample time zero. Different initial conditions are used for each
channel, but the same initial condition value is used with a channel.
1 1 1 4 4 4 7 7 7
2 2 2 , 5 5 5 , 8 8 8 ,...
3 3 3 6 6 6 9 9 9
You want the initial conditions of your three-channel signal to be the
same along each of the channels to be delayed:
1 Set the Delay (frame) parameter to 1.
1-403
Delay
check box.
3 Select the Specify different initial conditions within a channel
check box.
4 Set the Initial conditions parameter to [10 20 30].
10 10 10 1 1 1 4 4 4 7 7 7
20 20 20 , 2 2 2 , 5 5 5 , 8 8 8 ,...
30 30 30 3 3 3 6 6 6 9 9 9
The initial condition vector defines the initial condition values within
each of the three channels. The same initial conditions are used for
each channel, but different initial condition values are used with
a channel.
1 1 1 4 4 4 7 7 7
2 2 2 , 5 5 5 , 8 8 8 ,...
3 3 3 6 6 6 9 9 9
You want the initial conditions of your three-channel signal to be
different for each channel and along each channel.
1 Set the Delay (frames) parameter to 1.
1-404
Delay
10 20 30 1 1 1 4 4 4 7 7 7
40 50 60 , 2 2 2 , 5 5 5 , 8 8 8 ...
70 80 90 3 3 3 6 6 6 9 9 9
The initial condition matrix is the output at sample time zero. The
elements of the initial condition cell array define the initial condition
values within each channel. The first element, a vector, represents
the initial conditions within channel 1. The second element, a
vector, represents the initial conditions within channel 2, and so
on. Different initial conditions are used for each channel and within
the channels.
1-405
Delay
1 1 2 2 3 3
1 1 , 2 2 , 3 3 ,...
0 0 0 0 1 1 2 2 3 3
0 0 , 0 0 , 1 1 , 2 2 , 3 3 ,
0, the scalar initial condition value, is used for each channel and
within the channels. It is the output at sample time zero and sample
time one.
1-406
Delay
1 1 2 2 3 3
1 1 , 2 2 , 3 3 ,...
7 9
11 13
check box.
3 Clear the Specify different initial conditions within a channel
check box.
4 Set the Initial conditions parameter to [7 9; 11 13].
7 9 7 9 1 1 2 2 3 3
11 13 , 11 13 , 1 1 , 2 2 , 3 3 , ...
1-407
Delay
The initial condition matrix is the output at sample time zero and
sample time one. Different initial conditions are used for each
channel; the same initial condition value is used within a channel.
1 1 2 2 3 3
1 1 , 2 2 , 3 3 ,...
You want the initial conditions of your four channel signal to be the
same along each of the channels to be delayed:
1 Set the Delay (samples) parameter to 2.
2 Clear the Specify different initial conditions for each channel
check box.
3 Select the Specify different initial conditions within a channel
check box.
4 Set the Initial conditions parameter to [10 20].
10 10 20 20 1 1 2 2 3 3
10 10 , 20 20 , 1 1 , 2 2 , 3 3 ,...
The first element of the initial conditions vector is the output, for
all channels, at sample time zero. The second element of the initial
1-408
Delay
conditions vector is the output, for all channels, at sample time one.
The same initial conditions are used for each channel, but different
initial condition values are used within a channel.
[1
1] ,
[2
2] ,
[3
3] ,
You want the initial conditions of your two channel signal to be different
for each channel and along each channel:
1 Set the Delay (samples) parameter to 2.
2 Select the Specify different initial conditions for each channel
[10
20] ,
[30
40] ,
[1
1] ,
[2
2]
The first row of the initial conditions vector is the output at sample
time zero. The second row of the initial conditions vector is the
output at sample time one. Different initial conditions are used for
each channel and within the channels.
1-409
Delay
In addition, suppose your input is a matrix and you set the Input
processing parameter to Elements as channels (sample based).
1 1 2 2 3 3
1 1 , 2 2 , 3 3 ,...
[13 17] [14 18]}. The dimensions of the cell array match the
11 12 15 16 1 1 2 2
13 14 , 17 18 , 1 1 , 2 2 ,...
1-410
Delay
Dialog
Box
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-411
Delay
1-412
Delay
Reset port
Determines the reset event that causes the block to reset the
delay. For more information, see Resetting the Delay on page
1-399.
Supported
Data
Types
See Also
Unit Delay
Simulink
Variable Fractional
Delay
Variable Integer
Delay
1-413
Delay Line
Purpose
Library
Description
Note that the first output of the block in the example above is all zeros;
this is because the Initial Conditions parameter is set to zero.
1-414
Delay Line
Initial Conditions
The Delay Line blocks buffer is initialized to the value specified by
the Initial conditions parameter. The block outputs this buffer at
the first simulation step (t=0). When the blocks output is a vector,
the Initial conditions can be a vector of the same size, or a scalar
value to be repeated across all elements of the initial output. When the
blocks output is a matrix, the Initial conditions can be a matrix of
the same size, a vector (of length equal to the number of matrix rows)
to be repeated across all columns of the initial output, or a scalar to be
repeated across all elements of the initial output.
Examples
The first output frame in this example is due to the latency of the Delay
Line block; it is all zeros because the Initial conditions parameter is
set to zero. Because the input frame size of 4 is larger than the output
frame size of 3, only the last three samples in each input frame are
propagated to the corresponding output frame. The frame periods of
the input and output are the same, and the output sample period is
Tsi(Mi/Mo), or 4/3 the input sample period.
1-415
Delay Line
Dialog
Box
1-416
Delay Line
1-417
Delay Line
Supported
Data
Types
Port
Input
Output
1-418
Delay Line
Port
See Also
Buffer
1-419
Detrend
Purpose
Library
Statistics
dspstat3
Description
The Detrend block removes a linear trend from the length-M input
vector, u, by subtracting the straight line that best fits the data in the
least squares sense.
The least squares line, = ax + b, is the line with parameters a and b
that minimizes the quantity
M
(ui ui )2
i=1
Dialog
Box
Supported
Data
Types
1-420
Detrend
See Also
Cumulative Sum
Difference
Least Squares
Polynomial Fit
Unwrap
detrend
MATLAB
1-421
Difference
Purpose
Library
Description
Basic Operation
When you set the Running difference parameter to No, the block
computes the difference between adjacent elements in the specified
dimension of the current input. In this mode, the block can compute the
difference along the columns, rows, or a specified dimension of the input.
Columnwise Differencing
When you set the Difference along parameter to Columns, the block
computes differences between adjacent elements in each column of the
input.
y = diff(u)
When you set the Difference along parameter to Rows, the block
computes differences between adjacent elements in each row of the
input.
y = diff(u,[],2)
1-422
Difference
The output is an M-by-(N-1) matrix whose ith row has the following
elements:
Running Operation
When you set the Running difference parameter to Yes, the block
computes the running difference along the columns of the input.
For an M-by-N input matrix, the output is an M-by-N matrix whose jth
column has the following elements:
2 i ( M 1)
In running mode, the first element of the output for each column is the
first input element minus the last input element of the previous frame.
For the first frame, the block subtracts zero from the first input element.
1-423
Difference
You can set the accumulator and output data types in the block dialog
as discussed in Dialog Box on page 1-425 .
Examples
The following figure shows the output of the block when it is differencing
along rows in nonrunning mode.
1-424
Difference
The following figure shows the second frame of block output when the
block is computing the running difference.
Dialog
Box
1-425
Difference
Running difference
Specify whether or not the block computes a running difference.
When you select No, the block computes the difference between
adjacent elements in the current input. When you select Yes, the
block computes the running difference across consecutive inputs.
In running mode, the block always computes the difference along
the columns of the input. See Running Operation on page 1-423
for more information.
1-426
Difference
1-427
Difference
1-428
Difference
Overflow mode
Select the overflow mode for fixed-point operations.
Accumulator data type
Specify the accumulator data type. See Fixed-Point Data Types
on page 1-424 for illustrations depicting the use of the accumulator
data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
Same
as accumulator
1-429
Difference
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Output
1-430
Difference
See Also
Cumulative Sum
diff
MATLAB
1-431
Differentiator Filter
Purpose
Library
Description
Dialog
Box
1-432
Differentiator Filter
1-433
Differentiator Filter
Filter Specifications
Order mode
Select either Minimum or Specify (the default). Selecting Specify
enables the Order option so you can enter the filter order.
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify. The default order is 31.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
1-434
Differentiator Filter
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve.
Frequency constraints
This option is only available when you specify the order of the
filter design. Supported options are Unconstrained and Passband
edge and stopband edge.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select in Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select in Frequency units.
1-435
Differentiator Filter
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands. These parameters are only available for minimum-order
designs.
Magnitude constraints
This option is only available when you specify the order of
your filter design. The available Magnitude constraints
depend on the value of the Frequency constraints parameter.
When you set the Frequency constraints parameter to
Unconstrained, the Magnitude constraints parameter
must also be Unconstrained. When you set the Frequency
constraints parameter to Passband edge and stopband edge,
the Magnitude constraints parameter can be Unconstrained,
Passband ripple, or Stopband attenuation.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Astop2
Enter the filter attenuation in the second stopband in the units
you choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
1-436
Differentiator Filter
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
20 represents a reasonable trade between the accurate
approximation to the ideal filter and the time to design the
filter.
Wpass
Passband weight. This option is only available for a
specified-order design when Frequency constraints is
equal to Passband edge and stopband edge and the
Design method is Equiripple.
Wstop
Stopband weight. This option is only available for a
specified-order design when Frequency constraints is
1-437
Differentiator Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
1-438
Differentiator Filter
1-439
Differentiator Filter
Supported
Data
Types
Port
Input
Output
1-440
Digital Filter
Purpose
Library
Description
1-441
Digital Filter
Coefficient Source
The Digital Filter block can operate in three different modes. Select the
mode in the Coefficient source group box.
Dialog parameters Enter information about the filter such as
structure and coefficients in the block mask.
Input port(s) Enter the filter structure in the block mask, and the
filter coefficients come in through one or more block ports. This mode
is useful for specifying time-varying filters.
Discrete-time filter object (DFILT) Specify the filter using a
dfilt object.
1-442
Digital Filter
dfilt.df2t
dfilt.df1sos
dfilt.df1tsos
dfilt.df2sos
dfilt.df2tsos
dfilt.dffir
dfilt.dffirt
dfilt.dfsymfir
dfilt.dfasymfir
dfilt.latticear
dfilt.latticemamin
When you select Dialog parameters or Input port(s), the list of
filter structures offered in the Filter structure parameter depends
on whether you set the Transfer function type to IIR (poles &
zeros), IIR (all poles), or FIR (all zeros), as summarized in
the following table.
Note Each structure listed in the table below supports both fixed-point
and floating-point signals.
The table also shows the vector or matrix of filter coefficients you must
provide for each filter structure. For more information on how to specify
filter coefficients for various filter structures, see Specify Static Filters
and Specify Time-Varying Filters.
1-443
Digital Filter
Direct form I
Scale values
IIR (all
poles)
Direct form
Direct form transposed
Lattice AR
1-444
Digital Filter
Direct form
In some cases, the Digital Filter block requires the leading denominator
coefficient (a0) to be 1. This requirement applies under the following
conditions:
The Digital Filter block is operating in a fixed-point mode. The block
operates in a fixed-point mode when at least one of the following
statements is true:
1-445
Digital Filter
Filter structure
Direct form I
Direct form I transposed
Direct form II
Direct form II transposed
Direct form
Direct form transposed
The Digital Filter block produces an error if you use it in one of the these
configurations and your leading denominator coefficient (a0) does not
equal 1. To resolve the error, set your leading denominator coefficient to
1 by scaling all numerator and denominator coefficients by a factor of a0.
1-446
Digital Filter
1-449. The Initial conditions parameter can take one of four forms as
described in the following table.
Valid Initial Conditions
Initial
Condition
Examples
Description
Scalar
Vector or
matrix
(for applying
different
delay
elements to
each channel)
d1
d
2
D1
D2
d1
d2
1-447
Digital Filter
Examples
Description
Elements (Filter States) on page
1-449), and must have one column
for each channel of the input signal.
Empty matrix
1-448
[ ]
Digital Filter
The number of delay elements (filter states) per input channel depends
on the filter structure, as indicated in the following table.
Number of Delay Elements (Filter States)
Number of Delay Elements
per Channel
Filter Structure
Direct
Direct
Direct
Direct
form
form transposed
form symmetric
form antisymmetric
#_of_filter_coeffs-1
Direct form I
Direct form I transposed
#_of_zeros-1
Direct form II
Direct form II transposed
max(#_of_zeros,
#_of_poles)-1
Biquadratic direct
Biquadratic direct
transposed (SOS)
Biquadratic direct
(SOS)
Biquadratic direct
transposed (SOS)
2 * #_of_filter_sections
Lattice AR
Lattice MA
form I (SOS)
form I
#_of_poles-1
form II
form II
#_of_reflection_coeffs
1-449
Digital Filter
State Logging
Simulink enables you to log the states in your model to the MATLAB
workspace. The following table indicates which filter structures of
the Digital Filter block support the Simulink state logging feature.
See States in the Simulink Users Guide documentation for more
information.
Transfer
Function
Type
Filter Structure
State
Logging
Supported
IIR (poles
& zeros)
Direct form I
No
Yes
Direct form II
No
Yes
Yes
Yes
Yes
Yes
Direct form
No
Yes
Lattice AR
Yes
Direct form
No
No
No
Yes
Lattice MA
Yes
IIR (all
poles)
FIR (all
zeros)
1-450
Digital Filter
Dialog
Box
Coefficient Source
The Digital Filter block can operate in three different modes. Select the
mode in the Coefficient source group box.
Dialog parameters Enter information about the filter such as
structure and coefficients in the block mask.
Input port(s) Enter the filter structure in the block mask, and the
filter coefficients come in through one or more block ports. This mode
is useful for specifying time-varying filters.
Discrete-time filter object (DFILT) Specify the filter using a
dfilt object.
Different items appear on the Digital Filter block dialog depending
on whether you select Dialog parameters, Input port(s), or
Discrete-time filter object (DFILT) in the Coefficient source
group box. See the following sections for details:
Specify Filter Characteristics in Dialog and/or Through Input Ports
on page 1-451
Specify Discrete-Time Filter Object on page 1-464
1-451
Digital Filter
1-452
Digital Filter
1-453
Digital Filter
1-454
Digital Filter
1-455
Digital Filter
1-456
Digital Filter
This parameter is enabled only when the filter has both poles and
zeros, and when you select a structure such as direct form I, which
has separate filter states corresponding to the poles (ak) and zeros
(bk). To learn how to specify initial conditions, see Specifying
Initial Conditions on page 1-446.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed - see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
1-457
Digital Filter
1-458
Digital Filter
1-459
Digital Filter
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they always round to
Nearest.
Overflow mode
Select the overflow mode for fixed-point operations. The filter
coefficients do not obey this parameter; they are always saturated.
Section I/O
Choose how you specify the word length and the fraction length
of the fixed-point data type going into and coming out of each
section of a biquadratic filter. See Filter Structure Diagrams on
page 1-469 for illustrations depicting the use of the section I/O
data type in this block.
This parameter is only visible when the selected filter structure
is biquadratic:
When you select Same as input, these characteristics match
those of the input to the block.
When you select Binary point scaling, you can enter the
word and fraction lengths of the section input and output, in
bits.
When you select Slope and bias scaling, you can enter the
word lengths, in bits, and the slopes of the section input and
output. This block requires power-of-two slope and a bias of
zero.
Tap sum
Choose how you specify the word length and the fraction length of
the tap sum data type of a direct form symmetric or direct form
antisymmetric filter. See Filter Structure Diagrams on page
1-469 for illustrations depicting the use of the tap sum data type
in this block.
This parameter is only visible when the selected filter structure is
either Direct form symmetric or Direct form antisymmetric:
1-460
Digital Filter
1-461
Digital Filter
1-462
Digital Filter
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output. This
block requires power-of-two slope and a bias of zero.
Accumulator
Use this parameter to specify how you would like to designate
the accumulator word and fraction lengths. See Filter Structure
Diagrams on page 1-469 and Multiplication Data Types for
illustrations depicting the use of the accumulator data type in
this block:
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as product output, these
characteristics match those of the product output.
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulator. This
block requires power-of-two slope and a bias of zero.
State
Use this parameter to specify how you would like to designate the
state word and fraction lengths. See Filter Structure Diagrams
on page 1-469 for illustrations depicting the use of the state data
type in this block.
This parameter is not visible for direct form and direct form I
filter structures.
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as accumulator, these characteristics
match those of the accumulator.
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulator, in bits.
1-463
Digital Filter
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulator. This
block requires power-of-two slope and a bias of zero.
Output
Choose how you specify the output word length and fraction
length:
When you select Same as input, these characteristics match
those of the input to the block.
When you select Same as accumulator, these characteristics
match those of the accumulator.
When you select Binary point scaling, you can enter the
word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the output. This block
requires power-of-two slope and a bias of zero.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
1-464
Digital Filter
Filter
Specify the discrete-time filter object (dfilt) that you would like
the block to implement. You can do this in one of three ways:
1-465
Digital Filter
You can fully specify the dfilt object in the block mask, as
shown in the default value.
You can enter the variable name of a dfilt object that is
defined in any workspace.
You can enter a variable name for a dfilt object that is not
yet defined.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed - see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
View filter response
This button opens the Filter Visualization Tool (fvtool) from
the Signal Processing Toolbox product and displays the filter
response of the dfilt object specified in the Filter parameter.
For more information on FVTool, see the Signal Processing
Toolbox documentation.
1-466
Digital Filter
1-467
Digital Filter
The fixed-point settings of the filter object specified on the Main pane
are displayed on the Data Types pane. You cannot change these
settings directly on the block mask. To change the fixed-point settings
you must edit the filter object directly.
1-468
Digital Filter
Filter
Structure
Diagrams
1-469
Digital Filter
1-470
Digital Filter
1-471
Digital Filter
1-472
Digital Filter
States are complex when either the input or the coefficients are
complex.
Numerator and denominator coefficients must have the same word
length. They can have different fraction lengths.
1-473
Digital Filter
1-474
Digital Filter
1-475
Digital Filter
States are complex when either the inputs or the coefficients are
complex.
Numerator and denominator coefficients must have the same word
length. They can have different fraction lengths.
1-476
Digital Filter
1-477
Digital Filter
States are complex when either the inputs or the coefficients are
complex.
Numerator and denominator coefficients must have the same word
length. They can have different fraction lengths.
1-478
Digital Filter
1-479
Digital Filter
1-480
Digital Filter
1-481
Digital Filter
The following diagram shows the data types between filter sections.
1-482
Digital Filter
1-483
Digital Filter
1-484
Digital Filter
The following diagram shows the data types for one section of the filter.
1-485
Digital Filter
The following diagram shows the data types between filter sections.
1-486
Digital Filter
The following diagram shows the data types between filter sections.
1-487
Digital Filter
1-488
Digital Filter
1-489
Digital Filter
The following diagram shows the data types between filter sections.
1-490
Digital Filter
1-491
Digital Filter
1-492
Digital Filter
1-493
Digital Filter
1-494
Digital Filter
1-495
Digital Filter
1-496
Digital Filter
1-497
Digital Filter
1-498
Digital Filter
1-499
Digital Filter
1-500
Digital Filter
1-501
Digital Filter
1-502
Digital Filter
1-503
Digital Filter
1-504
Digital Filter
Supported
Data
Types
See Also
Allpole Filter
Discrete Filter
Simulink
Simulink
Filter Realization
Wizard
dfilt
fdatool
1-505
Digital Filter
1-506
fvtool
sptool
Purpose
Library
Description
The Digital Filter Design block implements a digital FIR or IIR filter
that you design using the Filter Design and Analysis Tool (fdatool)
GUI. This block provides the same filter implementation as the Digital
Filter block.
You must specify whether the block performs frame-based or
sample-based processing on the input by setting the Input processing
parameter. The block applies the specified filter to each channel of
a discrete-time input signal, and outputs the result. The outputs of
the block numerically match the outputs of the Digital Filter block,
the MATLAB filter function, and the DSP System Toolbox filter
function.
The sampling frequency, Fs, that you specify in the FDATool GUI
should be identical to the sampling frequency of the input to the Digital
Filter Design block. When the sampling frequencies do not match, the
1-507
Digital Filter Design block returns a warning message and inherits the
sampling frequency of the input block.
Examples
1-508
See the Digital Filter Design Block section in the DSP System Toolbox
documentation.
Dialog
Box
1-509
Supported
Data
Types
See Also
Window Function
fdatool
filter
fvtool
sptool
To learn how to use this block and FDATool, see the following:
Filter Design
Filter Analysis
Digital Filter Design Block
1-510
Purpose
Library
dspobslib
Description
Note The Digital FIR Filter Design block is still supported but is likely
to be obsoleted in a future release. We strongly recommend replacing
this block with the Digital Filter block.
The Digital FIR Filter Design block designs a discrete-time (digital) FIR
filter in one of several different band configurations using a window
method. Most of these filters are designed using the Signal Processing
Toolbox fir1 function, and are real with linear phase response. The
block applies the filter to a discrete-time input using the Direct-Form II
Transpose Filter (Obsolete) block.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
For complete details on the classical FIR filter design algorithm, see the
description of the fir1 and fir2 functions in the Signal Processing
Toolbox documentation.
Band Configurations
The band configuration for the filter is set from the Filter type pop-up
menu. The band configuration parameters below this pop-up menu
adapt appropriately to match the Filter type selection.
Lowpass and Highpass
In lowpass and highpass configurations, the Filter order and
Cutoff frequency parameters specify the filter design. Frequencies
are normalized to half the sample frequency. The figure below shows
the frequency response of the default order-22 filter with cutoff at 0.4.
1-511
1-512
Multiband
In the multiband configuration, the Filter order, Cutoff frequency
vector, and Gain in the first band parameters specify the filter
design. The Cutoff frequency vector contains frequency points in
the range 0 to 1, where 1 corresponds to half the sample frequency.
Frequency points must appear in ascending order. The Gain in
the first band parameter specifies the gain in the first band: 0
indicates a stopband, and 1 indicates a passband. Additional bands
alternate between passband and stopband. The figure below shows
the frequency response of the default order-22 filter with five bands,
the first a passband.
Arbitrary shape
In the arbitrary shape configuration, the Filter order, Frequency
vector, and Gains at these frequencies parameters specify the
filter design. The Frequency vector, fn, contains frequency points
in the range 0 to 1 (inclusive) in ascending order, where 1 corresponds
to half the sample frequency. The Gains at these frequencies
parameter, mn, is a vector containing the desired magnitude response
at the corresponding points in the Frequency vector. (Note that
the specifications for the Arbitrary shape configuration are similar
to those for the Yule-Walker IIR Filter Design block. Arbitrary-shape
1-513
1-514
Dialog
Box
1-515
Cutoff frequency
The normalized cutoff frequency for the Highpass and Lowpass
filter configurations. A value of 1 specifies half the sample
frequency. Tunable.
Lower cutoff frequency
The lower passband or stopband frequency for the Bandpass
and Bandstop filter configurations. A value of 1 specifies half
the sample frequency. Tunable.
Upper cutoff frequency
The upper passband or stopband frequency for the Bandpass
and Bandstop filter configurations. A value of 1 specifies half
the sample frequency. Tunable.
Cutoff frequency vector
A vector of ascending frequency points defining the cutoff edges
for the Multiband filter. A value of 1 specifies half the sample
frequency. Tunable.
Gain in the first band
The gain in the first band of the Multiband filter: 0 specifies
a stopband, 1 specifies a passband. Additional bands alternate
between passband and stopband. Tunable.
Frequency vector
A vector of ascending frequency points defining the frequency
bands of the Arbitrary shape filter. The frequency range is 0 to
1 including the endpoints, where 1 corresponds to half the sample
frequency. Tunable.
Gains at these frequencies
A vector containing the desired magnitude response for the
Arbitrary shape filter at the corresponding points in the
Frequency vector. Tunable.
Window type
The type of window to apply. See the Window Function block
reference. Tunable.
1-516
Stopband ripple
The level (dB) of stopband ripple, Rs, for the Chebyshev window.
Tunable.
Beta
The Kaiser window parameter. Increasing Beta widens the
mainlobe and decreases the amplitude of the window sidelobes in
the windows frequency magnitude response. Tunable.
References
1-517
Purpose
Library
dspobslib
Description
Note The Digital FIR Raised Cosine Filter Design block is still
supported but is likely to be obsoleted in a future release. We strongly
recommend replacing this block with the Digital Filter block.
The Digital FIR Raised Cosine Filter Design block uses the Signal
Processing Toolbox firrcos function to design a lowpass, linear-phase,
digital FIR filter with a raised cosine transition band. The block applies
the filter to a discrete-time input using the Direct-Form II Transpose
Filter (Obsolete) block.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
The frequency response of the raised cosine filter is
2 fn0
1 + cos
f (1 R) fn0
2 Rfn0
H ( f ) =
4 fn0
1-518
0 f (1 R) fn0
(1 R) fn0 f (1 + R) fn0
(1 + R) fn0 f 1
0 < fn0
<1
2
The Upper cutoff frequency and Transition bandwidth parameter
values are normalized to half the sample frequency.
The Window type parameter allows you to apply a variety of different
windows to the raised cosine filter. See the Window Function block
reference for a complete description of the available options.
Algorithm
h(kTs ) =
1-519
h(0) =
1
Fs
and
1
R
h
=
sin
2R
4 Rfn0 2 Fs
The impulse response for the square-root raised cosine filter is
Fs
1
((8 RkTs fn0 )2 1)
2 fn0
< k<
h(0) = (4 R + R)
2 fn0
Fs
and
8 Rf
n0
2 fn0
= 2 F
s
(1 + R )
( R 1)
4 R sin
(1 + R) sin
4R
4R
( R 1)
+ ( R 1) cos
4 R
1-520
Dialog
Box
Filter order
The order of the filter. The filter length is one more than this
value.
Upper cutoff frequency
The normalized cutoff frequency, fn0. A value of 1 specifies half
the sample frequency. Tunable.
1-521
H ( f ) . Tunable.
Design method
The method used to design the transition region of the filter,
Rolloff factor or Transition bandwidth. Tunable.
Rolloff factor
The rolloff factor, R, enabled when Rolloff factor is selected in
the Design method parameter. Tunable.
Transition bandwidth
The transition bandwidth, f, enabled when Transition
bandwidth is selected in the Design method parameter.
Tunable.
Window type
The type of window to apply. See the Window Function block
reference. Tunable.
Stopband attenuation in dB
The level (dB) of stopband attenuation, Rs, for the Chebyshev
window. Tunable.
Beta
The Kaiser window parameter. Increasing widens the
mainlobe and decreases the amplitude of the window sidelobes in
the windows frequency magnitude response. Tunable.
Initial conditions
The filters initial conditions, a scalar, vector, or matrix. See the
Direct-Form II Transpose Filter (Obsolete) block reference for
complete syntax information.
References
1-522
Purpose
Library
dspobslib
Description
Note The Digital IIR Filter Design block is still supported but is likely
to be obsoleted in a future release. We strongly recommend replacing
this block with the Digital Filter block.
The Digital IIR Filter Design block designs a discrete-time (digital)
IIR filter in a lowpass, highpass, bandpass, or bandstop configuration,
and applies it to the input using the Direct-Form II Transpose Filter
(Obsolete) block.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
The Design method parameter allows you to specify Butterworth,
Chebyshev type I, Chebyshev type II, and elliptic filter designs. Note
that for the bandpass and bandstop configurations, the actual filter
length is twice the Filter order parameter value.
Filter Design
Description
Butterworth
Chebyshev
type I
1-523
Filter Design
Description
Chebyshev
type II
Elliptic
The design and band configuration of the filter are selected from the
Design method and Filter type pop-up menus in the dialog box.
For each combination of design method and band configuration, an
appropriate set of secondary parameters is displayed.
The table below lists the available parameters for each design/band
combination. For lowpass and highpass band configurations, these
parameters include the passband edge frequency fnp, the stopband edge
frequency fns, the passband ripple Rp, and the stopband attenuation Rs.
For bandpass and bandstop configurations, the parameters include the
lower and upper passband edge frequencies, fnp1 and fnp2, the lower and
upper stopband edge frequencies, fns1 and fns2, the passband ripple Rp,
and the stopband attenuation Rs. Frequency values are normalized to
half the sample frequency, and ripple and attenuation values are in dB.
Lowpass
Highpass
Bandpass
Bandstop
Butterworth
Order, fnp
Order, fnp
Chebyshev
Type I
Order, fnp, Rp
Order, fnp, Rp
Chebyshev
Type II
Order, fns, Rs
Order, fns, Rs
Elliptic
1-524
Dialog
Box
1-525
References
1-526
Purpose
Library
dspobslib
Description
1-527
Discrete Impulse
Purpose
Library
Sources
dspsrcs4
Description
Examples
1-528
Discrete Impulse
Run the model and look at the output, dsp_examples_yout. The first
few samples of each channel are shown below.
dsp_examples_yout(1:10,:)
ans =
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1-529
Discrete Impulse
Dialog
Box
The Main pane of the Discrete Impulse block dialog appears as follows.
Delay
The number of zero-valued output samples, D, preceding the
impulse. A length-N vector specifies an N-channel output.
Sample time
The sample period, Ts, of the output signal. The output frame
period is M*Ts.
Samples per frame
The number of samples, M, in each output frame. When the value
of this parameter is 1, the block outputs a sample-based signal.
The Data Types pane of the Discrete Impulse block dialog appears
as follows.
1-530
Discrete Impulse
1-531
Discrete Impulse
Supported
Data
Types
See Also
1-532
Simulink
Constant
Simulink
Multiphase Clock
N-Sample Enable
impz
Purpose
Library
Description
1-533
Dialog
Box
Parameters
Values
8 (default)
Auto (default)
1-534
Parameters
Values
block sets the FFT length to
the input frame size.
Property
When the source of the FFT
length is set to Property, you
specify the FFT length in the
FFT length parameter.
FFT length
128 (default)
Window function
Hann (default)
Rectangular
Chebyshev
Flat Top
Hamming
Kaiser
1-535
Parameters
Values
Sidelobe attenuation of
window
60 dB (default)
Frequency range
Specify the frequency range of the
transfer function estimate.
twosided (default)
When you set the frequency
range to twosided, the
Transfer Function Estimator
block computes the two-sided
transfer function of the real or
complex input signals, x and y.
onesided
When you set the frequency
range to onesided, the
Transfer Function Estimator
block computes the one-sided
transfer function of real input
signals, x and y.
centered
When you set the frequency
range to centered, the
Transfer Function Estimator
block computes the centered
two-sided transfer function
of the real or complex input
signals, x and y.
1-536
Supported
Data
Types
Output, H
Examples
1-537
1-538
See Also
1-539
Display
Purpose
Library
Sinks
dspsnks4
Description
1-540
Downsample
Purpose
Library
Signal Operations
dspsigops
Description
Input Sequence
Sample
Offset, D
1,2,3,...
1,5,9,13,17,21,25,29,...
1,2,3,...
0,2,6,10,14,18,22,26,...
1,2,3,...
0,3,7,11,15,19,23,27,...
1,2,3,...
0,4,8,12,16,20,24,28,...
The initial zero in each of the latter three output sequences in the table
is a result of the default zero Initial conditions parameter setting for
this example. See Latency on page 1-544 for more information on
the Initial conditions parameter.
1-541
Downsample
This block supports triggered subsystems when you set the Rate
options parameter to Enforce single-rate processing.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the input can be an N-D array. The
Downsample block treats each element of the input as a separate
channel, and resamples each channel of the input over time. The block
downsamples the input array by discarding K1 samples following each
sample that it passes through to the output. The input and output sizes
of the Downsample block are identical.
The Rate options parameter specifies how the block adjusts the rate
at the output to accommodate the reduced number of samples. There
are two available options:
Allow multirate processing
When you select Allow multirate processing, the sample period of
the output is K times longer than the input sample period (Tso = KTsi).
Enforce single-rate processing
When you select Enforce single-rate processing, the block
forces the output sample rate to match the input sample rate (Tso =
Tsi) by repeating every Kth input sample K times at the output. In
this mode, the behavior of the block is similar to the operation of a
Sample and Hold block with a repeating trigger event of period KTsi.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each of the N input columns
as an individual channel containing Mi sequential time samples. The
block downsamples each channel independently by discarding K1
rows of the input matrix following each row that it passes through to
the output.
1-542
Downsample
The Rate options parameter specifies how the block adjusts the rate
at the output to accommodate the reduced number of samples. There
are two available options:
Allow multirate processing
The block generates the output at the slower (downsampled) rate by
using a proportionally longer frame period at the output port than at
the input port. For downsampling by a factor of K, the output frame
period is K times longer than the input frame period (Tfo = KTfi), but
the input and output frame sizes are equal.
The ex_downsample_ref1 model shows a single-channel input with
a frame period of 1 second being downsampled by a factor of 4 to
a frame period of 4 seconds. The input and output frame sizes are
identical.
1-543
Downsample
Latency
The Downsample block has zero-tasking latency in the following cases:
The Downsample factor parameter, K, is 1.
The Input processing parameter is set to Columns as channels
(frame based) and the Rate options parameter is set to Enforce
single-rate processing.
The Input processing parameter is set to Columns as channels
(frame based) and the input frame size is equal to one.
The Input processing parameter is set to Elements as channels
(sample based), and Sample offset parameter, D, is 0.
Zero-tasking latency means that the block propagates input sample D+1
(received at t=0) as the first output sample, followed by input sample
D+1+K, input sample D+1+2K, and so on. When there is zero-tasking
latency, the block ignores the value of the Initial conditions
parameter.
In all other cases, the latency is nonzero:
When the Input processing parameter is set to Elements as
channels (sample based), the latency is one sample.
When the Input processing parameter is set to Columns as
channels (frame based) and the input frame size is greater than
one, the latency is one frame.
1-544
Downsample
In all cases of one-sample latency, the initial condition for each channel
appears as the first output sample. Input sample D+1 appears as
the second output sample for each channel, followed by input sample
D+1+K, input sample D+1+2K, and so on. The Initial conditions
parameter can be an array of the same size as the input, or a scalar to
be applied to all signal channels.
In all cases of one-frame latency, the Mi rows of the initial condition
matrix appear in sequence as the first Mi output rows. Input sample
D+1 (i.e, row D+1 of the input matrix) appears in the output as sample
Mi+1, followed by input sample D+1+K, input sample D+1+2K, and so
on. The Initial conditions value can be an Mi-by-N matrix containing
one value for each channel, or a scalar to be repeated across all elements
of the Mi-by-N matrix. See the following example for an illustration
of this case.
Note For more information on latency and the Simulink tasking modes,
see Excess Algorithmic Delay (Tasking Latency) and Scheduling in
the Simulink Coder Users Guide.
Examples
Run the model and look at the output, yout. The first few samples of
each channel are as follows:
yout =
1-545
Downsample
11
12
13
14
2
4
6
8
10
12
14
-11
-12
-13
-14
-2
-4
-6
-8
-10
-12
-14
You can see from the two Probe blocks that there are at least two
distinct frame rates in this model. Because you ran this model in
multirate, multitasking mode, the first row of the initial condition
matrix appears as the first output sample, followed by the other three
initial condition rows. The second row of the first input matrix (row
D+1, where D is the Sample offset) appears in the output as sample 5
(sample Mi+1, where Mi is the input frame size).
1-546
Downsample
Dialog
Box
Downsample factor
The integer factor, K, by which to decrease the input sample rate.
Sample offset
The sample offset, D, which must be an integer in the range [0,
K1].
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select this
option, the block treats each column of the input as a separate
channel. See Frame-Based Processing on page 1-542 for more
information
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
1-547
Downsample
Supported
Data
Types
Port
Input
1-548
Downsample
Port
Output
See Also
FIR Decimation
Repeat
Upsample
1-549
Purpose
Library
Sources
dspobslib
Description
1-550
Dialog
Box
The Main pane of the DSP Constant block dialog box appears as follows.
Constant value
Specify the constant to generate. This parameter is Tunable;
values entered here can be tuned, but their dimensions must
remain fixed.
When you specify any data type information in this field, it is
overridden by the value of the Output data type parameter
in the Data Types pane, unless you select Inherit from
'Constant value'.
Sample mode
Specify the sample mode of the output, Discrete for a
discrete-time signal or Continuous for a continuous-time signal.
Output
Specify whether the output is Sample-based (interpret
vectors as 1-D), Sample-based, or Frame-based. When you
select Sample-based and the output is a vector, its dimension
1-551
1-552
1-553
Supported
Data
Types
See Also
1-554
Constant
Simulink
DWT
Purpose
Library
Transforms
dspxfrm3
Description
The DWT block is the same as the Dyadic Analysis Filter Bank block in
the Multirate Filters library, but with different default settings. See the
Dyadic Analysis Filter Bank block reference page for more information.
1-555
Purpose
Library
Description
1-556
function match the DWT output of this block, complete the following
steps:
1 Set the boundary condition of the dwt function to zero-padding. To do
add zeros to the input of the dwt function. The number of zeros you
add must be equal to the half-length of the filter.
Input Requirements
Input must be a vector or matrix.
The input frame size must be a multiple of 2n, where n is the number
of filter bank levels. For example, a frame size of 16 would be
appropriate for a three-level tree (16 is a multiple of 23).
The block always treats input signals as frames and operates along
the columns.
For an illustration of why the above input requirements exist, see the
figure Outputs of a 3-Level Asymmetric Dyadic Analysis Filter Bank
on page 1-558.
Output Characteristics
The output characteristics vary depending on the blocks parameter
settings, as summarized in the following list and figure:
Number of levels parameter set to n
Tree structure parameter setting:
1-557
1-558
Output
Description
Output Frame
Rate
Not applicable
Output
Dimensions
(Frame Size)
1-559
Mi / 2k
Mo,k =
n
Mi / 2
Output
Sample Rate
(1 k n)
(k = n + 1)
Fsi 2k
Fso,k =
n
Fsi 2
(1 k n )
( k = n + 1)
1-560
Filter
User-defined
Corresponding Wavelet
Function Syntax
None
Haar
None
wfilters('haar')
Daubechies
Wavelet order = 4
wfilters('db4')
Symlets
Wavelet order = 3
wfilters('sym3')
Coiflets
Wavelet order = 1
wfilters('coif1')
Biorthogonal
wfilters('bior3.1')
Reverse Biorthogonal
wfilters('rbio3.1')
Discrete Meyer
None
wfilters('dmey')
1-561
Examples
Wavelets
The primary application for dyadic analysis filter banks and dyadic
synthesis filter banks is coding for data compression using wavelets.
At the transmitting end, the output of the dyadic analysis filter bank is
fed to a lossy compression scheme, which typically assigns the number
of bits for each filter bank output in proportion to the relative energy
in that frequency band. This represents the more powerful signal
components by a greater number of bits than the less powerful signal
components.
Examples
See the floating-point frame-based version of the DSP System Toolbox
Wavelet Reconstruction and Noise Reduction example, which uses the
Dyadic Analysis Filter Bank and Dyadic Synthesis Filter Bank blocks.
Dialog
Box
1-562
1-563
Filter
The type of filter used to determine the high- and low-pass FIR
filters in the filter bank:
Select User defined to explicitly specify the filter coefficients in
the Lowpass FIR filter coefficients and Highpass FIR filter
coefficients parameters.
Select a wavelet such as Biorthogonal or Daubechies to specify
a wavelet-based filter. The block uses the Wavelet Toolbox
wfilters function to construct the filters. Extra parameters
such as Wavelet order or Filter order [synthesis / analysis]
might become enabled. For a list of the supported wavelets,
see Specifying Filters with the Filter Parameter and Related
Parameters on page 1-561.
Lowpass FIR filter coefficients
A vector of filter coefficients (descending powers of z) that specifies
coefficients used by all the lowpass filters in the filter bank. This
parameter is enabled when you set Filter to User defined.
The lowpass filter should be a half-band filter that passes the
frequency band stopped by the filter specified in the Highpass
FIR filter coefficients parameter. The default values of this
parameter specify a filter based on a Daubechies wavelet with
wavelet order 3.
Highpass FIR filter coefficients
A vector of filter coefficients (descending powers of z) that specifies
coefficients used by all the highpass filters in the filter bank.
This parameter is enabled when you set Filter to User defined.
The highpass filter should be a half-band filter that passes the
frequency band stopped by the filter specified in the Lowpass
FIR filter coefficients parameter. The default values of this
parameter specify a filter based on a Daubechies wavelet with
wavelet order 3.
1-564
Wavelet order
The order of the wavelet selected in the Filter parameter. This
parameter is enabled only when you set Filter to certain types
of wavelets, as shown in the Specifying Filters with the Filter
Parameter and Related Parameters on page 1-561 table.
Filter order [synthesis / analysis]
The order of the wavelet for the synthesis and analysis filter
stages. For example, when you set the Filter parameter to
Biorthogonal and set the Filter order [synthesis / analysis]
parameter to [2 / 6], the block calls the wfilters function with
input argument 'bior2.6'. This parameter is enabled only when
you set Filter to certain types of wavelets, as shown in Specifying
Filters with the Filter Parameter and Related Parameters on
page 1-561.
Number of levels
The number of filter bank levels. An n-level asymmetric structure
has n+1 outputs, and an n-level symmetric structure has 2n
outputs, as shown in Wavelet Filter Banks on page 1-560. The
blocks icon changes depending on the value of this parameter.
The default setting of this parameter is 2.
Tree structure
The structure of the filter bank: Asymmetric, or Symmetric. See
Wavelet Filter Banks on page 1-560.
The default setting of this parameter is Asymmetric for the Dyadic
Analysis Filter Bank block, and Symmetric for the DWT block.
Output
Set to Multiple ports to output each output subband on a
separate port (the topmost port outputs the subband with the
highest frequency band). Set to Single port to concatenate the
subbands into one vector or matrix and output the concatenated
subbands on a single port. For more information, see Output
Characteristics on page 1-557.
1-565
References
Supported
Data
Types
Port
Input
Output
See Also
1-566
DWT
Purpose
Library
Description
Note This block always does frame-based processing, and its inputs
must be of certain sizes. To use input subbands that do not fit the
criteria of this block, use the Two-Channel Synthesis Subband Filter
block. (You can connect multiple copies of the Two-Channel Synthesis
Subband Filter block to create a multilevel dyadic synthesis filter bank.)
You can configure this block to compute the inverse discrete wavelet
transform (IDWT) or reconstruct a signal from subbands with smaller
bandwidths and slower sample rates. When the block computes the
inverse discrete wavelet transform (IDWT) of the input, the output has
the same dimensions as the input. Each column of the output is the
IDWT of the corresponding input column. When reconstructing a signal,
the block uses a series of highpass and lowpass FIR filters to reconstruct
the signal from the input subbands, as illustrated in Wavelet Filter
Banks on page 1-572 (the Asymmetric one). The reconstructed signal
has a wider bandwidth and faster sample rate than the input subbands.
You can specify the filter banks highpass and lowpass filters by
providing vectors of filter coefficients. You can do so directly on the
block mask, or, if you have a Wavelet Toolbox license, you can specify
wavelet-based filters by selecting a wavelet from the Filter parameter.
You must set the filter bank structure to asymmetric or symmetric, and
specify the number of levels in the filter bank.
When you set the Input parameter to Multiple ports, you must
provide each subband to the block through a different input port as a
vector or matrix. You should input the highest frequency band through
the topmost port. When you set the Input parameter to Single port,
the block input must be a vector or matrix of concatenated subbands.
1-567
Input Requirements
The inputs to this block are usually the outputs of a Dyadic Analysis
Filter Bank block. Since the Dyadic Analysis Filter Bank block can
output from either a single port or multiple ports, the Dyadic Synthesis
Filter Bank block accepts inputs to either a single port or multiple ports.
The Input parameter sets whether the block accepts inputs from
a single port or multiple ports, and thus determines the input
requirements, as summarized in the following lists and figure.
Note Any output of a Dyadic Analysis Filter Bank block whose
parameter settings match the corresponding settings of this block is
a valid input to this block. For example, the setting of the Dyadic
Analysis Filter Bank block parameter, Output, must be the same as
this blocks Input parameter (Single port or Multiple ports).
1-568
1-569
1-570
For general information about the filter banks, see Dyadic Synthesis
Filter Banks.
Output Characteristics
The following table summarizes the output characteristics for both
types of inputs. For an illustration of why the output characteristics
exist, see the figure Valid Inputs to a 3-Level Asymmetric Dyadic
Synthesis Filter Bank on page 1-570.
Output Frame
Rate
Output Frame
Dimensions
For general information about the filter banks, see Dyadic Synthesis
Filter Banks.
1-571
1-572
Filter
User-defined
Corresponding Wavelet
Function Syntax
None
Haar
None
wfilters('haar')
Daubechies
Wavelet order = 4
wfilters('db4')
Symlets
Wavelet order = 3
wfilters('sym3')
Coiflets
Wavelet order = 1
wfilters('coif1')
Biorthogonal
wfilters('bior3.1')
Reverse
Biorthogonal
wfilters('rbio3.1')
Discrete Meyer
None
wfilters('dmey')
Examples
See Examples on page 1-562 on the Dyadic Analysis Filter Bank block
reference page.
Dialog
Box
1-573
1-574
1-575
1-576
Tree structure
The structure of the filter bank: Asymmetric, or Symmetric. See
Wavelet Filter Banks on page 1-572.
The default setting of this parameter is Asymmetric for the Dyadic
Synthesis Filter Bank block, and Symmetric for the IDWT block.
Input
Set to Multiple ports to accept each input subband at a separate
port (the topmost port accepts the subband with the highest
frequency band). Set to Single port to accept one vector or
matrix of concatenated subbands at a single port. For more
information, see Input Requirements on page 1-568.
The default setting of this parameter is Multiple ports for the
Dyadic Synthesis Filter Bank block, and Single port for the
IDWT block.
References
Supported
Data
Types
Port
Input
Output
1-577
See Also
Dyadic Analysis
Filter Bank
IDWT
Two-Channel
Synthesis Subband
Filter
1-578
Edge Detector
Purpose
Library
Description
Examples
1-579
Edge Detector
1-580
Edge Detector
Dialog
Box
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed - see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
Supported
Data
Types
1-581
Edge Detector
See Also
1-582
Counter
Event-Count Comparator
Event-Count Comparator
Purpose
Library
Description
Examples
1-583
Event-Count Comparator
All inputs and outputs are multiplexed into the workspace variable
yout, whose contents are shown in the figure below. The two left
columns in the illustration show the inputs to the Data and Int ports,
the center column shows the state of the blocks internal counter, and
the right column shows the blocks output.
1-584
Event-Count Comparator
Dialog
Box
Supported
Data
Types
Event threshold
Specify the value against which to compare the number of nonzero
inputs. Tunable.
Double-precision floating point
Single-precision floating point
Fixed point (signed and unsigned)
Boolean
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
Enumerated
1-585
Event-Count Comparator
See Also
1-586
Counter
Edge Detector
Extract Diagonal
Purpose
Library
Description
The Extract Diagonal block populates the unoriented output vector with
the elements on the main diagonal of the M-by-N input matrix A.
D = diag(A)
Dialog
Box
Supported
Data
Types
See Also
1-587
Extract Diagonal
1-588
diag
MATLAB
Purpose
Library
Description
Examples
1-589
Dialog
Box
1-590
Extract
The component of the matrix to copy to the output: upper triangle
or lower triangle.
Supported
Data
Types
Port
See Also
Autocorrelation LPC
Cholesky Factorization
Extract Diagonal
1-591
1-592
Forward Substitution
LDL Factorization
LU Factorization
tril
MATLAB
triu
MATLAB
Purpose
Library
Description
1-593
1-594
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge
Falling edge
Falling edge
Falling edge
1-595
Select the Output filter weights check box to create a Wts port on the
block. For each iteration, the block outputs the current updated filter
weights from this port.
1-596
Dialog
Box
Filter length
Enter the length of the FIR filter weights vector. The sum of the
Block size and the Filter length must be a power of 2.
1-597
Block size
Enter the number of samples to acquire before the filter weights
are updated. The number of rows in the input must be an integer
multiple of the Block size. The sum of the Block size and the
Filter length must be a power of 2.
Specify step-size via
Select Dialog to enter a value for mu, or select Input port to
specify mu using the Step-size input port.
Step-size (mu)
Enter the step-size. Tunable.
Leakage factor (0 to 1)
Enter the leakage factor, 0 < 1 1 . Tunable.
Initial value of filter weights
Specify the initial values of the FIR filter weights.
Adapt port
Select this check box to enable the Adapt input port.
Reset input
Select this check box to enable the Reset input port.
Output filter weights
Select this check box to export the filter weights from the Wts port.
References
Supported
Data
Types
Port
Input
Desired
1-598
Port
Adapt
Reset
See Also
Output
Same as Input
Error
Same as Input
Wts
Same as Input
LMS Filter
RLS Filter
1-599
FFT
Purpose
Library
Transforms
dspxfrm3
Description
The FFT block computes the fast Fourier transform (FFT) of each row of
a sample-based 1-by-P input vector, u, or across the first dimension (P)
of an N-D input array, u. For user-specified FFT lengths, not equal to
P, zero padding or truncating, or modulo-length data wrapping occurs
before the FFT operation, as per Orfanidis [1]:
y = fft(u,M)
% P
Wrapping:
y(:,l) = fft(datawrap(u(:,l),M))
% P > M; l = 1,...,N
Truncating:
y (:,l) = fft(u,M)
% P > M; l = 1,...,N
When the input length, P, is greater than the FFT length, M, you
may see magnitude increases in your FFT output. These magnitude
increases occur because the FFT block uses modulo-M data wrapping to
preserve all available input samples.
To avoid such magnitude increases, you can truncate the length of your
input sample, P, to the FFT length, M. To do so, place a Pad block before
the FFT block in your model.
The kth entry of the lth output channel, y(k, l), equals the kth point of
the M-point discrete Fourier transform (DFT) of the lth input channel:
y(k, l) =
u( p, l)e j 2 ( p1)(k1) / M
p=1
1-600
k = 1, , M
FFT
The block uses one of two possible FFT implementations. You can
select an implementation based on the FFTW library [3], [4], or an
implementation based on a collection of Radix-2 algorithms. You can
select Auto to allow the block to choose the implementation.
FFTW Implementation
The FFTW implementation provides an optimized FFT calculation
including support for power-of-two and non-power-of-two transform
lengths in both simulation and code generation. Generated code
using the FFTW implementation will be restricted to those computers
which are capable of running MATLAB. The input data type must be
floating-point.
Radix-2 Implementation
The Radix-2 implementation supports bit-reversed processing, fixed or
floating-point data, and allows the block to provide portable C-code
generation using the Simulink Coder. The dimension M of the M-by-N
input matrix, must be a power of two. To work with other input sizes,
use the Pad block to pad or truncate these dimensions to powers of two,
or if possible choose the FFTW implementation.
With Radix-2 selected, the block implements one or more of the
following algorithms:
Butterfly operation
Double-signal algorithm
Half-length algorithm
Radix-2 decimation-in-time (DIT) algorithm
Radix-2 decimation-in-frequency (DIF) algorithm
Radix-2 Algorithms for Real and Complex Signals
1-601
FFT
Complexity of
Input
Output
Ordering
Complex
Linear
Complex
Bit-reversed
Radix-2 DIF
Real
Linear
Real
Bit-reversed
The efficiency of the FFT algorithm can be enhanced for real input
signals by forming complex-valued sequences from the real-valued
sequences prior to the computation of the DFT. When there are
2N+1 real input channels, the FFT block forms these complex-valued
sequences by applying the double-signal algorithm to the first 2N input
channels, and the half-length algorithm to the last odd-numbered
channel.
For real input signals with fixed-point data types, it is possible to see
different numerical results in the output of the last odd numbered
channel, even when all input channels are identical. This numerical
difference results from differences in the double-signal algorithm and
the half-length algorithm.
You can eliminate this numerical difference in two ways:
Using full precision arithmetic for fixed-point input signals
Changing the input data type to floating point
For more information on the double-signal and half-length algorithms,
see Proakis [2]. Efficient Computation of the DFT of Two Real
Sequences on page 475 describes the double signal algorithm. Efficient
Computation of the DFT of a 2N-Point Real Sequence on page 476
describes the half-length algorithm.
1-602
FFT
2k
K
3 N/4
fixed-point
The following diagrams show the data types used in the FFT block for
fixed-point signals. You can set the sine table, accumulator, product
output, and output data types displayed in the diagrams in the FFT
dialog box as discussed in Dialog Box on page 1-605.
Inputs to the FFT block are first cast to the output data type and stored
in the output buffer. Each butterfly stage then processes signals in the
accumulator data type, with the final output of the butterfly being cast
back into the output data type. The block multiplies in a twiddle factor
before each butterfly stage in a decimation-in-time FFT and after each
butterfly stage in a decimation-in-frequency FFT.
1-603
FFT
1-604
FFT
Note When the block input is fixed point, all internal data types are
signed fixed point.
Dialog
Box
1-605
FFT
1-606
FFT
FFT implementation
Set this parameter to FFTW [3], [4] to support an arbitrary length
input signal. The block restricts generated code with FFTW
implementation to host computers capable of running MATLAB.
Set this parameter to Radix-2 for bit-reversed processing, fixed
or floating-point data, or for portable C-code generation using the
Simulink Coder. The dimension M of the M-by-N input matrix,
must be a power of two. To work with other input sizes, use the
Pad block to pad or truncate these dimensions to powers of two,
or if possible choose the FFTW implementation. See Radix-2
Implementation on page 1-601.
Set this parameter to Auto to let the block choose the FFT
implementation. For non-power-of-two transform lengths, the
block restricts generated code to MATLAB host computers.
Output in bit-reversed order
Designate the order of the output channel elements relative to
the ordering of the input elements. When you select this check
box, the output channel elements appear in bit-reversed order
relative to the input ordering. If you clear this check box, the
output channel elements appear in linear order relative to the
input ordering.
Linearly ordering the output requires extra data sorting
manipulation, so in some situations it might be better to output in
bit-reversed order.
Note The FFT block calculates its output in bit-reversed
order. Linearly ordering the FFT block output requires an
extra bit-reversal operation. Thus, in many situations, you can
increase the speed of the FFT block by selecting the Output in
bit-reversed order check box.
1-607
FFT
1-608
FFT
1-609
FFT
Rounding mode
Select the rounding mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they always
round to Nearest.
Overflow mode
Select the overflow mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they are always
saturated.
Sine table data type
Choose how you specify the word length of the values of the sine
table. The fraction length of the sine table values always equals
the word length minus one. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Same
The sine table values do not obey the Rounding mode and
Overflow mode parameters; instead, they are always saturated
and rounded to Nearest.
Click the Show data type assistant button
to
display the Data Type Assistant, which helps you set the Sine
table data type parameter.
See Specify Data Types Using Data Type Assistant in Simulink
Users Guide for more information.
Product output data type
Specify the product output data type. See Fixed-Point Data Types
on page 603 and Multiplication Data Types for illustrations
depicting the use of the product output data type in this block.
You can set this parameter to:
1-610
FFT
1-611
FFT
to
Click the Show data type assistant button
display the Data Type Assistant, which helps you set the
Output data type parameter.
See Specify Block Output Data Types in Simulink Users Guide
for more information.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
1-612
FFT
Examples
References
Supported
Data
Types
Port
Input
Output
See Also
DCT
IFFT
Pad
1-613
FFT
1-614
fft
MATLAB
ifft
MATLAB
bitrevorder
Simulink Coder
Simulink Coder
Purpose
Library
Description
1-615
1-616
1-617
1-618
1-619
Dialog
Box
1-620
Note The following parameters for the Filter Realization Wizard are
in the Realize Model pane of the Filter Design and Analysis Tool
(FDATool) GUI. To open different panels of FDATool, click the different
buttons at the lower-left corner. For more information about relevant
panels, see Specify the Filter and Data Types on page 1-616.
1-621
Block Name
Enter the name of the new filter block.
Destination
Specify where the new filter block should be created. This can be
in a new model or in the current (most recently selected) model.
User Defined
Specify the name of the target subsystem in which the Filter
Realization Wizard should create the new filter block.
Overwrite generated block Filter block
When selected, the block overwrites any filter block in the current
model with the name specified in the Block Name parameter.
This parameter is enabled when the Destination parameter is
set to Current.
Build model using basic elements
Select this check box to implement your filter using Sum, Gain,
and Delay blocks. Clear this check box to implement your filter
using the Digital Filter block. This parameter is available only
when your filter can be modeled using the Digital Filter block.
Optimize for zero gains
Select this check box to remove zero-gain paths from the filter
structure. For an example, see Optimize the Filter Structure.
Optimize for unity gains
Select this check box to substitute gains equal to 1 with a
wire (short circuit). For an example, see Optimize the Filter
Structure.
Optimize for negative gains
Select this check box to substitute gains equal to -1 with a
wire (short circuit), and change the corresponding sums to
subtractions. For an example, see Optimize the Filter Structure.
Optimize delay chains
Select this check box to substitute any delay chains made up
of n unit delays with a single delay by n. For an example, see
Optimize the Filter Structure.
1-622
1-623
References
Supported
Data
Types
See Also
Digital Filter
filter
realizemdl
dfilt
Filter Design
Filter Analysis
Select a Filter Design Block
1-624
FIR Decimation
Purpose
Library
Description
FIR filter.
2 Downsamples each channel of filtered data by discarding K1
1-625
FIR Decimation
When you select Dialog parameters, you use the FIR filter
coefficients parameter to specify the numerator coefficients of the
FIR filter transfer function H(z).
H ( z) = B( z) = b1 + b2 z1 + + bm z(m1)
You can generate the FIR filter coefficient vector, [b(1) b(2) ...
b(m)], using one of the Signal Processing Toolbox filter design functions
(such as intfilt).
The filter you specify should be a lowpass filter with a normalized
cutoff frequency no greater than 1/K. The block internally initializes all
filter states to zero.
Note You can use the block method to create your own filter blocks
directly from your mfilt objects.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block resamples each column of the
input over time. In this mode, the block can perform either single-rate
or multirate processing. You can use the Rate options parameter to
specify how the block resamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input and output of the block have the same sample
rate. To decimate the output while maintaining the input sample
rate, the block resamples the data in each column of the input such
that the frame size of the output (Mo) is 1/K times that of the input
(Mo = Mi/K),
In this mode, the input frame size, Mi, must be a multiple of the
Decimation factor, K.
For an example of single-rate FIR Decimation, see Example 1
Single-Rate Processing on page 1-629.
1-626
FIR Decimation
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats an M-by-N matrix input
as M*N independent channels, and decimates each channel over time.
The output sample period (Tso) is K times longer than the input sample
period (Tso = K*Tsi), and the input and output sizes are identical.
Latency
When you use the FIR Decimation block in sample-based processing
mode, the block always has zero-tasking latency. Zero-tasking latency
means that the block propagates the first filtered input sample (received
at time t= 0) as the first output sample. That first output sample is then
followed by filtered input samples K+1, 2K+1, and so on.
When you use the FIR Decimation block in frame-based processing
mode with a frame size greater than one, the block may exhibit
one-frame latency. Cases of one-frame latency can occur when the input
frame size is greater than one, and you set the Input processing and
Rate options parameters of the FIR Decimation block as follows:
Input processing = Columns as channels (frame based)
Rate options = Allow multirate processing
In cases of one-frame latency, you can define the value of the first
Mi output rows by setting the Output buffer initial conditions
1-627
FIR Decimation
You can set the coefficient, product output, accumulator, and output
data types in the block dialog box as discussed in the Dialog Box on
page 1-630 section. This diagram shows that data is stored in the input
buffer with the same data type and scaling as the input. The block
stores filtered data and any initial conditions in the output buffer using
the output data type and scaling that you set in the block dialog box.
When at least one of the inputs to the multiplier is real, the output of
the multiplier is in the product output data type. When both inputs
1-628
FIR Decimation
Examples
1-629
FIR Decimation
Example 3
The ex_polyphasedec model illustrates the underlying polyphase
implementations of the FIR Decimation block. Run the model, and
view the results on the scope. The output of the FIR Decimation block
matches the output of the Polyphase Decimation Filter block.
Example 4
The ex_mrf_nlp model illustrates the use of the FIR Decimation block
in a number of multistage multirate filters.
Dialog
Box
Coefficient Source
The FIR Decimation block can operate in two different modes. Select
the mode in the Coefficient source group box. If you select
Dialog parameters, you enter information about the filter such as
structure and coefficients in the block mask.
Multirate filter object (MFILT), you specify the filter using an
mfilt object.
Different items appear on the FIR Decimation block dialog depending
on whether you select Dialog parameters or Multirate filter object
(MFILT) in the Coefficient source group box. See the following
sections for details:
Specify Filter Characteristics in Dialog on page 1-631
Specify Multirate Filter Object on page 1-639
1-630
FIR Decimation
1-631
FIR Decimation
1-632
FIR Decimation
1-633
FIR Decimation
1-634
FIR Decimation
1-635
FIR Decimation
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they always round to
Nearest.
Note The Rounding mode and Overflow mode settings have
no effect on numerical results when all the following conditions
exist:
Product output data type is Inherit:
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
Same
1-636
FIR Decimation
1-637
FIR Decimation
Same
as accumulator
1-638
FIR Decimation
1-639
FIR Decimation
1-640
FIR Decimation
1-641
FIR Decimation
1-642
FIR Decimation
1-643
FIR Decimation
The fixed-point settings of the filter object specified on the Main pane
are displayed on the Data Types pane. You cannot change these
settings directly on the block mask. To change the fixed-point settings
you must edit the filter object directly.
For more information on multirate filter objects, see the mfilt function
reference page.
References
Supported
Data
Types
Port
Input
Output
See Also
1-644
Downsample
FIR Interpolation
decimate
FIR Decimation
fir1
fir2
firls
1-645
Purpose
Library
Description
1-646
This block is the same as the Simulink Discrete FIR Filter block. For
more information, see the Discrete FIR Filter reference page in the
Simulink documentation.
FIR Interpolation
Purpose
Library
Description
1-647
FIR Interpolation
H ( z) = B( z) = b1 + b2 z1 + + bm z(m1)
You can generate the FIR filter coefficient vector, [b(1) b(2) ...
b(m)], using one of the Signal Processing Toolbox filter design functions
(such as intfilt).
The filter you specify should be a lowpass filter with a length greater
than the interpolation factor (m>L) and a normalized cutoff frequency
no greater than 1/L. The block internally initializes all filter states
to zero.
Note You can use the block method to create your own filter blocks
directly from your mfilt objects.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block resamples each column of the
input over time. In this mode, the block can perform either single-rate
or multirate processing. You can use the Rate options parameter to
specify how the block resamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input and output of the block have the same sample
rate. To interpolate the output while maintaining the input sample
rate, the block resamples the data in each column of the input such
that the frame size of the output (Mo) is L times larger than that
of the input (Mo = Mi*L).
For an example of single-rate FIR Interpolation, see Example 1
Single-Rate Processing on page 1-651.
When you set the Rate options parameter to Allow multirate
processing, the input and output of the FIR Interpolation block
are the same size. However, the sample rate of the output is L
times faster than that of the input. In this mode, the block treats
an Mi-by-N matrix input as N independent channels. The block
1-648
FIR Interpolation
interpolates each column of the input over time by keeping the frame
size constant (Mi=Mo), while making the output frame period (Tfo) L
times shorter than the input frame period (Tfo = Tfi/L).
See Example 2 Multirate Frame-Based Processing on page 1-652
for an example that uses the FIR Interpolation block in this mode.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats an M-by-N matrix input as
M*N independent channels, and interpolates each channel over time.
The output sample period (Tso) is L times shorter than the input sample
period (Tso = Tsi/L), while the input and output sizes remain identical.
Latency
When you run your models in Simulink SingleTasking mode or set
the Input processing parameter to Columns as channels (frame
based) and the Rate options parameter to Enforce single-rate
processing, the FIR Interpolation block always has zero-tasking
latency. Zero-tasking latency means that the block propagates the first
filtered input sample (received at time t=0) as the first output sample.
That first output sample is then followed by L1 interpolated values,
the second filtered input sample, and so on.
The only time the FIR Interpolation block exhibits latency is when you
set the Rate options parameter set to Allow multirate processing
and run your models in Simulink MultiTasking mode. The amount of
latency for multirate, multitasking operation depends on the setting of
the Input processing parameter, as shown in the following table.
Input processing
Latency
Elements as channels
(sample based)
L samples
Columns as channels
(frame based)
1-649
FIR Interpolation
When the block exhibits latency, the default initial condition is zero.
Alternatively, you can use the Output buffer initial conditions
parameter to specify a matrix of initial conditions containing one
value for each channel or a scalar initial condition to be applied to all
channels. The block scales the Output buffer initial conditions by
the Interpolation factor and outputs the scaled initial conditions
until the first filtered input sample becomes available.
When the block is in sample-based processing mode, the block outputs
the scaled initial conditions at the start of each channel, followed
immediately by the first filtered input sample, then L1 interpolated
values, and so on.
When the block is in frame-based processing mode and using the default
initial condition of zero, the first Mi*L output rows contain zeros, where
Mi is the input frame size. The first filtered input sample (first filtered
row of the input matrix) appears in the output as sample Mi*L+1. That
value is then followed by L1 interpolated values, the second filtered
input sample, and so on.
Note For more information on latency and the Simulink tasking modes,
see Excess Algorithmic Delay (Tasking Latency) in the DSP System
Toolbox Users Guide and Scheduling in the Simulink Coder Users
Guide.
1-650
FIR Interpolation
You can set the coefficient, product output, accumulator, and output
data types in the block dialog as discussed in Dialog Box on page
1-653 section. This diagram shows that input data is stored in the input
buffer with the same data type and scaling as the input. The block
stores filtered data and any initial conditions in the output buffer using
the output data type and scaling that you set in the block dialog box.
When at least one of the inputs to the multiplier is real, the output of
the multiplier is in the product output data type. When both inputs
to the multiplier are complex, the result of the multiplication is in
the accumulator data type. For details on the complex multiplication
performed by this block, see Multiplication Data Types in the DSP
System Toolbox Users Guide.
Note When the block input is fixed point, all internal data types are
signed fixed point.
Examples
1-651
FIR Interpolation
Example 3
The ex_polyphaseinterp model illustrates the underlying polyphase
implementations of the FIR Interpolation block. Run the model, and
view the results on the scope. The output of the FIR Interpolation block
matches the output of the Polyphase Interpolation Filter block.
Example 4
The ex_mrf_nlp model illustrates the use of the FIR Interpolation block
in a number of multistage multirate filters.
1-652
FIR Interpolation
Dialog
Box
Coefficient Source
The FIR Interpolation block can operate in two different modes. Select
the mode in the Coefficient source group box. If you select
Dialog parameters, you enter information about the filter such as
structure and coefficients in the block mask.
Multirate filter object (MFILT), you specify the filter using an
mfilt object.
Different items appear on the FIR Interpolation block dialog depending
on whether you select Dialog parameters or Multirate filter object
(MFILT) in the Coefficient source group box. See the following
sections for details:
Specify Filter Characteristics in Dialog on page 1-653
Specify Multirate Filter Object on page 1-662
1-653
FIR Interpolation
1-654
FIR Interpolation
1-655
FIR Interpolation
1-656
FIR Interpolation
The Data Types pane of the FIR Interpolation block dialog appears
as follows when you select Dialog parameters in the Coefficient
source group box.
1-657
FIR Interpolation
1-658
FIR Interpolation
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they always round to
Nearest.
Note The Rounding mode and Overflow mode settings have
no effect on numerical results when all the following conditions
exist:
Product output data type is Inherit:
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
Same
1-659
FIR Interpolation
1-660
FIR Interpolation
Same
as accumulator
1-661
FIR Interpolation
1-662
FIR Interpolation
1-663
FIR Interpolation
1-664
FIR Interpolation
1-665
FIR Interpolation
1-666
FIR Interpolation
The fixed-point settings of the filter object specified on the Main pane
are displayed on the Data Types pane. You cannot change these
settings directly on the block mask. To change the fixed-point settings
you must edit the filter object directly.
For more information on multirate filter objects, see the mfilt function
reference page.
References
Supported
Data
Types
Port
Input
Output
See Also
FIR Decimation
Upsample
fir1
1-667
FIR Interpolation
1-668
fir2
firls
interp
Purpose
Library
Description
The FIR Rate Conversion block resamples the discrete-time input such
that its sample period is K/L times the input sample period (Tsi). K is
the integer value you specify for the Decimation factor parameter,
and L is the integer value you specify for the Interpolation factor
parameter.
The block treats each column of the input as a separate channel, and
resamples the data in each channel independently over time. To do so,
the block implements a polyphase filter structure and performs the
following operations:
1 Upsamples the input to a higher rate by inserting L-1 zeros between
input samples.
2 Passes the upsampled data through a direct-form II transpose FIR
filter.
3 Downsamples the filtered data to a lower rate by discarding K-1
1-669
M
K
= i
L Mo , where Mi and Mo are the integer frame sizes of the input
and output, respectively.
You can satisfy the second requirement by setting the Decimation
factor, K, equal to the input frame size, Mi. When you do so, the output
frame size, Mo, equals the Interpolation factor, L.
By changing the frame size in this way, the block is able to hold the
frame period constant (Tfi = Tfo) and achieve the desired conversion of
the sample period, such that
Tso =
K
Tsi
L
H ( z) = B( z) = b1 + b2 z1 + + bm z(m1)
You can generate the FIR filter coefficient vector, [b(1) b(2) ...
b(m)], using one of the Signal Processing Toolbox filter design functions
(such as intfilt).
The coefficient vector you specify must have a length greater than the
interpolation factor (m>L). The FIR filter must be a lowpass filter with
1-670
You can set the coefficient, product output, accumulator, and output
data types in the block dialog box as discussed in Dialog Box on page
1-672. The diagram shows that input data is stored in the input buffer
in the same data type and scaling as the input. Filtered data resides
in the output buffer in the output data type and scaling that you set in
the block dialog. The block stores any initial conditions in the output
buffer using the output data type and scaling that you set in the block
dialog box.
The output of the multiplier is in the product output data type when
at least one of the inputs to the multiplier is real. When both of the
inputs to the multiplier are complex, the result of the multiplication is
in the accumulator data type. For details on the complex multiplication
performed, see Multiplication Data Types.
Note When the block input is fixed point, all internal data types are
signed fixed point.
1-671
Examples
Example 1
The following figure shows how the FIR Rate Conversion block converts
a 4-by-1 input with a sample period of 3/4, to a 3-by-1 output with a
sample period of 1. The frame period (Tf) of 3 remains constant.
Example 2
The ex_audio_src model provides a simple illustration of one way to
convert a speech signal from one sample rate to another. In this model,
the data is first sampled at 22,050 Hz and then resampled at 8000
Hz. If you listen to the output, you can hear that the high frequency
content has been removed from the signal, although the speech sounds
basically the same.
Dialog
Box
Coefficient Source
The FIR Rate Conversion block can operate in two different modes.
Select the mode in the Coefficient source group box. If you select
Dialog parameters, you enter information about the filter such as
structure and coefficients in the block mask.
1-672
1-673
Interpolation factor
Specify the integer factor, L, by which to upsample the signal
before filtering.
1-674
1-675
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they always round to
Nearest.
1-676
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
Same
1-677
1-678
Same
as accumulator
1-679
1-680
1-681
You can fully specify the mfilt object in the block mask.
You can enter the variable name of a mfilt object that is
defined in any workspace.
You can enter a variable name for a mfilt object that is not yet
defined, as shown in the default value.
For more information on creating mfilt objects, see the mfilt
function reference page.
View filter response
This button opens the Filter Visualization Tool (fvtool) from
the Signal Processing Toolbox product and displays the filter
response of the mfilt object specified in the Multirate filter
variable parameter. For more information on FVTool, see the
Signal Processing Toolbox documentation.
Note If you specify a filter in the Multirate filter variable
parameter, you must apply the filter by clicking the Apply button
before using the View filter response button.
The Data Types pane of the FIR Rate Conversion block dialog appears
similar to the following dialog when Multirate filter object (MFILT)
is specified in the Coefficient source group box. The fixed-point data
types you see depend on the mfilt object you use.
1-682
The fixed-point settings of the filter object specified on the Main pane
are displayed on the Data Types pane. You cannot change these
settings directly on the block mask. To change the fixed-point settings
you must edit the filter object directly.
1-683
For more information on multirate filter objects, see the mfilt function
reference page.
References
Supported
Data
Types
Port
Input
Output
See Also
1-684
Downsample
FIR Decimation
FIR Interpolation
Upsample
fir1
fir2
firls
upfirdn
1-685
Flip
Purpose
Library
Description
When flipping the input vertically, the block treats length-M unoriented
vector inputs as M-by-1 column vectors.
When you set the Flip along parameter to Rows, the block flips the
input horizontally so the first column of the input becomes the last
column of the output.
y = fliplr(u)
1-686
Flip
Dialog
Box
Supported
Data
Types
Flip along
Specify the dimension along which to flip the input. When you set
this parameter to Columns, the block flips the input vertically.
When you set this parameter to Rows, the block flips the input
horizontally.
Port
Input
1-687
Flip
Port
Output
See Also
1-688
Selector
Simulink
Transpose
Variable Selector
flipud
MATLAB
fliplr
MATLAB
Forward Substitution
Purpose
Library
Description
1-689
Forward Substitution
1
z
Output
data type
Accumulator or
product output
data type
MULTIPLIER
CAST
Input L
data type
ADDER
ADDER
Accumulator
data type
Input B
data type
CAST
Input L
data type
1-690
DIVIDER
Output
data type
Forward Substitution
1
z
Output
data type
Accumulator or
product output
data type
MULTIPLIER
CAST
Input L
data type
ADDER
ADDER
CAST
Output
data type
Accumulator
data type
Input B
data type
CAST
You can set the product output, accumulator, and output data types in
the block dialog box, as discussed in the following section.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Dialog
Box
The Main pane of the Forward Substitution block dialog box appears
as follows.
1-691
Forward Substitution
1-692
Forward Substitution
1-693
Forward Substitution
The Data Types pane of the Forward Substitution block dialog box
appears as follows.
1-694
Forward Substitution
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-689 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-695
Forward Substitution
Same
as first input
1-696
Forward Substitution
Supported
Data
Types
Port
1-697
Forward Substitution
See Also
Backward
Substitution
Cholesky Solver
LDL Solver
Levinson-Durbin
LU Solver
QR Solver
1-698
Frame Conversion
Purpose
Library
Description
The Frame Conversion block passes the input through to the output
and sets the output sampling mode to the value of the Sampling mode
of output signal parameter, which can be either Frame-based or
Sample-based. The output sampling mode can also be inherited from
the signal at the Ref (reference) input port, which you make visible by
selecting the Inherit output sampling mode from <Ref> input
port check box.
The Frame Conversion block does not make any changes to the input
signal other than the sampling mode. In particular, the block does not
rebuffer or resize 2-D inputs. Because 1-D vectors cannot be frame
based, when the input is a length-M 1-D vector and the block is in
Frame-based mode, the output is a frame-based M-by-1 matrix that
is, a single channel.
Dialog
Box
1-699
Frame Conversion
Supported
Data
Types
Port
In
Ref
Output
1-700
Frame Conversion
See Also
Buffer
Inherit Complexity
Unbuffer
Probe
Simulink
Reshape
Simulink
Signal Specification
Simulink
1-701
Purpose
Library
dspobslib
Description
Note The Frame Status Conversion block is still supported but is likely
to be obsoleted in a future release. We strongly recommend replacing
this block with the Frame Conversion block.
The Frame Status Conversion block passes the input through to
the output, and sets the output frame status to the Output signal
parameter, which can be either Frame-based or Sample-based. The
output frame status can also be inherited from the signal at the Ref
(reference) input port, which is made visible by selecting the Inherit
output frame status from Ref input port check box.
When the Output signal parameter setting or the inherited signals
frame status differs from the input frame status, the block changes the
input frame status accordingly, but does not otherwise alter the signal.
In particular, the block does not rebuffer or resize 2-D inputs. Because
1-D vectors cannot be frame based, when the input is a length-M 1-D
vector, and the Output signal parameter is set to Frame-based, the
output is a frame-based M-by-1 matrix (that is, a single channel).
When the Output signal parameter or the inherited signals frame
status matches the input frame status, the block passes the input
through to the output unaltered.
1-702
Dialog
Box
Supported
Data
Types
Port
In
Ref
1-703
Port
Output
See Also
1-704
Inherit Complexity
Purpose
Library
Sources
dspsrcs4
Description
The From Audio Device block reads audio data from an audio device in
real time. This block is not supported for use with the Simulink Model
block.
Use the Device parameter to specify the device from which to acquire
audio. This parameter is automatically populated based on the audio
devices installed on your system. If you plug or unplug an audio device
from your system, type clear mex at the MATLAB command prompt
to update this list.
Use the Number of channels parameter to specify the number of
audio channels in the signal. For example:
Enter 2 if the audio source is two channels (stereo).
Enter 1 if the audio source is single channel (mono).
Enter 6 if you are working with a 5.1 speaker system.
The blocks output is an M-by-N matrix, where M is the number of
consecutive samples and N is the number of audio channels.
Use the Sample rate (Hz) parameter to specify the number of samples
per second in the signal. If the audio data is processed in uncompressed
pulse code modulation (PCM) format, it should typically be sampled
at one of the standard audio device rates: 8000, 11025, 22050, 44100,
or 48000 Hz.
The range of supported audio device sample rates and data type
formats, depend on both the sound card and the API which is chosen
for the sound card.
Use the Device data type parameter to specify the data type of the
audio data that the device is placing in the buffer. You can choose:
1-705
8-bit integer
16-bit integer
24-bit integer
32-bit float
Determine from output data type
If you choose Determine from output data type, the following table
summarizes the blocks behavior.
Output Data Type
32-bit integer
24-bit integer
16-bit integer
16-bit integer
8-bit integer
8-bit integer
If you choose Determine from output data type and the device does
not support a data type, the block uses the next lowest precision data
type supported by the device.
Use the Frame size (samples) parameter to specify the number of
samples in the blocks output. Use the Output data type parameter to
specify the data type of audio data output by the block.
The generated code for this block relies on prebuilt .dll files. You can
run this code outside the MATLAB environment, or redeploy it, but be
sure to account for these extra .dll files when doing so. The packNGo
function creates a single zip file containing all of the pieces required to
run or rebuild this code. See packNGo for more information.
Buffering
The From Audio Device block buffers the data from the audio device
using the process illustrated by the following figure.
1-706
Queue
Physical
Device
Buffer
Simulink
Frame
input data to a buffer. This data has the data type specified by the
Device data type parameter.
2 When the buffer is full, the From Audio Device block writes the
contents of the buffer to the queue. Specify the size of this queue
using the Queue duration (seconds) parameter.
3 As the audio device appends audio data to the bottom of the queue,
the From Audio Device block pulls data from the top of the queue to
fill the Simulink frame. This data has the data type specified by the
Output data type parameter.
Select the Automatically determine buffer size check box to allow
the block to calculate a conservative buffer size using the following
equation:
size =
sr
log 2 10
2
In this equation, size is the buffer size, and sr is the sample rate. If you
clear this check box, the Buffer size (samples) parameter appears on
the block. Use this parameter to specify the buffer size in samples.
1-707
Channel Mapping
The term Channel Mapping refers to a 1-to-1 mapping that associates
channels on the selected audio device to channels of the data. When you
record audio, channel mapping allows you to specify which channel
of the audio data directs input to a specific channel of audio. You
can specify channel mapping as a vector of audio channel indices
corresponding to each channel of data being read. The default value in
the Device Input Channels parameter is 1:MAXINPUTCHANNELS.
If you do not select the default mapping, you must specify the Device
Input Channels parameter in the dialog box.
Example: The selected input audio device contains 8 channels. You
want to read data from only channels 2, 4, 6, and redirect the data as
follows:
Audio Device channel 2 to first data channel
Audio Device channel 4 to second data channel
Audio Device channel 6 to third data channel
Thus you would specify the Device Input Channels as [2 4 6].
Troubleshooting
Not Keeping up in Real Time
1-708
1-709
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
1-710
Dialog
Box
Device
Specify the device from which to acquire audio data.
1-711
1-712
Supported
Data
Types
Port
Output
See Also
To Audio Device
audiorecorder
MATLAB
dsp.AudioRecorder
System Object
1-713
Purpose
Library
Sources
dspsrcs4
Description
The From Multimedia File block reads audio samples, video frames, or
both from a multimedia file. The block imports data from the file into a
Simulink model.
Note This block supports code generation for the host computer
that has file I/O available. You cannot use this block with Real-Time
Windows Target software because that product does not support file
I/O.
The generated code for this block relies on prebuilt library files. You
can run this code outside the MATLAB environment, or redeploy it,
but be sure to account for these extra library files when doing so. The
packNGo function creates a single zip file containing all of the pieces
required to run or rebuild this code. See packNGo for more information.
To run an executable file that was generated from a model containing
this block, you may need to add precompiled shared library files to your
system path. See Understanding Code Generation for details.
1-714
Supported
Platforms
and File
Types
Image files
.jpg,.bmp,.png
Video files
Audio files
The default for image files is .png, , for video files is .avi, and for
audio files is .mp3.
Windows XP x64 platform ships with a limited set of 64-bit video and
audio codecs. If the From Multimedia File block cannot work on a
compressed multimedia file, try one of the two alternatives:
Run the 32-bit version of MATLAB on your Windows XP x64
platform. Windows XP x64 ships with many 32-bit codecs.
Save the multimedia file to a file format supported by the From
Multimedia File block.
If you use Windows, use Windows Media Player Version 11 or later
with this block for best results.
1-715
Multimedia
Types
Video files
Audio files
The default for video files is .avi, and for audio files is .mp3.
Ports
The output ports of the From Multimedia File block change according to
the content of the multimedia file. If the file contains only video frames,
the Image, intensity I, or R,G,B ports appear on the block. If the file
contains only audio samples, the Audio port appears on the block. If
the file contains both audio and video, you can select the data to emit.
The following table describes available ports.
Port
Description
Image
R, G, B
Matrix that represents one plane of the RGB video stream. Outputs
from the R, G, or B ports must have same dimensions.
Audio
Y, Cb, Cr
Matrix that represents one frame of the YCbCr video stream. The Y,
Cb, Cr ports produce the following outputs:
Y: M x N
N
2
N
Cr: M x
2
Cb: M x
1-716
Sample
Rates
Sample
Time
Calculations
Used for
Video and
Audio
Files
The sample rate that the block uses depends on the audio and video
sample rate. While the FMMF block operates at a single rate in
Simulink, the underlying audio and video streams can produce different
rates. In some cases, when the block outputs both audio and video,
makes a small adjustment to the video rate.
Sample time =
AudioSampleRate
is noninteger, the
FPS
1
equation cannot reduce to FPS .
1
stream by more than FPS .
In summary, the block outputs one video frame at each Simulink
time step. To calculate the number of audio samples to output at
each time step, the block divides the audio sample rate by the video
frame rate (fps). If the audio sample rate does not divide evenly by
the number of video frames per second, the block rounds the number
of audio samples up to the nearest whole number. If necessary, the
block periodically drops a video frame to maintain synchronization
for large files.
1-717
Dialog
Box
1-718
The Main pane of the From Multimedia File block dialog appears as
follows.
File name
Specify the name of the multimedia file from which to read. The
block determines the type of file (audio and video, audio only, or
video only) and provides the associated parameters.
If the location of the file does not appear on your MATLAB path,
use the Browse button to specify the full path. Otherwise, if the
location of this file appears on your MATLAB path, enter only the
file name. On Windows platforms, this parameter supports URLs
that point to MMS (Microsoft Media Server) streams.
Inherit sample time from file
Select the Inherit sample time from file check box if you want
the block sample time to be the same as the multimedia file. If you
clear this check box, enter the block sample time in the Desired
sample time parameter field. The file that the From Multimedia
File block references, determines the block default sample time.
You can also set the sample time for this block manually. If you
do not know the intended sample rate of the video, let the block
inherit the sample rate from the multimedia file.
Desired sample time
Specify the block sample time. This parameter becomes available
if you clear the Inherit sample time from file check box.
Number of times to play file
Enter a positive integer or inf to represent the number of times
to play the file.
Output end-of-file indicator
Use this check box to determine whether the output is the last
video frame or audio sample in the multimedia file. When you
select this check box, a Boolean output port labeled EOF appears
on the block. The output from the EOF port defaults to 1 when
the last video frame or audio sample is output from the block.
Otherwise, the output from the EOF port defaults to 0.
1-719
Multimedia outputs
Specify Video and audio, Video only, or Audio only output file
type. This parameter becomes available only when a video signal
has both audio and video.
Samples per audio channel
Specify number of samples per audio channel. This parameter
becomes available for files containing audio.
Output color format
Specify whether you want the block to output RGB, Intensity, or
YCbCr 4:2:2 video frames. This parameter becomes available
only for a signal that contains video. If you select RGB, use the
Image signal parameter to specify how to output a color signal.
Image signal
Specify how to output a color video signal. If you select One
multidimensional signal, the block outputs an M-by-N-by-P
color video signal, where P is the number of color planes, at one
port. If you select Separate color signals, additional ports
appear on the block. Each port outputs one M-by-N plane of an
RGB video stream. This parameter becomes available only if
you set the Image color space parameter to RGB and the signal
contains video.
Audio output sampling mode
Select Sample based or Frame based output. If the input to the
block has 3 or more dimensions, you must select Sample based
output. This parameter appears when you specify a file containing
audio for the File name parameter.
The Data Types pane of the To Multimedia File block dialog box
appears as follows.
1-720
1-721
1-722
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
Platform
Command
$MATLABROOT/bin/glnxa64
(Bash)
Windows
Supported
Data
Types
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
Supports
Complex
Values?
Image
No
No
Audio
No
No
1-723
See Also
1-724
To Multimedia File
Sample Time
Simulink
Purpose
Library
dspwin32
Description
Note The From Wave Device block is still supported but is likely to be
obsoleted in a future release. We strongly recommend replacing this
block with the From Audio Device block.
The From Wave Device block reads audio data from a standard Windows
audio device in real-time. It is compatible with most popular Windows
hardware, including Sound Blaster cards. (Models that contain both
this block and the To Wave Device block require a duplex-capable sound
card.)
The Use default audio device parameter allows the block to detect
and use the systems default audio hardware. This option should be
selected on systems that have a single sound device installed, or when
the default sound device on a multiple-device system is the desired
source. In cases when the default sound device is not the desired input
source, clear Use default audio device, and select the desired device
in the Audio device menu parameter.
When the audio source contains two channels (stereo), the Stereo
check box should be selected. When the audio source contains a single
channel (mono), the Stereo check box should be cleared. For stereo
input, the blocks output is an M-by-2 matrix containing one frame (M
consecutive samples) of audio data from each of the two channels. For
mono input, the blocks output is an M-by-1 matrix containing one
frame (M consecutive samples) of audio data from the mono input. The
frame size, M, is specified by the Samples per frame parameter. For
M=1, the output is sample based; otherwise, the output is frame based.
The audio data is processed in uncompressed pulse code modulation
(PCM) format, and should typically be sampled at one of the standard
Windows audio device rates: 8000, 11025, 22050, or 44100 Hz. You can
1-725
select one of these rates from the Sample rate parameter. To specify a
different rate, select the User-defined option and enter a value in the
User-defined sample rate parameter.
The Sample Width (bits) parameter specifies the number of bits used
to represent the signal samples read by the audio device. The following
settings are available:
8 allocates 8 bits to each sample, allowing a resolution of 256 levels
16 allocates 16 bits to each sample, allowing a resolution of 65536
levels
24 allocates 24 bits to each sample, allowing a resolution of
16777216 levels (only for use with 24-bit audio devices)
Higher sample width settings require more memory but yield better
fidelity. The output from the block is independent of the Sample width
(bits) setting. The output data type is determined by the Data type
parameter setting.
Buffering
Since the audio device accepts real-time audio input, Simulink software
must read a continuous stream of data from the device throughout
the simulation. Delays in reading data from the audio hardware can
result in hardware errors or distortion of the signal. This means that
the From Wave Device block must read data from the audio hardware
as quickly as the hardware itself acquires the signal. However, the
block often cannot match the throughput rate of the audio hardware,
especially when the simulation is running from within Simulink rather
than as generated code. (Simulink operations are generally slower
than comparable hardware operations, and execution speed routinely
varies during the simulation as the host operating system services other
processes.) The block must therefore rely on a buffering strategy to
ensure that signal data can be read on schedule without losing samples.
At the start of the simulation, the audio device begins writing the input
data to a (hardware) buffer with a capacity of Tb seconds. The From
Wave Device block immediately begins pulling the earliest samples off
1-726
the buffer (first in, first out) and collecting them in length-M frames for
output. As the audio device continues to append inputs to the bottom
of the buffer, the From Wave Device block continues to pull inputs off
the top of the buffer at the best possible rate.
The following figure shows an audio signal being acquired and output
with a frame size of 8 samples. The buffer of the sound board is
approaching its five-frame capacity at the instant shown, which means
that the hardware is adding samples to the buffer more rapidly than
the block is pulling them off. (If the signal sample rate was 8 kHz, this
small buffer could hold approximately 0.005 second of data.
Troubleshooting
When the buffer size is too small in relation to the simulation
throughput rate, the buffer might fill before the entire length of signal
is processed. This usually results in a device error or undesired device
output. When this problem occurs, you can choose to either increase the
buffer size or the simulation throughput rate:
1-727
Tb Fs
M
where Fs is the sample rate of the signal and M is the number
of samples per frame. The required buffer size for a given signal
depends on the signal length, the frame size, and the speed of the
simulation. Note that increasing the buffer size might increase
model latency.
Increase the simulation throughput rate
Two useful methods for improving simulation throughput rates are
increasing the signal frame size and compiling the simulation into
native code:
1-728
Dialog
Box
1-729
Stereo
Specifies stereo (two-channel) inputs when selected, mono
(one-channel) inputs when cleared. Stereo output is M-by-2; mono
output is M-by-1.
Samples per frame
The number of audio samples in each successive output frame,
M. When the value of this parameter is 1, the block outputs a
sample-based signal.
Queue duration (seconds)
The length of signal (in seconds) to buffer to the hardware at the
start of the simulation.
Use default audio device
Reads audio input from the systems default audio device when
selected. Clear to enable the Audio device ID parameter and
select a device.
Audio device
The name of the audio device from which to read the audio output
(lists the names of the installed audio device drivers). Select Use
default audio device when the system has only a single audio
card installed.
Data type
The data type of the output: double-precision, single-precision,
signed 16-bit integer, or unsigned 8-bit integer.
Supported
Data
Types
1-730
See Also
To Wave Device
(Obsolete)
audiorecorder
MATLAB
1-731
Purpose
Library
dspwin32
Description
Note The From Wave File block is still supported but is likely to be
obsoleted in a future release. We strongly recommend replacing this
block with the From Multimedia File block.
The From Wave File block streams audio data from a Microsoft Wave
(.wav) file and generates a signal with one of the data types and
amplitude ranges in the following table.
Note AVI files are the only supported file type for non-Windows
platforms.
Output Data
Type
double
single
int16
uint8
0 to 255
The block supports 8-, 16-, 24-, and 32-bit Microsoft Wave (.wav) files.
The File name parameter can specify an absolute or relative path to the
file. When the file is on the MATLAB path or in the current folder (the
1-732
folder returned by typing pwd at the MATLAB command line), you need
only specify the file name. You do not need to specify the.wav extension.
Note The From Wave File block does not support .wav file names that
contain a + character. To read .wav files that have a + character in the
file name, use the From Multimedia File block.
For an audio file containing C channels, the blocks output is an M-by-C
matrix containing one frame (M consecutive samples) of audio data
from each channel. The frame size, M, is specified by the Samples
per output frame parameter. For M=1, the output is sample based;
otherwise, the output is frame based.
The output frame period, Tfo, is
Tfo =
M
Fs
1-733
1-734
Dialog
Box
File name
Enter the path and name of the file to read. Paths can be relative
or absolute.
1-735
Note The From Wave File block does not support .wav file
names that contain a + character. To read .wav files that have a +
character in the file name, use the From Multimedia File block.
Samples per output frame
Enter the number of samples in each output frame, M. When the
value of this parameter is 1, the block outputs a sample-based
signal.
Minimum number of samples for each read from file
Enter the number of consecutive samples to acquire from the file
with each file access, L.
Data type
Select the output data type: double, single, uint8, or int16. The
data type setting determines the outputs amplitude range.
Loop
Select this check box if you want to play the file more than once.
Number of times to play file
Enter the number of times you want to play the file.
Samples restart
Select immediately after last sample to repeat the audio
file immediately. Select at beginning of next frame to place
the first sample of the audio file in the first position of the next
output frame.
Output start-of-file indicator
Use this check box to determine whether the output contains the
first audio sample in the file.
Output end-of-file indicator
Use this check box to determine whether the output contains the
last audio sample in the file.
1-736
Supported
Data
Types
See Also
To Multimedia File
wavread
MATLAB
1-737
G711 Codec
Purpose
Library
Quantizers
dspquant2
Description
1-738
G711 Codec
1-739
G711 Codec
Dialog
Box
Mode
When you choose Encode PCM to A-law, the block implements
an A-law encoder.
When you choose Encode PCM to mu-law, the block
implements a mu-law encoder.
When you choose Decode A-law to PCM, the block decodes
the input index values into quantized output values using an
A-law lookup table.
When you choose Decode mu-law to PCM, the block decodes
the input index values into quantized output values using a
mu-law lookup table.
When you choose Convert A-law to mu-law, the block
converts the input A-law index values to mu-law index values.
When you choose Convert mu-law to A-law, the block
converts the input mu-law index values to A-law index values.
1-740
G711 Codec
Overflow diagnostic
Use this parameter to determine the behavior of the block when
overflow occurs.
Select Ignore to proceed with the computation without a
warning message.
Select Warning to display a warning message in the MATLAB
Command Window and continue the simulation.
Select Error to display an error dialog box and terminate the
simulation.
This parameter is only visible if, for the Mode parameter, you
select Encode PCM to A-law or Encode PCM to mu-law.
References
Supported
Data
Types
See Also
Port
PCM
mu
Quantizer
Simulink
Uniform Decoder
Uniform Encoder
1-741
G711 Codec
1-742
Halfband Filter
Purpose
Library
Description
Dialog
Box
See Halfband Filter Design Dialog Box Main Pane on page 4-729
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
1-743
Halfband Filter
1-744
Halfband Filter
Filter Specifications
In this group, you specify your filter type and order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select either Minimum (the default) or Specify from the drop-down
list. Selecting Specify enables the Order option (see the
following sections) so you can enter the filter order.
Response type
Specify the filter response as Lowpass (the default) or Highpass.
Filter type
Select Single-rate, Decimator, or Interpolator. By default, the
block specifies a single-rate filter.
1-745
Halfband Filter
Order
Enter the filter order. This option is enabled only when the Filter
order mode is set to Specify.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications for a halfband lowpass filter
look similar to those shown in the following figure.
In the figure, the transition region lies between the end of the passband
and the start of the stopband. The width is defined explicitly by the
value of Transition width.
Frequency constraints
When Order mode is Specify, set this parameter to
Unconstrained or Transition width.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
1-746
Halfband Filter
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude constraints
Specify Unconstrained (the default), or select Stopband
attenuation to constrain the response in the stopband explicitly.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Astop
When Magnitude units is Stopband attenuation, enter the
filter attenuation in the stopband in the units you choose for
Magnitude units, either linear or decibels.
1-747
Halfband Filter
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. For FIR halfband filters,
the available design options are equiripple, and Kaiser
window. For IIR halfband filters, the available design options are
Butterworth, elliptic, and IIR quasi-linear phase.
Design Options
The following design options are available for FIR halfband filters
when the user specifies an equiripple design:
Minimum phase
Select the checkbox to specify a minimum-phase design.
Stopband Shape
Stopband shape lets you specify how the stopband changes
with increasing frequency. Choose one of the following
options:
Flat Specifies that the stopband is flat. The
attenuation does not change as the frequency increases.
Linear Specifies that the stopband attenuation
changes linearly as the frequency increases. Change the
slope of the stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in
Stopband decay.
Stopband Decay
When you set Stopband shape, Stopband decay specifies
the amount of decay applied to the stopband. the following
1-748
Halfband Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
1-749
Halfband Filter
1-750
Halfband Filter
Supported
Data
Types
Port
Input
Output
1-751
Purpose
Library
Transforms
dspxfrm3
Description
The FFT HDL Optimized block implements a pipelined Radix-2 FFT
algorithm which provides hardware speed and area optimization for
streaming data applications. The block accepts scalar input, provides
hardware-friendly control signals, and has optional output frame
control signals. Vector input is supported for simulation but not for
HDL code generation.
Signal Attributes
The following image illustrates the port signals of the interface for the
FFT HDL Optimized block.
1-752
Port
Direction
Description
Data Type
dataIn
Input
fixdt(), int64/32/16/8,
uint64/32/16/8. Double
and single are allowed
for simulation but not for
HDL code generation.
validIn
Input
Boolean
dataOut
Output
Same as dataIn
validOut
Output
Boolean
startOut
Output
Boolean
endOut
Output
Boolean
1-753
Dialog
Box and
Parameters
Main
1-754
you use Property with vector input, the input vector width must
be less than or equal to the FFT length. When you select Auto,
the FFT length is inferred from the input vector data width. The
Auto FFT length option is not supported for scalar input. The
default is Property.
FFT length
Specify the number of data points used for one FFT calculation.
This value is used when Source of FFT length is set to
Property. The default value is 1024. The FFT length must be a
power of 2 between 23 and 216 for HDL code generation. If the
input is a vector, the width must be less than or equal to the FFT
Length.
Simulate using
Type of simulation to run. The default is Code generation. This
parameter does not affect generated HDL code.
Code generation
Simulate model using generated C code. The first time you run
a simulation, Simulink generates C code for the block. The C
code is reused for subsequent simulations. This option requires
additional startup time, but provides faster simulation speed
than Interpreted execution.
Interpreted execution
Simulate model using the MATLAB interpreter. This option
shortens startup times, but has slower simulation speeds than
Code Generation.
1-755
Data Types
1-756
Overflow Action
The overflow action for internal fixed point calculations is Wrap.
Control Ports
1-757
Algorithm
1-758
Control Signals
The validIn control signal is required for HDL code generation. It is
optional for simulation. If you enable the validIn port, input data
is processed only when validIn is high. Output data is valid when
validOut is high.
Timing Diagram
This diagram illustrates validIn and validOut signals for a FFT
length of 1024.
1-759
Delay
The FFT latency from start of input to start of output, assuming the
input is contiguous, is calculated from the following equation, where
N is the FFT length.
N
6 (log 2 N 2) 8
2
1-760
displayed because the FFT length is not known until you compile the
model.
Performance
When generated HDL code for the default block configuration
(FFT length 1024) is synthesized into a Xilinx Virtex6
(XC6VLX75T-1FF484), the block achieves 295 MHz clock frequency. It
uses the following resources.
Resource
Uses
LUT
3219
4335
FFS
Xilinx
LogiCORE
DSP48
16
6
Performance of the synthesized HDL code for this block will vary with
your target and synthesis options.
See Also
1-761
Purpose
Library
Transforms
dspxfrm3
Description
The IFFT HDL Optimized block implements a pipelined Radix-2 IFFT
algorithm which provides hardware speed and area optimization for
streaming data applications. The block accepts scalar input, provides
hardware-friendly control signals, and has optional output frame
control signals. Vector input is supported for simulation but not for
HDL code generation.
Signal Attributes
The following image illustrates the port signals of the interface for the
FFT HDL Optimized block.
1-762
Port
Direction
Description
Data Type
dataIn
Input
fixdt(), int64/32/16/8,
uint64/32/16/8. Double
and single are allowed
for simulation but not for
HDL code generation.
validIn
Input
Boolean
dataOut
Output
Same as dataIn
validOut
Output
Boolean
startOut
Output
Boolean
endOut
Output
Boolean
1-763
Dialog
Box and
Parameters
Main
1-764
you use Property with vector input, the input vector width must
be less than or equal to the FFT length. When you select Auto,
the FFT length is inferred from the input vector data width. The
Auto FFT length option is not supported for scalar input. The
default is Property.
FFT length
Specify the number of data points used in one FFT calculation.
This value is used when Source of FFT length is set to
Property. The default value is 1024. The FFT length must be a
power of 2 between 23 and 216 for HDL code generation. If the
input is a vector, the width must be less than or equal to the FFT
Length.
Simulate using
Type of simulation to run. The default is Code generation. This
parameter does not affect generated HDL code.
Code generation
Simulate model using generated C code. The first time you run
a simulation, Simulink generates C code for the block. The C
code is reused for subsequent simulations. This option requires
additional startup time, but provides faster simulation speed
than Interpreted execution.
Interpreted execution
Simulate model using the MATLAB interpreter. This option
shortens startup times, but has slower simulation speeds than
Code Generation.
1-765
Data Types
1-766
Overflow Action
The overflow action for internal fixed point calculations is Wrap.
Control Ports
1-767
Algorithm
Control Signals
The validIn control signal is required for HDL code generation. It is
optional for simulation. If enabled, input data is processed only when
validIn is high. Output data is valid when validOut is high.
Timing Diagram
This diagram illustrates validIn and validOut signals for a FFT
length of 1024.
1-768
Delay
The FFT latency from start of input to start of output, assuming the
input is contiguous, is calculated from the following equation, where
N is the FFT length.
N
6 (log 2 N 2) 8
2
1-769
Performance
When generated HDL code for the default block configuration
(FFT length 1024) is synthesized into a Xilinx Virtex6
(XC6VLX75T-1FF484), the block achieves 295 MHz clock frequency. It
uses the following resources.
Resource
Uses
LUT
3219
FFS
4335
16
6
Performance of the synthesized HDL code for this block will vary with
your target and synthesis options.
1-770
Highpass Filter
Purpose
Library
Description
Dialog
Box
See Highpass Filter Design Dialog Box Main Pane on page 4-735
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
1-771
Highpass Filter
1-772
Highpass Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify. Selecting Specify
enables the Order option so you can enter the filter order. When
you set the Impulse response to IIR, you can specify different
numerator and denominator orders. To specify a different
denominator order, you must select the Denominator order
check box.
1-773
Highpass Filter
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify.
Denominator order
Select this check box to specify a different denominator order.
This option is enabled only if you set the Impulse response to
IIR and the Order mode to Specify.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
1-774
Highpass Filter
In the figure, the region between specification values Fstop and Fpass
represents the transition region where the filter response is not
constrained.
Frequency constraints
When Order mode is Specify, select the filter features that the
block uses to define the frequency response characteristics. The
list contains the following options, when available for the filter
specifications.
Stopband edge and passband edge Define the filter by
specifying the frequencies for the edges for the stop- and
passbands.
Passband edge Define the filter by specifying the edge of
the passband.
Stopband edge Define the filter by specifying the edge of
the stopband.
Stopband edge and 3 dB point For IIR filters, define the
filter by specifying the frequency of the 3 dB point in the filter
response and the edge of the stopband.
3 dB point Define the filter response by specifying the
location of the 3 dB point. The 3 dB point is the frequency for
the point three decibels below the passband value.
1-775
Highpass Filter
1-776
Highpass Filter
F6dB
When Frequency constraints is 6 dB point, specify the
frequency of the 6 dB point. Specify the value in either normalized
frequency units or the absolute units you select Frequency units.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude constraints
This option is only available when you specify the order of
your filter design. Depending on the setting of the Frequency
constraints parameter, some combination of the following
options will be available for the Magnitude constraints
parameter: Unconstrained, Passband ripple, Passband ripple
and stopband attenuation or Stopband attenuation.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
1-777
Highpass Filter
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is Equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
20 represents a reasonable trade between the accurate
approximation to the ideal filter and the time to design the
filter.
1-778
Highpass Filter
Phase constraint
Specify the phase constraint of the filter as Linear, Maximum,
or Minimum.
Minimum order
When you select this parameter, the design method
determines and design the minimum order filter to meet
your specifications. Some filters do not provide this
parameter. Select Any, Even, or Odd from the drop-down list
to direct the design to be any minimum order, or minimum
even order, or minimum odd order.
Match Exactly
Specifies that the resulting filter design matches either
the passband or stopband or both bands when you select
passband or stopband or both from the drop-down list.
Stopband Shape
Stopband shape lets you specify how the stopband changes
with increasing frequency. Choose one of the following
options:
Flat Specifies that the stopband is flat. The
attenuation does not change as the frequency increases.
Linear Specifies that the stopband attenuation
changes linearly as the frequency increases. Change the
slope of the stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in
Stopband decay.
Stopband Decay
When you set Stopband shape, Stopband decay specifies
the amount of decay applied to the stopband. the following
conditions apply to Stopband decay based on the value of
Stopband Shape:
1-779
Highpass Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
1-780
Highpass Filter
1-781
Highpass Filter
Supported
Data
Types
Port
Input
Output
1-782
Hilbert Filter
Purpose
Library
Description
Dialog
Box
See Hilbert Filter Design Dialog Box Main Pane on page 4-743 for
more information about the parameters of this block. The Data Types
and Code panes are not available for blocks in the DSP System Toolbox
Filter Designs library.
1-783
Hilbert Filter
1-784
Hilbert Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Filter order mode
Select either Minimum (the default) or Specify from the drop-down
list. Selecting Specify enables the Order option (see the
following sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
1-785
Hilbert Filter
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
1-786
Hilbert Filter
available when you select one of the frequency options from the
Frequency units list.
Transition width
Specify the width of the transitions at the ends of the passband.
Specify the value in normalized frequency units or the absolute
units you select in Frequency units.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default FIR method is Equiripple.
1-787
Hilbert Filter
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
20 represents a reasonable trade between the accurate
approximation to the ideal filter and the time to design the
filter.
FIR Type
Specify whether to design a type 3 or a type 4 FIR filter. The
filter type is defined as follows:
Type 3 FIR filter with even order antisymmetric
coefficients
Type 4 FIR filter with odd order antisymmetric
coefficients
Select either 3 or 4 from the drop-down list.
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
1-788
Hilbert Filter
filter. By default, FIR filters use Direct-form FIR, and IIR filters
use Cascade minimum-multiplier allpass.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-789
Hilbert Filter
Supported
Data
Types
Port
Input
Output
1-790
Histogram
Purpose
Library
Statistics
dspstat3
Description
The Histogram block sorts all complex input values into bins according
to their magnitude.
The histogram value for a given bin represents the frequency of
occurrence of the input values bracketed by that bin. You specify
the upper boundary of the highest-valued bin in the Upper limit of
histogram parameter, BM, and the lower boundary of the lowest-valued
bin in the Lower limit of histogram parameter, Bm. The bins have
equal width of
BM Bm
n
Bm + k +
2
k = 0, 1, 2,..., n 1
Input values that fall on the border between two bins are placed into
the lower valued bin; that is, each bin includes its upper boundary.
1-791
Histogram
Basic Operation
When the Running histogram check box is not selected, the Histogram
block computes the frequency distribution of the current input.
When you set the Find the histogram over parameter to Each
column, the Histogram block computes a histogram for each column of
the M-by-N matrix independently. The block outputs an n-by-N matrix,
where n is the Number of bins you specify. The jth column of the
output matrix contains the histogram for the data in the jth column of
the M-by-N input matrix.
When you set the Find the histogram over parameter to Entire
input, the Histogram block computes the frequency distribution for the
entire input vector, matrix or N-D array. The block outputs an n-by-1
vector, where n is the Number of bins you specify.
Running Operation
When you select the Running histogram check box, the Histogram
block computes the frequency distribution of both the past and present
data for successive inputs. The block resets the histogram (by emptying
all of the bins) when it detects a reset event at the optional Rst port. See
Resetting the Running Histogram on page 1-793 for more information
on how to trigger a reset.
When you set the Find the histogram over parameter to Each
column, the Histogram block computes a running histogram for each
column of the M-by-N matrix. The block outputs an n-by-N matrix,
where n is the Number of bins you specify. The jth column of the
1-792
Histogram
output matrix contains the running histogram for the jth column of
the M-by-N input matrix.
When you set the Find the histogram over parameter to Entire
input, the Histogram block computes a running histogram for the data
in the first dimension of the input. The block outputs an n-by-1 vector,
where n is the Number of bins you specify.
Note When the Histogram block is used in running mode and the input
data type is non-floating point, the output of the histogram is stored as
a uint32 data type. The largest number that can be represented by this
data type is 232-1. If the range of the uint32 data type is exceeded, the
output data will wrap back to 0.
1-793
Histogram
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-794
Histogram
Examples
Library
Quantity
Constant
Display
Sinks
Histogram
Statistics
The parameter settings for the Double Precision Input Constant block
are:
Constant value = double([1 2 3 4 5]')
Interpret vector parameters as 1-D = Clear this check box.
Sampling mode = Sample based
Sample time = inf
The parameter settings for the Fixed-Point Input Constant block are:
Constant value = int8([1 2 3 4 5]')
Interpret vector parameters as 1-D = Clear this check box.
Sampling mode = Sample based
1-795
Histogram
1-796
Histogram
This warning alerts you that it is not a good use case to have a
histogram where 2 or more bin boundaries are the same. As the
warning suggests, increasing the range of the limits of the histogram,
or decreasing the number of bins, can correct this problem.
1-797
Histogram
Dialog
Box
1-798
Histogram
1-799
Histogram
Note The fixed-point parameters listed are only used for fixed-point
complex inputs, which are distributed by squared magnitude.
Rounding mode
Select the rounding mode for fixed-point operations.
1-800
Histogram
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Multiplication Data
Types for illustrations depicting the use of the product output
data type. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-801
Histogram
Supported
Data
Types
Port
In
Output
Rst
See Also
1-802
Sort
hist
MATLAB
IDCT
Purpose
Library
Transforms
dspxfrm3
Description
The IDCT block computes the inverse discrete cosine transform (IDCT)
of each channel in the M-by-N input matrix, u.
y = idct(u)
When the input is a sample-based row vector, the IDCT block computes
the inverse discrete cosine transform across the vector dimension of the
input. For all other N-D input arrays, the block computes the IDCT
across the first dimension. The size of the first dimension (frame size),
must be a power of two. To work with other frame sizes, use the Pad
block to pad or truncate the frame size to a power-of-two length.
When the input is an M-by-N matrix, the block treats each input
column as an independent channel containing M consecutive samples.
The block outputs an M-by-N matrix whose lth column contains the
length-M IDCT of the corresponding input column.
y ( m, l ) =
w(k)u(k, l) cos
k=1
(2m 1)(k 1)
,
2M
m = 1,..., M
where
1
M,
w(k) =
2 ,
M
k=1
2k M
1-803
IDCT
Effect on Block
Performance
Table lookup
Trigonometric fcn
1-804
IDCT
output, and output data types displayed in the diagrams in the IDCT
block dialog as discussed in Dialog Box on page 1-807.
Inputs to the IDCT block are first cast to the output data type and
stored in the output buffer. Each butterfly stage processes signals in
the accumulator data type, with the final output of the butterfly being
cast back into the output data type.
1-805
IDCT
The output of the multiplier is in the product output data type when
at least one of the inputs to the multiplier is real. When both of the
1-806
IDCT
Dialog
Box
1-807
IDCT
1-808
IDCT
1-809
IDCT
Rounding mode
Select the rounding mode for fixed-point operations. The sine table
values do not obey this parameter; they always round to Nearest.
Overflow mode
Select the overflow mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they are always
saturated.
Sine table data type
Choose how you specify the word length of the values of the sine
table. The fraction length of the sine table values always equals
the word length minus one. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Same
The sine table values do not obey the Rounding mode and
Overflow mode parameters; instead, they are always saturated
and rounded to Nearest.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-804 and Multiplication Data Types for
illustrations depicting the use of the product output data type in
this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-810
IDCT
1-811
IDCT
Using these ideal results, the internal rule then selects word
lengths and fraction lengths that are appropriate for your
hardware. For more information, see Inherit via Internal
Rule.
An expression that evaluates to a valid data type, for example,
fixdt(1,16,0)
Supported
Data
Types
Port
Input
Output
1-812
IDCT
See Also
DCT
IFFT
idct
1-813
Identity Matrix
Purpose
Library
Sources
dspsrcs4
Description
When you do not select the Inherit output port attributes from
input port check box, the input port is disabled, and the dimensions
of the output matrix are determined by the Matrix size parameter.
A scalar value, M, specifies an M-by-M identity matrix, while a
two-element vector, [M N], specifies an M-by-N unit-diagonal matrix.
You can specify the output sample period using the Sample time
parameter.
Examples
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
1-814
Identity Matrix
Dialog
Box
The Main pane of the Identity Matrix block dialog appears as follows.
1-815
Identity Matrix
Sample time
The discrete sample period of the output. This parameter is
disabled when you select Inherit input port attributes from
input port.
The Data Types pane of the Identity Matrix block dialog appears as
follows.
1-816
Identity Matrix
the output data type and scaling matches that of the next
downstream block.
A built in data type, such as double
An expression that evaluates to a valid data type, for example,
fixdt(1,16)
Supported
Data
Types
Port
Input
Output
1-817
Identity Matrix
See Also
1-818
Constant
Simulink
eye
MATLAB
IDWT
Purpose
Library
Transforms
dspxfrm3
Description
The IDWT block is the same as the Dyadic Synthesis Filter Bank block
in the Multirate Filters library, but with different default settings.
See the Dyadic Synthesis Filter Bank block reference page for more
information on how to use the block.
1-819
IFFT
Purpose
Library
Transforms
dspxfrm3
Description
The IFFT block computes the inverse fast Fourier transform (IFFT)
of each row of a sample-based 1-by-P input vector, or across the first
dimension (P) of an N-D input array.
When you specify an FFT length not equal to the length of the input
vector, (or first dimension of the input array), the block implements
zero-padding, truncating, or modulo-M, (FFT length) data wrapping.
This occurs before the IFFT operation, as per Orfanidis [1].
y = ifft(u,M)
% P
Wrapping:
y(:,l) = ifft(datawrap(u(:,l),M))
% P > M; l = 1,...,N
Truncating:
y (:,l) = ifft(u,M)
% P > M; l = 1,...,N
When the input length, P, is greater than the FFT length, M, you
may see magnitude increases in your IFFT output. These magnitude
increases occur because the IFFT block uses modulo-M data wrapping
to preserve all available input samples.
To avoid such magnitude increases, you can truncate the length of your
input sample, P, to the FFT length, M. To do so, place a Pad block before
the IFFT block in your model.
The kth entry of the lth output channel, y(k, l), is equal to the kth point
of the M-point inverse discrete Fourier transform (IDFT) of the lth
input channel:
1-820
IFFT
y(k, l) =
1
M
u( p, l)e j 2 ( p1)(k1) / M
p=1
k = 1, , M
The output of this block has the same dimensions as the input. If
the input signal has a floating-point data type, the data type of the
output signal uses the same floating-point data type. Otherwise, the
output can be any fixed-point data type. The block computes scaled
and unscaled versions of the IFFT.
The input to this block can be floating-point or fixed-point, real or
complex, and conjugate symmetric. The block uses one of two possible
FFT implementations. You can select an implementation based on the
FFTW library [1], [2], or an implementation based on a collection of
Radix-2 algorithms. You can select Auto to allow the block to choose
the implementation.
FFTW Implementation
The FFTW implementation provides an optimized FFT calculation
including support for power-of-two and non-power-of-two transform
lengths in both simulation and code generation. Generated code
using the FFTW implementation will be restricted to MATLAB host
computers. The data type must be floating-point. Refer to Simulink
Coder for more details on generating code.
Radix-2 Implementation
The Radix-2 implementation supports bit-reversed processing, fixed or
floating-point data, and allows the block to provide portable C-code
generation using the Simulink Coder. The dimension M of the M-by-N
input matrix, must be a power of two. To work with other input sizes,
use the Pad block to pad or truncate these dimensions to powers of two,
or if possible choose the FFTW implementation.
With Radix-2 selected, the block implements one or more of the
following algorithms:
Butterfly operation
Double-signal algorithm
1-821
IFFT
Half-length algorithm
Radix-2 decimation-in-time (DIT) algorithm
Radix-2 decimation-in-frequency (DIF) algorithm
Radix-2 Algorithms for Real or Complex Input Complexity
Parameter Settings
Radix-2 DIT
1-822
2k
K
IFFT
3 N/4
fixed-point
The following diagrams show the data types used in the IFFT block for
fixed-point signals. You can set the sine table, accumulator, product
output, and output data types displayed in the diagrams in the IFFT
dialog box as discussed in Dialog Box on page 1-827.
Inputs to the IFFT block are first cast to the output data type and stored
in the output buffer. Each butterfly stage then processes signals in the
accumulator data type, with the final output of the butterfly being cast
back into the output data type. The block multiplies in a twiddle factor
before each butterfly stage in a decimation-in-time IFFT and after each
butterfly stage in a decimation-in-frequency IFFT.
1-823
IFFT
1-824
IFFT
1-825
IFFT
1-826
IFFT
Note When the block input is fixed point, all internal data types are
signed fixed point.
Dialog
Box
1-827
IFFT
1-828
IFFT
FFT implementation
Set this parameter to FFTW [1], [2] to support an arbitrary length
input signal. The block restricts generated code with FFTW
implementation to MATLAB host computers.
Set this parameter to Radix-2 for bit-reversed processing, fixed
or floating-point data, or for portable C-code generation using the
Simulink Coder. The dimension M of the M-by-N input matrix,
must be a power of two. To work with other input sizes, use the
Pad block to pad or truncate these dimensions to powers of two,
or if possible choose the FFTW implementation. See Radix-2
Implementation on page 1-821.
Set this parameter to Auto to let the block choose the FFT
implementation. For non-power-of-two transform lengths, the
block restricts generated code to MATLAB host computers.
Input is in bit-reversed order
Select or clear this check box to designate the order of the input
channel elements. Select this check box when the input should
appear in reversed order, and clear it when the input should
appear in linear order. The block yields invalid outputs when you
do not set this parameter correctly. This check box only appears
when you set the FFT implementation parameter to Radix-2
or Auto.
You cannot select this check box if you have cleared the Inherit
FFT length from input dimensions check box, and you are
specifying the FFT length using the FFT length parameter. Also,
it cannot be selected when you set the FFT implementation
parameter to FFTW.
For more information on ordering of the output, see Linear and
Bit-Reversed Output Order.
1-829
IFFT
M y(k, l) =
u( p, l)e j 2 ( p1)(k1) / M
k = 1,..., M
p=1
1-830
IFFT
1-831
IFFT
1-832
IFFT
Rounding mode
Select the rounding mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they always
round to Nearest.
Overflow mode
Select the overflow mode for fixed-point operations. The sine
table values do not obey this parameter; instead, they are always
saturated.
Sine table data type
Choose how you specify the word length of the values of the sine
table. The fraction length of the sine table values always equals
the word length minus one. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Same
The sine table values do not obey the Rounding mode and
Overflow mode parameters; instead, they are always saturated
and rounded to Nearest.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-825 and Multiplication Data Types for
illustrations depicting the use of the product output data type in
this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-833
IFFT
1-834
IFFT
to
Click the Show data type assistant button
display the Data Type Assistant, which helps you set the
Output data type parameter.
See Specify Block Output Data Types in Simulink Users Guide
for more information.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Examples
References
1-835
IFFT
Supported
Data
Types
Port
Input
Output
See Also
1-836
FFT
IDCT
Pad
bitrevorder
fft
MATLAB
ifft
MATLAB
Inherit Complexity
Purpose
Library
Description
The Inherit Complexity block alters the input data at the Data port to
match the complexity of the reference input at the Ref port. When the
Data input is real, and the Ref input is complex, the block appends a
zero-valued imaginary component, 0i, to each element of the Data input.
When the Data input is complex, and the Ref input is real, the block
outputs the real component of the Data input.
When both the Data input and Ref input are real, or when both the
Data input and Ref input are complex, the block propagates the Data
input with no change.
1-837
Inherit Complexity
Dialog
Box
Supported
Data
Types
Port
Data
Ref
1-838
Inherit Complexity
Port
Output
See Also
Check Signal
Attributes
Complex to
Magnitude-Angle
Simulink
Complex to
Real-Imag
Simulink
Magnitude-Angle to
Complex
Simulink
Real-Imag to
Complex
Simulink
1-839
Purpose
Library
dspobslib
Description
Note The Integer Delay block will be removed from the product in a
future release. We strongly recommend replacing this block with the
Delay block.
The Integer Delay block delays a discrete-time input by the number of
sample intervals specified in the Delay parameter. Noninteger delay
values are rounded to the nearest integer, and negative delays are
clipped at 0.
Sample-Based Operation
When the input is a sample-based M-by-N matrix, the block treats
each of the M*N matrix elements as an independent channel. The
Delay parameter, v, can be an M-by-N matrix of positive integers that
specifies the number of sample intervals to delay each channel of the
input, or a scalar integer by which to equally delay all channels.
For example, when the input is M-by-1 and v is the matrix [v(1) v(2)
v(M)]', the first channel is delayed by v(1) sample intervals, the
second channel is delayed by v(2) sample intervals, and so on. Note
that when a channel is delayed for sample-time units, the output
sample at time t is the input sample at time t . When t is
negative, then the output is the corresponding value specified by the
Initial conditions parameter.
...
1-840
1 1
1
,
1
2
u11
1
u12
,
1
3
u11
u121
2
u12
,
1
4
u11
2
u21
3
u12
, ...
u122
where uijk is the i,jth element of the kth matrix in the input sequence.
Array of size M-by-N-by-d. In this case, you can set different fixed
initial conditions for each element of a sample-based input. This
setting is explained further in the Array bullet in Time-Varying
Initial Conditions on page 1-841.
Initial conditions cannot be specified by full matrices.
1-841
at the start
1 2 3
4 5 6 ,
2 4 6
1 3 5 ,
3 6 9
0 4 8
1-842
Frame-Based Operation
When the input is a frame-based M-by-N matrix, the block treats each
of the N columns as an independent channel, and delays each channel
as specified by the Delay parameter.
For frame-based inputs, the Delay parameter can be a scalar integer
by which to equally delay all channels. It can also be a 1-by-N row
vector, each element of which serves as the delay for the corresponding
channel of the N-channel input. Likewise, it can also be an M-by-1
column vector, each element of which serves as the delay for one of
the corresponding M samples for each channel. The Delay parameter
can be an M-by-N matrix of positive integers as well; in this case, each
element of each channel is delayed by the corresponding element in the
delay matrix. For instance, if the fifth element of the third column of
the delay matrix was 3, then the fifth element of the third channel of
the input matrix is always delayed by three sample-time units.
When a channel is delayed for sample-time units, the output sample
at time t is the input sample at time t . When t is negative,
then the output is the corresponding value specified in the Initial
conditions parameter.
The Initial conditions parameter specifies the output during the
initial delay. Both fixed and time-varying initial conditions can be
specified. The initial delay for a particular channel is the time elapsed
from the start of the simulation until the first input in that channel is
propagated to the output.
1-843
the first five samples in each of the N channels are zero. Notice that
when the frame size is larger than the delay, all of these zeros are all
included in the first output from the block.
Array of size 1-by-N-by-D. In this case, you can also specify different
fixed initial conditions for each channel. See Time-Varying Initial
Conditions on page 1-844 for details.
Initial conditions cannot be specified by full matrices.
When an element of the delay entry is less than the frame size,
D=d+1
where d is the maximum delay.
When the all elements of the delay entry are greater than the
input frame size,
D = d + input frame size - 1
Only the first d entries of the initial condition vector are used;
the rest of the values are ignored, but you must include them
nonetheless. For a two-channel ramp input [1:100; 1:100]' with a
frame size of 4 and the parameter settings below,
1-844
-4
-5
-1
-2
,
-3
-4
3
4
-5
1
,
2
7
8
10
, ...
7
4
5
6
Note that since one of the delays, 2, is less than the frame size of the
input, 4, the length of the Initial conditions vector is the sum of the
maximum delay and 1 (5+1), which is 6. The first five entries of the
initial conditions vector are used by the channel with the maximum
delay, and the rest of the entries are ignored. Since the first channel
is delayed for less than the maximum delay (2 sample time units), it
only makes use of two of the initial condition entries.
Array of size 1-by-N-by-D, where D is defined in Time-Varying
Initial Conditions on page 1-844. In this case, the kth entry of each
1-by-N entry in the array corresponds to an initial condition for
the kth channel of the input matrix. Thus, a 1-by-N-by-D initial
conditions input allows you to specify different initial conditions for
each channel. For instance, for a two-channel ramp input [1:100;
1:100]' with a frame size of 4 and the parameter settings below,
1-845
-1
-3
-5
-7
-2
-4
,
-6
-8
9
1
2
3
10
1
,
2
4
5
4
5
, ...
6
Note that the channels have distinct time varying initial conditions;
the initial conditions for channel 1 correspond to the first entry of
each length-2 row vector in the initial conditions array, and the
initial conditions for channel 2 correspond to the second entry of each
row vector in the initial conditions array. Only the first five entries
in the initial conditions array are used; the rest are ignored.
The 1-by-N-by-D array entry can also specify different fixed initial
conditions for every channel; in this case, every 1-by-N entry in
the array would be identical, so that the initial conditions for each
column are fixed over time.
Initial conditions cannot be specified by full matrices.
1-846
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-847
Examples
Dialog
Box
Delay
The number of sample periods to delay the input signal.
Initial conditions
The value of the blocks output during the initial delay.
1-848
Reset port
Determines the reset event that causes the block to reset the
delay. For more information, see Resetting the Delay on page
1-846.
Supported
Data
Types
See Also
Unit Delay
Simulink
1-849
Interpolation
Purpose
Library
Signal Operations
dspsigops
Description
1-850
Interpolation
port. The block uses the input to this port as the interpolation points.
To learn about interpolation arrays, see How the Block Applies
Interpolation Arrays to Inputs on page 1-851.
1-851
Interpolation
Valid values in the interpolation array, IPts, range from 1 to the number
of samples in each channel of the input. To learn how the block
handles out of range interpolation values, see Handling Out-of-Range
Interpolation Points on page 1-857.
Depending on the dimension and frame status of the input and the
dimension of IPts, the block usually applies IPts to the input in one of
the following ways:
Applies the IPts array across the first dimension of a sample-based
N-D array or frame-based matrix input, resulting in a sample-based
N-D array or frame-based matrix output.
Applies the vector IPts to each input vector (as if the input vector
were a single channel), resulting in a vector output with the same
orientation as the input (row or column).
The following tables summarize how the block applies the interpolation
array IPts to all the possible types of sample- and frame-based inputs,
and show the resulting output dimensions.
The first table describes the blocks behavior when the Source of
interpolation points is Specify via dialog and the input is sample
based.
Input
Dimensions
(Sample
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Sample
Based)
N-D Array
1-by-P row
(ex.
M-by-N-by-Q)
P-by-1 column
Applies IPts
to the first
dimension of
the input array
P-by-N-by-Q
array
P-by-N-by-Q
array
1-852
Applies the
columns of
IPts to the
corresponding
Interpolation
Input
Dimensions
(Sample
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Sample
Based)
columns of the
input array
M-by-1 column
1-by-P row
(block treats In
as a column)
Applies IPts
to the input
column
P-by-1 column
Applies In to the
input row
1-by-P row
P-by-1 column
1-by-N row
1-by-P row
P-by-1 column
(block treats
IPts as a row)
The next table describes the blocks behavior when the Source of
interpolation points is Specify via dialog and the input is frame
based.
Input
Dimensions
(Frame
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Frame
Based)
M-by-N matrix
1-by-N row
Applies each
column of IPts
(each element
of IPts) to the
corresponding
column of the
input matrix
1-by-N row
1-853
Interpolation
Input
Dimensions
(Frame
Based)
M-by-1 column
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Frame
Based)
P-by-1 column
Applies IPts
to each input
column
P-by-N matrix
P-by-N matrix
Applies the
columns of
IPts to the
corresponding
columns of the
input matrix
1-by-P row
Applies IPts
to the input
column
P-by-1 column
Not Applicable.
Block copies
input vector
1-by-N row,
a copy of the
input vector
1-by-N row
P-by-1 column
P-by-N matrix
P-by-N matrix
where each row
is a copy of the
input vector
The next table describes the blocks behavior when the Source of
interpolation points is Input port and the input is sample based.
1-854
Interpolation
Input
Dimensions
(Sample
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Sample
Based)
N-D Array
Sample-based
1-by-P row
Applies IPts
to the first
dimension of
the input array
P-by-N-by-Q
array
(ex.
M-by-N-by-Q)
M-by-1 column
Sample- or
frame-based
P-by-1 column
Sample-based
P-by-N-by-Q
array
Applies the
columns of
IPts to the
corresponding
columns of the
input array
Sample-based
1-by-P row
Applies IPts
to the input
column
P-by-1 column
Applies IPts to
the input row
1-by-P row
Sample- or
frame-based
P-by-1 column
1-by-N row
Sample-based
1-by-P row
Sample or
frame-based
P-by-1 column
The next table describes the blocks behavior when the Source of
interpolation points is Input port and the input is frame based.
1-855
Interpolation
Input
Dimensions
(Frame
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Frame
Based)
M-by-N matrix
Frame-based
1-by-N row
Applies each
column of IPts
(each element
of IPts) to the
corresponding
column of the
input matrix
1-by-N row
Sample-based
1-by-P row
Applies IPts
to each input
column
P-by-N matrix
Frame- or
sample-based
P-by-1 column
M-by-1 column
Frame- or
sample-based
P-by-N matrix
Applies the
columns of
IPts to the
corresponding
columns of the
input matrix
Sample-based
1-by-P row
Applies IPts
to the input
column
Frame- or
sample-based
P-by-1 column
1-856
P-by-1 column
Interpolation
Input
Dimensions
(Frame
Based)
Valid
Dimensions of
Interpolation
Array IPts
How Block
Applies IPts to
Input
Output
Dimensions
(Frame
Based)
1-by-N row
Frame-based
1-by-N row
Not Applicable.
Block copies
input vector
1-by-N row,
a copy of the
input vector
(not
recommended)
Sample-based
1-by-P row
Frame- or
sample-based
P-by-1 column
P-by-N matrix
where each row
is a copy of the
input vector
Frame- or
sample-based
P-by-N matrix
1-857
Interpolation
Example of Clipping
Suppose the block is set to clip out-of-range interpolation points, and
gets the following input vector and interpolation points:
D = [11 22 33 44]'
IPts = [10 2.6 -3]'
Because D has four samples, valid interpolation points range from 1 to
4. The block clips the interpolation point 10 to 4 and the point -3 to 1,
resulting in the clipped interpolation vector IPtsClipped = [4 2.6 1]'.
1-858
Interpolation
D = [1 2 1.5 3 0.25]
Ipts = [-4 2.7 4.3 10]
Valid interpolation points range
from 1 to 5, so -4 is clipped to 1
and 10 is clipped to 5.
Clipped Ipts = [1 2.7 4.3 5]
Output = [1 1.65 2.175 0.25]
1-859
Interpolation
Dialog
Box
1-860
Interpolation
Interpolation points
The array of points in time at which to interpolate the input signal
(IPts). An entry of 1 in IPts refers to the first sample of the input,
an entry of 2.5 refers to the sample half-way between the second
and third input sample, and so on. See How the Block Applies
Interpolation Arrays to Inputs on page 1-851. Tunable.
Interpolation mode
Sets the block to interpolate by either linear or FIR interpolation.
For more information, see Linear Interpolation Mode on page
1-858 and FIR Interpolation Mode on page 1-859.
Interpolation filter half-length
Specify the half-length of the FIR interpolation filter (P). To
perform the interpolation in FIR mode, the block uses the nearest
2*P low-rate samples. In most cases, P low-rate samples must
appear below and above each interpolation point. However, if you
interpolate at a low-rate sample point, the block includes that
low-rate sample in the required 2*P samples and requires only
2*P1 neighboring low-rate samples. If an interpolation point does
not have the required number of neighboring low-rate samples,
the block interpolates that point using linear interpolation.
This parameter becomes available only when the Interpolation
mode is set to FIR. For more information, see FIR Interpolation
Mode on page 1-859.
Interpolation points per input sample
Also known as the upsampling factor, this parameter defines
the number of points per input sample (L) at which the block
computes a unique FIR interpolation filter. To perform the FIR
Interpolation, the block uses a polyphase structure with L filter
arms of length 2*P.
For example, if L=4, the block constructs a polyphase filter with
four arms. The block then interpolates at points corresponding
to 1 +i/L, 2 +i/L, 3 +i/L..., where the integers 1, 2, and 3 represent
the low-rate samples, and i=0,1,2,3. To interpolate at a point
1-861
Interpolation
1-862
Interpolation
Supported
Data
Types
Port
In
Pts
Out
1-863
Purpose
Library
Transforms
dspxfrm3
Description
x [ n] =
L
W (0)
1
N
p=
N 1
k =0
X [ pL, k] e j 2kn / N
Examples
1-864
The dspstsa example illustrates how to use the Short-Time FFT and
Inverse Short-Time FFT blocks to remove the background noise from
a speech signal.
Dialog
Box
1-865
References
1-866
Supported
Data
Types
Port
X(n,k)
w(n)
x(n)
See Also
Burg Method
Magnitude FFT
Periodogram
Short-Time FFT
Spectrum Analyzer
Window Function
Yule-Walker Method
pwelch
1-867
Purpose
Library
Description
Dialog
Box
See Inverse Sinc Filter Design Dialog Box Main Pane on page 4-749
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
1-868
1-869
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Order mode
Select either Minimum (the default) or Specify from the drop-down
list. Selecting Specify enables the Order option (see the
following sections) so you can enter the filter order.
Response type
Select Lowpass or Highpass to design an inverse sinc lowpass
or highpass filter.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
1-870
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve.
Regions between specification values such as Fpass and Fstop
represent transition regions where the filter response is not constrained.
Frequency constraints
When Order mode is Specify, select the filter features that the
block uses to define the frequency response characteristics. The
list contains the following options, when available for the filter
specifications.
Passband and stopband edges Define the filter by
specifying the frequencies for the edges for the stop- and
passbands.
Passband edges For IIR filters, define the filter by
specifying frequencies for the edges of the passband.
Stopband edges For IIR filters, define the filter by
specifying frequencies for the edges of the stopbands.
6 dB point For FIR filters, define the filter response by
specifying the locations of the 6 dB point. The 6 dB point is the
frequency for the point six decibels below the passband value.
1-871
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select in Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select in Frequency units.
F6dB
When Frequency constraints is 6 dB point, specify the
frequency of the 6 dB point. Specify the value in either normalized
frequency units or the absolute units you select Frequency units.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
1-872
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default FIR method is Equiripple.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
1-873
1-874
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
1-875
1-876
Rate options
When the Filter type parameter specifies a multirate filter,
select the rate processing rule for the block from following options:
Enforce single-rate processing When you select this
option, the block maintains the sample rate of the input.
Allow multirate processing When you select this option,
the block adjusts the rate at the output to accommodate an
increased or reduced number of samples. To select this option,
you must set the Input processing parameter to Elements as
channels (sample based).
Use symbolic names for coefficients
Select this check box to enable the specification of coefficients
using MATLAB variables. The available coefficient names differ
depending on the filter structure. Using symbolic names allows
tuning of filter coefficients in generated code. By default, this
check box is cleared.
Supported
Data
Types
Port
Input
Output
1-877
Purpose
Library
dspobslib
Description
Note The Kalman Adaptive Filter block is still supported but is likely
to be obsoleted in a future release. We strongly recommend replacing
this block with the Kalman Filter block.
The Kalman Adaptive Filter block computes the optimal linear
minimum mean-square estimate (MMSE) of the FIR filter coefficients
using a one-step predictor algorithm. This Kalman filter algorithm is
based on the following physical realization of a dynamic system.
1-878
g(n) =
K (n 1)u(n)
H
u (n) K (n 1)u(n) + QM
y(n) = u H (n)w(n)
e(n) = d(n) y(n)
w(n + 1) = w(n) + e(n) g(n)
K (n) = K (n 1) g(n)u H (n) K (n 1) + Q p
The variables are as follows
Variable
Description
u(n)
K(n)
g(n)
w(n)
y(n)
e(n)
d(n)
QM
QP
1-879
Corresponding Variables
In
Out
Err
Taps
An optional Adapt input port is added when you select the Adapt
port check box in the dialog. When this port is enabled, the block
continuously adapts the filter coefficients while the Adapt input is
nonzero. A zero-valued input to the Adapt port causes the block to stop
adapting, and to hold the filter coefficients at their current values until
the next nonzero Adapt input.
The FIR filter length parameter specifies the length of the filter that
the Kalman algorithm estimates. The Measurement noise variance
and the Process noise variance parameters specify the correlation
matrices of the measurement and process noise, respectively. The
Measurement noise variance must be a scalar, while the Process
noise variance can be a vector of values to be placed along the
diagonal, or a scalar to be repeated for the diagonal elements.
The Initial value of filter taps specifies the initial value w ( 0 ) as a
vector, or as a scalar to be repeated for all vector elements. The Initial
1-880
error correlation matrix specifies the initial value K(0), and can be a
diagonal matrix, a vector of values to be placed along the diagonal, or a
scalar to be repeated for the diagonal elements.
Dialog
Box
1-881
References
Supported
Data
Types
See Also
1-882
Kalman Filter
Purpose
Library
Filtering/Adaptive Filters
dspadpt3
Description
xk = Axk1 + wk1
zk = Hxk + vk
This block can use the previously estimated state, x k1 , to predict the
current state at time k, xk , as shown by the following equation:
xk = Ax k1
Pk = APk1 AT + Q
The block can also use the current measurement, zk , and the predicted
state, xk , to estimate the current state value at time k, x k , so that it is
a more accurate approximation:
(
)
x k = xk + K k ( zk Hxk )
K k = Pk H T HPk H T + R
Pk = ( I K k H ) Pk
The variables in the previous equations are defined in the following
table.
1-883
Kalman Filter
Variable
Definition
State
N/A
Estimated state
zeros([6, 1])
Predicted state
N/A
x
A
1
0
0
0
0
w
Process noise
N/A
Measurement
N/A
Measurement matrix
1
0
0
v
0 0 0 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 0 1
Measurement noise
N/A
10*eye(6)
P-
N/A
0.05*eye(6)
Kalman gain
N/A
1-884
0 1 0 0 0
1 0 1 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
Kalman Filter
Variable
Definition
Measurement noise
covariance
eye(4)
Identity matrix
N/A
1-885
Kalman Filter
box. If you select Input port <H>, the H port appears on the block. Use
this port to specify your measurement matrix.
See the Radar Tracking example for a demonstration of how to use this
block. You can open this example by typing
aero_radmod_dsp
1-886
Kalman Filter
Dialog
Box
The Kalman Filter dialog box appears as shown in the following figure.
Number of filters
Specify the number of filters to use to predict or estimate the
current value.
1-887
Kalman Filter
Enable filters
Specify which filters are enabled or disabled at each time step. If
you select Always, the filters are always enabled. If you choose
Specify via input port <Enable>, the Enable port appears on
the block.
Reset the estimated state and estimated error covariance when
filters are disabled
If you select this check box, the estimated and predicted states
as well as the estimated error covariance that correspond to the
disabled filters are reset to their initial values. This parameter is
visible if, for the Enable filters parameter, you select Specify
via input port <Enable>.
Initial condition for estimated state
Enter the initial condition for the estimated state.
Initial condition for estimated error covariance
Enter the initial condition for the estimated error covariance.
State transition matrix
Enter the state transition matrix.
Process noise covariance
Enter the process noise covariance.
Measurement matrix source
Specify how to enter the measurement matrix values. If you select
Specify via dialog, the Measurement matrix parameter
appears in the dialog box. If you select Input port <H>, the H
port appears on the block.
Measurement matrix
Enter the measurement matrix values. This parameter is visible
if you select Specify via dialog for the Measurement matrix
source parameter.
Measurement noise covariance
Enter the measurement noise covariance.
1-888
Kalman Filter
References
[1] Haykin, Simon. Adaptive Filter Theory. Upper Saddle River, NJ:
Prentice Hall, 1996.
[2] Welch, Greg and Gary Bishop, An Introduction to the Kalman
Filter, TR 95041, Department of Computer Science, University of
North Carolina.
1-889
Kalman Filter
Supported
Data
Types
Port
Input/Output
Double-precision
floating point
Double-precision
floating point
Enable
Single-precision
floating point
Single-precision
floating point
Boolean
1-890
Same as Z port
Z_est
M-by-N estimated
measurement matrix where
M is the length of the
measurement vector and N
is the number of filters.
Same as Z port
X_est
Same as Z port
Kalman Filter
See Also
Port
Input/Output
MSE_est
Same as Z port
Z_prd
M-by-N predicted
measurement matrix where
M is the length of the
measurement vector and N
is the number of filters.
Same as Z port
X_prd
Same as Z port
MSE_prd
Same as Z port
LDL Solver
1-891
LDL Factorization
Purpose
Library
Description
S = LDL*
where L is a lower triangular square matrix with unity diagonal
elements, D is a diagonal matrix, and L* is the Hermitian (complex
conjugate) transpose of L. Only the diagonal and lower triangle of the
input matrix are used, and any imaginary component of the diagonal
entries is disregarded.
The blocks output is a composite matrix with lower triangle elements lij
from L, diagonal elements dij from D, and upper triangle elements uij
from L*. The output format is shown below for a 5-by-5 matrix.
1-892
LDL Factorization
You can set the intermediate product, product output, accumulator, and
output data types in the block dialog as discussed below.
The output of the second multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Examples
1-893
LDL Factorization
Dialog
Box
The Main pane of the LDL Factorization block dialog appears as follows.
1-894
LDL Factorization
1-895
LDL Factorization
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
1-896
LDL Factorization
Intermediate product
Specify the intermediate product data type. As shown in
Fixed-Point Data Types on page 1-893, the output of the
multiplier is cast to the intermediate product data type before the
next element of the input is multiplied into it. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
1-897
LDL Factorization
Same
as input
1-898
LDL Factorization
References
Supported
Data
Types
Port
LDL'
See Also
Cholesky
Factorization
LDL Inverse
LDL Solver
LU Factorization
QR Factorization
1-899
LDL Inverse
Purpose
Library
Description
The LDL Inverse block computes the inverse of the Hermitian positive
definite input matrix S by performing an LDL factorization.
S 1 = LDL*
1-900
LDL Inverse
Dialog
Box
References
Supported
Data
Types
See Also
Cholesky Inverse
LDL Factorization
LDL Solver
LU Inverse
1-901
LDL Inverse
Pseudoinverse
inv
MATLAB
1-902
LDL Solver
Purpose
Library
Description
The LDL Solver block solves the linear system SX=B by applying
LDL factorization to the matrix at the S port, which must be square
(M-by-M) and Hermitian positive definite. Only the diagonal and lower
triangle of the matrix are used, and any imaginary component of the
diagonal entries is disregarded. The input to the B port is the right side
M-by-N matrix, B. The M-by-N output matrix X is the unique solution
of the equations.
A length-M unoriented vector input for right side B is treated as an
M-by-1 matrix.
When the input is not positive definite, the block reacts with the
behavior specified by the Non-positive definite input parameter.
The following options are available:
Ignore Proceed with the computation and do not issue an alert.
The output is not a valid solution.
Warning Proceed with the computation and display a warning
message in the MATLAB Command Window. The output is not a
valid solution.
Error Display an error dialog and terminate the simulation.
Note The Non-positive definite input parameter is a diagnostic
parameter. Like all diagnostic parameters on the Configuration
Parameters dialog, it is set to Ignore in the code generated for this
block by Simulink Coder code generation software.
Algorithm
1-903
LDL Solver
S = LDL*
where L is a lower triangular square matrix with unity diagonal
elements, D is a diagonal matrix, and L* is the Hermitian (complex
conjugate) transpose of L.
The equation
LDL*X = B
is solved for X by the following steps:
1 Substitute
Y = DL*X
2 Substitute
Z = L *X
3 Solve one diagonal and two triangular systems.
LY = B
DZ = Y
L *X = Z
1-904
LDL Solver
Dialog
Box
Supported
Data
Types
See Also
Autocorrelation LPC
Cholesky Solver
LDL Factorization
LDL Inverse
Levinson-Durbin
LU Solver
QR Solver
1-905
Purpose
Library
dspobslib
Description
Note The Least Squares FIR Filter Design block is still supported but
is likely to be obsoleted in a future release. We strongly recommend
replacing this block with the Digital Filter block.
The Least Squares FIR Filter Design block designs an FIR filter and
applies it to a discrete-time input using the Direct Form II Transpose
Filter block. The filter design uses the Signal Processing Toolbox firls
function to minimize the integral of the squared error between the
desired frequency response and the actual frequency response.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
The Filter type parameter allows you to specify one of the following
filters:
Multiband The Multiband filter designs a linear-phase filter with
an arbitrary magnitude response.
Differentiator The Differentiator filter approximates the
ideal differentiator. Differentiators are antisymmetric FIR filters
with approximately linear magnitude responses. To obtain the
correct derivative, scale the Gains at these frequencies vector by
Fs rad/s, where Fs is the sample frequency in Hertz.
1-906
1-907
Examples
Example 1: Multiband
Consider a lowpass filter with a transition band in the normalized
frequency range 0.4 to 0.5, and 10 times more error minimization in the
stopband than the passband. In this case,
Filter type = Multiband
Band-edge frequency vector = [0 0.4 0.5 1]
Gains at these frequencies = [1 1 0 0]
Weights = [1 10]
Example 2: Differentiator
Assume the specifications for a differentiator filter require it to have
order 21. The ramp response extends over the entire frequency range.
In this case, specify:
Filter type = Differentiator
Filter order = 21
1-908
1-909
Dialog
Box
Filter type
The filter type. Tunable.
Filter order
The filter order.
Band-edge frequency vector
A vector of frequency points, in ascending order, in the range 0
to 1. The value 1 corresponds to half the sample frequency. This
vector must have even length. Tunable.
Gains at these frequencies
A vector of frequency-response amplitudes corresponding to the
points in the Band-edge frequency vector. This vector must be
the same length as the Band-edge frequency vector. Tunable.
1-910
Weights
A vector containing one weight for each frequency band. This
vector must be half the length of the Band-edge frequency
vector and Gains at these frequencies vectors. Tunable.
References
1-911
Purpose
Library
Description
The Least Squares Polynomial Fit block computes the coefficients of the
nth order polynomial that best fits the input data in the least-squares
sense, where you specify n in the Polynomial order parameter. A
distinct set of n+1 coefficients is computed for each column of the
M-by-N input, u.
For a given input column, the block computes the set of coefficients, c1,
c2, ..., cn+1, that minimizes the quantity
M
(ui u i )2
i=1
i = f ( x ) = c x n + c x n1 + ... + c
u
1 i
2 i
i
n+1
The values of the independent variable, x1, x2, ..., xM, are specified as
a length-M vector by the Control points parameter. The same M
control points are used for all N polynomial fits, and can be equally or
unequally spaced. The equivalent MATLAB code is shown below.
c = polyfit(x,u,n)
1-912
Examples
y = 2u2 + 3
to generate four values of dependent variable y from four values of
independent variable u, received at the top port. The polynomial
coefficients are supplied in the vector [-2 0 3] at the bottom port.
Note that the coefficient of the first-order term is zero.
1-913
Dialog
Box
Control points
The values of the independent variable to which the data in each
input column correspond. For an M-by-N input, this parameter
must be a length-M vector. Tunable.
Polynomial order
The order, n, of the polynomial to be used in constructing the best
fit. The number of coefficients is n+1.
Supported
Data
Types
See Also
1-914
Detrend
Polynomial Evaluation
polyfit
MATLAB
Levinson-Durbin
Purpose
Library
Description
r(1)
r * (2)
r(2)
r(1)
r(n) r(n 1)
r * (n 1) a(3) = r(3)
The input to the block, r = [r(1) r(2) ... r(n+1)], can be a vector
or a matrix. If the input is a matrix, the block treats each column as
an independent channel and solves it separately. Each channel of the
input contains lags 0 through n of an autocorrelation sequence, which
appear in the matrix R.
The block can output the polynomial coefficients, A, the reflection
coefficients, K, and the prediction error power, P, in various
combinations. The Output(s) parameter allows you to enable the A and
K outputs by selecting one of the following settings:
A For each channel, port A outputs A=[1 a(2) a(3) ...
a(n+1)], the solution to the Levinson-Durbin equation. A has the
same dimension as the input. You can also view the elements of each
1-915
Levinson-Durbin
Applications
One application of the Levinson-Durbin formulation implemented by
this block is in the Yule-Walker AR problem, which concerns modeling
an unknown system as an autoregressive process. You would model
such a process as the output of an all-pole IIR filter with white Gaussian
noise input. In the Yule-Walker problem, the use of the signals
autocorrelation sequence to obtain an optimal estimate leads to an Ra
= b equation of the type shown above, which is most efficiently solved
by Levinson-Durbin recursion. In this case, the input to the block
1-916
Levinson-Durbin
H ( z) =
P:
G
G
=
1
A( z) 1 + a(2) z + ... + a(n + 1) z n
{ai }
2
N
E xn ai xni
i=1
1-917
Levinson-Durbin
K j +1 = value in accumulator / Pj
The block then updates the prediction error power P according to
Pj +1 = Pj Pj K j +1 conj K j +1
1-918
Levinson-Durbin
The next diagram displays the fixed-point data types used in this
calculation:
This diagram displays the fixed-point data types used in this calculation:
Algorithm
The algorithm requires O(n2) operations for each input channel. This
implementation is therefore much more efficient for large n than
1-919
Levinson-Durbin
Dialog
Box
1-920
Levinson-Durbin
Output(s)
Specify the solution representation of Ra = b to output: model
coefficients (A), reflection coefficients (K), or both (A and K). When
the input is a scalar or row vector, you must set this parameter
to A.
Output prediction error power (P)
Select to output the prediction error at port P.
If the value of lag 0 is zero, A=[1 zeros], K=[zeros], P=0
When you select this check box and the first element of the
input, r(1), is zero, the block outputs the following vectors, as
appropriate:
A = [1 zeros(1,n)]
K = [zeros(1,n)]
P = 0
When you clear this check box, the block outputs a vector of NaNs
for each channel whose r(1) element is zero.
The Data Types pane of the Levinson-Durbin block dialog box appears
as follows.
1-921
Levinson-Durbin
1-922
Levinson-Durbin
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-918 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
Same
as input
1-923
Levinson-Durbin
Same
as input
1-924
Levinson-Durbin
References
1-925
Levinson-Durbin
Supported
Data
Types
See Also
Cholesky Solver
LDL Solver
Autocorrelation LPC
LU Solver
QR Solver
Yule-Walker AR Estimator
Yule-Walker Method
levinson
1-926
Purpose
Compute filter estimates for input using LMS adaptive filter algorithm
Library
dspobslib
Description
Note The LMS Adaptive Filter block is still supported but is likely to
be obsoleted in a future release. We strongly recommend replacing this
block with the LMS Filter block.
The LMS Adaptive Filter block implements an adaptive FIR filter
using the stochastic gradient algorithm known as the normalized least
mean-square (LMS) algorithm.
H
y(n) = w ( n 1) u(n)
e(n) = d(n) y(n)
w ( n ) = w ( n 1) +
u(n)
H
a + u (n)u(n)
e* (n)
1-927
Description
u(n)
w(n)
y(n)
e(n)
d(n)
Corresponding Variables
In
Out
Err
Taps
1-928
An optional Adapt input port is added when you select the Adapt
input check box in the dialog. When this port is enabled, the block
continuously adapts the filter coefficients while the Adapt input is
nonzero. A zero-valued input to the Adapt port causes the block to stop
adapting, and to hold the filter coefficients at their current values until
the next nonzero Adapt input.
The FIR filter length parameter specifies the length of the filter that
the LMS algorithm estimates. The Step size parameter corresponds
to in the equations. Typically, for convergence in the mean square,
must be greater than 0 and less than 2. The Initial value of filter
taps specifies the initial value w ( 0 ) as a vector, or as a scalar to be
repeated for all vector elements. The Leakage factor specifies the
value of the leakage factor, 1 , in the leaky LMS algorithm below.
This parameter must be between 0 and 1.
w(n + 1) = (1 )w(n) +
Examples
u(n)
H
u (n)u(n)
e* (n)
1-929
Dialog
Box
1-930
Adapt input
Enables the Adapt port when selected.
References
Supported
Data
Types
See Also
1-931
LMS Filter
Purpose
Library
Description
The LMS Filter block can implement an adaptive FIR filter using
five different algorithms. The block estimates the filter weights, or
coefficients, needed to minimize the error, e(n), between the output
signal y(n) and the desired signal, d(n). Connect the signal you want
to filter to the Input port. The input signal can be a scalar or a column
vector. Connect the desired signal to the Desired port. The desired
signal must have the same data type, complexity, and dimensions as
the input signal. The Output port outputs the filtered input signal,
which is the estimate of the desired signal. The Error port outputs the
result of subtracting the output signal from the desired signal.
When you select LMS for the Algorithm parameter, the block calculates
the filter weights using the least mean-square (LMS) algorithm. This
algorithm is defined by the following equations.
y(n) w T (n 1)u(n)
e(n) d(n) y(n)
w(n) w(n 1) f (u(n), e(n), )
The various LMS adaptive filter algorithms available in this block are
defined as:
LMS:
1-932
LMS Filter
u (n)
+ u H (n)u(n)
Sign-Error LMS:
Description
u(n)
u*(n)
w(n)
y(n)
e(n)
1-933
LMS Filter
Variable
Description
d(n)
1-934
LMS Filter
From the Reset port list, select None to disable the Reset port. To
enable the Reset port, select one of the following from the Reset port
list:
Rising edge Triggers a reset operation when the Reset input
does one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
1-935
LMS Filter
Falling edge
Falling edge
Falling edge
Falling edge
Definition
Input vector
Step size
Error
Q
Quotient, Q =
1-936
e
uu
LMS Filter
Variable
Definition
Product uu
Accumulator uu
Product Wu
Accumulator Wu
Product e
Product Q u
1-937
LMS Filter
MULTIPLIER
CAST
product (uu)
data type
input
data type
ADDER
accumulator
(uu) data type
accumulator
(uu) data type
Convolution
z-1
input
data type
MULTIPLIER
weight
data type
CAST
product
(Wu)
data type
1-938
error signal
data type
ADDER
accumulator (Wu)
data type
CAST
accumulator (Wu)
data type
output
data type
(same as
input signal
data type)
LMS Filter
Product of step size and error (for LMS and Sign-Data LMS algorithms only)
step size
data type
MULTIPLIER
product (mu*e)
data type
error
data type
energy
data type
(same as accumulator
uu data type)
Weight update
The two input
data types
to the multiplier
can be any
combination of
the following:
old weight
data type
ADDER
MULTIPLIER
product (Q*u)
data type
CAST
product (Q*u)
data type
new weight
data type
You can set the data type of the parameters, weights, products, quotient,
and accumulators in the block mask. Fixed-point inputs, outputs, and
mask parameters of this block must have the following characteristics:
The input signal and the desired signal must have the same word
length, but their fraction lengths can differ.
1-939
LMS Filter
The step size and leakage factor must have the same word length,
but their fraction lengths can differ.
The output signal and the error signal have the same word length
and the same fraction length as the desired signal.
e , and
The quotient and the product output of the uu, Wu,
Q u operations must have the same word length, but their fraction
lengths can differ.
The accumulator data type of the uu and Wu operations must have
the same word length, but their fraction lengths can differ.
The output of the multiplier is in the product output data type if at
least one of the inputs to the multiplier is real. If both of the inputs
to the multiplier are complex, the result of the multiplication is in
the accumulator data type. For details on the complex multiplication
performed, see Multiplication Data Types.
1-940
LMS Filter
Dialog
Box
The Main pane of the LMS Filter block dialog appears as follows.
1-941
LMS Filter
Algorithm
Choose the algorithm used to calculate the filter weights.
Filter length
Enter the length of the FIR filter weights vector.
Specify step size via
Select Dialog to enter a value for step size in the Block
parameters: LMS Filter dialog. Select Input port to specify step
size using the Step-size input port.
Step size (mu)
Enter the step size . Tunable.
Leakage factor (0 to 1)
Enter the leakage factor, 0 < 1 1. Tunable.
Initial value of filter weights
Specify the initial values of the FIR filter weights.
Adapt port
Select this check box to enable the Adapt input port.
Reset port
Select this check box to enable the Reset input port.
Output filter weights
Select this check box to export the filter weights from the Wts port.
The Data Types pane of the LMS Filter block dialog appears as follows.
1-942
LMS Filter
Rounding mode
Select the rounding mode for fixed-point operations.
1-943
LMS Filter
Overflow mode
Select the overflow mode for fixed-point operations.
Parameters
This parameter is visible if, for the Specify step size via
parameter, you choose Dialog. Choose how you specify the word
length and the fraction length of the leakage factor and step size:
When you select Same word length as first input, the
word length of the leakage factor and step size match that
of the first input to the block. In this mode, the fraction
length of the leakage factor and step size is automatically set
to the binary-point only scaling that provides you with the
best precision possible given the value and word length of the
coefficients.
When you select Specify word length, you can enter the
word length of the leakage factor and step size, in bits. In this
mode, the fraction length of the leakage factor and step size is
automatically set to the binary-point only scaling that provides
you with the best precision possible given the value and word
length of the coefficients.
When you select Binary point scaling, you can enter the
word length and the fraction length of the leakage factor and
step size, in bits. The leakage factor and the step size must
have the same word length, but the fraction lengths can differ.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the leakage factor and
step size. The leakage factor and the step size must have the
same word length, but the slopes can differ. This block requires
a power-of-two slope and a bias of zero.
If, for the Specify step size via parameter, you choose Input
port, the word length of the leakage factor is the same as the word
length of the step size input at the Step size port. The fraction
length of the leakage factor is automatically set to the best
precision possible based on the word length of the leakage factor.
1-944
LMS Filter
Weights
Choose how you specify the word length and fraction length of
the filter weights of the block:
When you select Same as first input, the word length and
fraction length of the filter weights match those of the first
input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the filter weights, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the filter weights. This
block requires a power-of-two slope and a bias of zero.
Products & quotient
Choose how you specify the word length and fraction length of
uu, Wu, e , Q u , and the quotient, Q. Here, u is the input
vector, W is the vector of filter weights, is the step size, e is the
e
uu
When you select Same as first input, the word length and
fraction length of these quantities match those of the first
input to the block.
error, and Q is the quotient, which is defined as Q =
When you select Binary point scaling, you can enter the
word length and the fraction length of these quantities, in bits.
The word length of the quantities must be the same, but the
fraction lengths can differ.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of these quantities. The
word length of the quantities must be the same, but the slopes
can differ. This block requires a power-of-two slope and a bias
of zero.
1-945
LMS Filter
Accumulators
Use this parameter to specify how you would like to designate
the word and fraction lengths of the accumulators for the uu
and Wu operations.
Note This parameter is not used to designate the word and
fraction lengths of the accumulator for the Q u operation. The
accumulator data type for this quantity is automatically set to be
the same as the product data type. The minimum, maximum,
and overflow information for this accumulator is logged as part
of the product information. Autoscaling treats this product and
accumulator as one data type.
See Fixed-Point Data Types on page 1-936 and Multiplication
Data Types for illustrations depicting the use of the accumulator
data type in this block:
When you select Same as first input, these characteristics
match those of the input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulators, in
bits. The word length of both the accumulators must be the
same, but the fraction lengths can differ.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulators. The
word length of both the accumulators must be the same, but
the slopes can differ. This block requires a power-of-two slope
and a bias of zero.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
1-946
LMS Filter
References
Supported
Data
Types
Port
Input
Desired
Reset
Output
1-947
LMS Filter
Port
Error
Wts
See Also
RLS Filter
1-948
Lowpass Filter
Purpose
Library
Description
1-949
Lowpass Filter
Dialog
Box
1-950
Lowpass Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify. Selecting Specify
enables the Order option so you can enter the filter order. When
you set the Impulse response to IIR, you can specify different
numerator and denominator orders. To specify a different
denominator order, you must select the Denominator order
check box.
1-951
Lowpass Filter
Order
Enter the filter order. This option is enabled only if you set the
Order mode to Specify.
Denominator order
Select this check box to specify a different denominator order.
This option is enabled only if you set the Impulse response to
IIR and the Order mode to Specify.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to the one
shown in the following figure.
1-952
Lowpass Filter
In the figure, regions between specification values such as Fpass and Fstop
represent transition regions where the filter response is not constrained.
Frequency constraints
When Order mode is Specify, select the filter features that the
block uses to define the frequency response characteristics. The
list contains the following options, when available for the filter
specifications.
Passband and Stopband frequencies Define the filter
by specifying the frequencies for the edges for the stop- and
passbands.
Passband frequency Define the filter by specifying the edge
of the passband.
Stopband frequency Define the filter by specifying the edge
of the stopband.
Hafband power (3dB) frequency Define the filter response
by specifying the location of the 3 dB point. The 3 dB point is
the frequency for the point three decibels below the passband
value.
Cutoff (6dB) frequency For FIR filters, define the filter
response by specifying the location of the 6 dB point. The 6
1-953
Lowpass Filter
dB point is the frequency for the point six decibels below the
passband value.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1) to
enter frequencies in normalized form. This behavior is the default.
To enter frequencies in absolute values, select one of the frequency
units from the drop-down listHz, kHz, MHz, or GHz. Selecting one
of the unit options enables the Input sample rate parameter.
Input sample rate
Input sample rate, specified in the units you selected for
Frequency units, defines the sampling frequency at the filter
input. When you provide an input sampling frequency, all
frequencies in the specifications are in the selected units as well.
This parameter is available when you select one of the frequency
options from the Frequency units list.
Passband frequency
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select in Frequency units.
Stopband frequency
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select in Frequency units.
Half power (3dB) frequency
When Frequency constraints is Half power (3dB) frequency,
specify the frequency of the 3 dB point. Specify the value in either
normalized frequency units or the absolute units you select in
Frequency units.
Cutoff (6dB) frequency
When Frequency constraints is Cutoff (6dB) frequency,
specify the frequency of the 6 dB point. Specify the value in
either normalized frequency units or the absolute units you select
Frequency units.
1-954
Lowpass Filter
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude constraints
This option is only available when you specify the order of
your filter design. Depending on the setting of the Frequency
constraints parameter, some combination of the following
options will be available for the Magnitude constraints
parameter: Unconstrained, and Passband ripple and
stopband attenuation.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Passband ripple
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Stopband attenuation
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
1-955
Lowpass Filter
1-956
Lowpass Filter
1-957
Lowpass Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
1-958
Lowpass Filter
1-959
Lowpass Filter
Supported
Data
Types
Port
Input
Output
1-960
Purpose
Library
Description
1-961
H ( z) =
1
1 + a1 z
+ a2 z
+ ... + am z m
1-962
k
Each LSP output is within 1 /(n 2 ) of the actual LSP value.
Each LSF output is within LSF of the actual LSF value, LSFact,
where
))
Note When the value of the Root finding coarse grid points
parameter is too small relative to the number of LPCs, the block might
output invalid data as described in Requirements for Valid Outputs
on page 1-961. Also see Handling and Recognizing Invalid Inputs and
Outputs on page 1-964.
1-963
1-964
Place
Holder
[w1
0.5
w1
w
2
0.5
-1
cos ( w13 )
cos ( w23 )
1
w2
w3
1-965
1-966
Dialog
Box
Output
Specifies whether to convert the input linear prediction
polynomial coefficients (LPCs) to LSP in range (-1 1), LSF in
radians (0 pi), or LSF normalized in range (0 0.5). See
Setting Outputs to LSFs or LSPs on page 1-962 for descriptions
of the three settings.
Root finding coarse grid points
The value n, where the block divides the interval (-1, 1) into n
subintervals of equal length, and looks for roots (LSP values) in
each subinterval. You must pick n large enough or the block
1-967
1-968
Theory
1-969
To compute LSP outputs for each channel, the block relies on the fact
that LSP values are the roots of two particular polynomials related
to the input LPC polynomial; the block finds these roots using the
Chebyshev polynomial root finding method, described next. To compute
LSF outputs, the block computes the arc cosine of the LSPs, outputting
values ranging from 0 to radians.
into n intervals, each of length 2/n, and checks the signs of both
polynomials values at the endpoints of the intervals. The block starts
checking signs at 1, and continues checking signs at 1 4/n, 1 6/n,
and so on at steps of length 2/n, outputting any point if it is a root.
The block stops searching in these situations:
a The block finds a sign change of a polynomials values between
input).
c The block fails to find all M roots and yields invalid outputs
1-970
in an interval, [a, b], it searches for the root guaranteed to lie in the
interval by following these steps:
a Check if Midpoint Is a Root The block checks the sign of the
midpoint of the interval [a, b]. The block outputs the midpoint if it
is a root, and continues Step 1, Coarse Root Finding, at the next
point, a 2/n. Otherwise, the block selects the half-interval with
endpoints of opposite sign (either [a, (a + b)/2] or [(a + b)/2, b]) and
executes Step 2b, Stop or Continue Root Finding Refinement.
b Stop or Continue Root Finding Refinement When the block
1-971
1-972
1-973
1-974
Supported
Data
Types
References
See Also
LPC to/from RC
LPC/RC to Autocorrelation
poly2lsf
1-975
Purpose
Library
Description
1-976
Dialog
Box
Input
Specifies whether to convert LSP in range (-1 1), LSF in
range (0 pi), or LSF normalized in range (0 0.5) to linear
prediction coefficients (LPCs).
Supported
Data
Types
References
See Also
LPC to/from RC
LPC/RC to Autocorrelation
lsf2poly
1-977
Purpose
Library
Description
1-978
Algorithm
LPC to CC
When in this mode, this block uses a recursion technique to convert
LPCs to CCs. The LPC vector is defined by a0
a1
a2 ... a p
1-979
c0 = log e P
cm = am +
cm =
1 m1
( m k) ak c( mk) ,1 m p
m k=1
( m k)
k=1
ak c( m k ) , p < m < n
CC to LPC
When in this mode, this block uses a recursion technique to convert CCs
to LPCs. The CC vector is defined by c0
the LPC vector is defined by a0 a1
defined by the following equations
am = cm
where m = 1, 2,..., p .
1-980
1 m1
( m k) c( mk) ak
m k=1
P = exp ( C0 )
c1
Dialog
Box
Type of conversion
Choose LPCs to cepstral coefficients or Cepstral
coefficients to LPCs to specify the domain into which you
want to convert your coefficients.
Specify P
Choose via input port to input the values of prediction error
power using input port P. Select assume P equals 1 to set the
prediction error power equal to 1.
Output size same as input size
When you select this check box, the length of the input vector of
LPCs is equal to the output vector of CCs.
1-981
References
Supported
Data
Types
See Also
1-982
Levinson-Durbin
LPC to/from RC
LPC/RC to Autocorrelation
Real Cepstrum
Complex Cepstrum
LPC to/from RC
Purpose
Library
Description
1-983
LPC to/from RC
the filter is unstable, the block outputs a Boolean value of 0 for each
input channel at the S port.
If first input value is not 1 parameter specifies the behavior of the
block when the first coefficient of the LPC coefficient vector in any
channel is not 1. The following options are available:
Replace it with 1 Changes the first value of the coefficient
channel to 1. The other coefficient values are unchanged.
Normalize Divides the entire channel of coefficients by the first
coefficient so that the first coefficient of the LPC coefficient vector is 1.
Normalize and Warn Divides the entire channel of coefficients by
the first coefficient so that the first coefficient of the LPC coefficient
vector is 1. The block displays a warning message telling you that
your vector of coefficients has been normalized.
Error Displays an error telling you that the first coefficient of the
LPC coefficient channel is not 1.
Algorithm
LPC to RC
When in this mode, this block uses backward Levinson
recursion to convert linear prediction coefficients (LPCs) to
reflection coefficients (RCs). For a given Nth order LPC vector
LPCN = [ 1
aN 1
aN 2
p = a pp
F = 1 p2
a p,m p a p, p m
, 1m< p
a p1,m =
F
F
1-984
LPC to/from RC
end
Finally, 1 = a11 . The reflection coefficient vector is
[ 1 , 2 , , N ] .
RC to LPC
When in this mode, this block uses Levinson recursion to convert
reflection coefficients (RCs) to linear prediction coefficients (LPCs).
In this case, the input to the block is RC = [ 1 2 ... N ] . The
zeroth order LPC vector term is 1. Starting with this term, the
block uses recursion to calculate the higher order LPC vectors,
LPC2 , LPC3 ,... LPCN , until it has calculated the entire LPC matrix.
LPCmatrix
0
1
LPC0
LPC 1 a11
1
1 a21
= LPC2 =
1 a31
LPCN
1 aN 1
0
0
a22
a32
0
0
0
a33
aN 2
aN 3
aNN
0
0
0
1-985
LPC to/from RC
Dialog
Box
Type of conversion
Select LPC to RC or RC to LPC to select the domain into which
you want to convert your coefficients.
Output normalized prediction error power
Select this check box to output the normalized prediction error
power at port P.
Output LPC filter stability
Select this check box to output the stability of the filter. When the
filter represented by the LPCs or RCs is stable, the block outputs
a Boolean value of 1 for each input channel at the S port. When
the filter represented by the LPCs or RCs is unstable, the block
outputs a Boolean value of 0 for each input channel at the S port.
1-986
LPC to/from RC
References
Supported
Data
Types
See Also
Double-precision floating-point
Single-precision floating-point
Levinson-Durbin
LPC/RC to Autocorrelation
1-987
LPC/RC to Autocorrelation
Purpose
Library
Description
1-988
LPC/RC to Autocorrelation
Dialog
Box
Type of conversion
From the list select LPC to autocorrelation or RC to
autocorrelation to specify the domain from which you want to
convert your coefficients.
Specify P
From the list select Assume P=1 or Via input port to specify the
value of prediction error power.
1-989
LPC/RC to Autocorrelation
References
Supported
Data
Types
See Also
1-990
Levinson-Durbin
LPC to/from RC
LU Factorization
Purpose
Library
Description
1-991
LU Factorization
You can set the product output, accumulator, and output data types in
the block dialog as discussed below.
The output of the multiplier is in the product output data type
when the input is real. When the input is complex, the result of the
multiplication is in the accumulator data type. For details on the
complex multiplication performed, see Multiplication Data Types.
Examples
1 8 5
A = 9 1 2
2 5 7
P = ( 2 1 3)
9 1 2
AP = 1 8 5
2 5 7
1-992
LU Factorization
See Factor a Matrix into Upper and Lower Submatrices Using the
LU Factorization Block in the DSP System Toolbox Users Guide for
another example using the LU Factorization block.
1-993
LU Factorization
Dialog
Box
1-994
LU Factorization
Rounding mode
Select the rounding mode for fixed-point operations.
1-995
LU Factorization
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-991 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-996
LU Factorization
Same
as input
References
Supported
Data
Types
Port
LU
1-997
LU Factorization
Port
See Also
Boolean
Autocorrelation LPC
Cholesky Factorization
LDL Factorization
LU Inverse
LU Solver
Permute Matrix
QR Factorization
lu
MATLAB
1-998
LU Inverse
Purpose
Library
Description
The LU Inverse block computes the inverse of the square input matrix
A by factoring and inverting row-pivoted variant Ap.
A p1 = ( LU )
Examples
See Find the Inverse of a Matrix Using the LU Inverse Block in the
DSP System Toolbox Users Guide.
Dialog
Box
References
Supported
Data
Types
1-999
LU Inverse
See Also
Cholesky Inverse
LDL Inverse
LU Factorization
LU Solver
inv
MATLAB
1-1000
LU Solver
Purpose
Library
Description
Algorithm
A p = LU
where L is a lower triangular square matrix with unity diagonal
elements, and U is an upper triangular square matrix.
The matrix factors are substituted for Ap in
A p X = Bp
where Bp is the row-permuted variant of B, and the resulting equation
LUX = B p
is solved for X by making the substitution Y = UX, and solving two
triangular systems.
LY = B p
UX = Y
1-1001
LU Solver
Examples
See Solve AX=B Using the LU Solver Block in the DSP System
Toolbox Users Guide.
Dialog
Box
Supported
Data
Types
See Also
Autocorrelation LPC
Cholesky Solver
LDL Solver
Levinson-Durbin
LU Factorization
LU Inverse
QR Solver
1-1002
Magnitude FFT
Purpose
Library
Transforms
dspxfrm3
Description
% M
nfft
When the Output parameter is set to Magnitude, the block output for
an input u is equivalent to
y = abs(fft(u,nfft))
% M
nfft
When M > Nfft, the block wraps the input to Nfft before computing the
FFT using one of the above equations:
y(:,k)=datawrap(u(:,k),nfft)
% 1
When M > Nfft, the block can also truncate the input:
y(:,k)=abs(fft(u,nfft))
% 1
1-1003
Magnitude FFT
The settings for the fixed-point parameters of the FFT block in the
diagram above are as follows:
Sine table Same word length as input
Integer rounding mode Floor
Saturate on integer overflow unchecked
Product output Inherit via internal rule
Accumulator Inherit via internal rule
Output Inherit via internal rule
The settings for the fixed-point parameters of the Magnitude Squared
block in the diagram above are as follows:
Integer rounding mode Floor
Saturate on integer overflow checked
1-1004
Magnitude FFT
Examples
Dialog
Box
Output
Specify whether the block computes the magnitude FFT or
magnitude-squared FFT of the input.
FFT implementation
Set this parameter to FFTW [1], [2] to support an arbitrary length
input signal. The block restricts generated code with FFTW
implementation to MATLAB host computers.
1-1005
Magnitude FFT
1-1006
Magnitude FFT
References
References
[1] FFTW (http://www.fftw.org)
[2] Frigo, M. and S. G. Johnson, FFTW: An Adaptive Software
Architecture for the FFT,Proceedings of the International Conference on
Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.
Supported
Data
Types
Port
Input
Output
See Also
Burg Method
Short-Time FFT
1-1007
Magnitude FFT
Spectrum Analyzer
Yule-Walker Method
pwelch
1-1008
Matrix 1-Norm
Purpose
Library
Description
max M
y = A 1 = 1 j N aij
i=1
This is equivalent to
y = max(sum(abs(A)))
MATLAB code
% Equivalent
1-1009
Matrix 1-Norm
The block calculations are all done in the accumulator data type until
the max is performed. The result is then cast to the output data type.
You can set the accumulator and output data types in the block dialog
as discussed in Dialog Box on page 1-1010 below.
Dialog
Box
1-1010
Matrix 1-Norm
1-1011
Matrix 1-Norm
Same
as accumulator
1-1012
Matrix 1-Norm
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
References
Supported
Data
Types
Port
Input
1-1013
Matrix 1-Norm
Port
Output
See Also
1-1014
Normalization
Reciprocal Condition
norm
MATLAB
Matrix Concatenate
Purpose
Library
Description
1-1015
Matrix Exponential
Purpose
Library
Description
Dialog
Box
Supported
Data
Types
See Also
1-1016
Array-Vector
Multiply
expm
MATLAB
Dot Product
Simulink
Matrix Exponential
Matrix Product
Product
Simulink
1-1017
Matrix Multiply
Purpose
Library
Description
1-1018
Matrix Product
Purpose
Library
Description
u11
u
21
u31
u12
u22
u32
u1 j
j =1
u13
y1 3
u23 y2 = u2 j
y3 j =1
u33
3
u
3 j
j =1
u11
u
21
u31
u12
u22
u32
u13
u23
u33
[ y1
y2
y3 ]
= ui1
i=1
ui2
i=1
ui3
i=1
1-1019
Matrix Product
When the Multiply over parameter is set to Entire input, the block
multiplies all the elements of the input together and outputs the
resulting scalar.
u11
u
21
u31
u12
u22
u32
u13
3 3
u23 y = ( uij )
i=1 j =1
u33
Dialog
Box
1-1020
The Main pane of the Matrix Product block dialog appears as follows.
Matrix Product
Multiply over
Indicate whether to multiply together the elements of each row,
each column, or the entire input.
The Data Types pane of the Matrix Product block dialog appears as
follows.
1-1021
Matrix Product
1-1022
Matrix Product
Intermediate product
Specify the intermediate product data type. As shown in
Fixed-Point Data Types on page 1-1020, the output of the
multiplier is cast to the intermediate product data type before the
next element of the input is multiplied into it. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
1-1023
Matrix Product
Same
as product output
1-1024
Matrix Product
Minimum
Specify the minimum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Output
1-1025
Matrix Product
See Also
1-1026
Array-Vector
Multiply
Matrix Square
Matrix Sum
prod
MATLAB
Matrix Square
Purpose
Library
Description
Applications
The Matrix Square block is useful in a variety of applications:
General matrix squares The Matrix Square block computes the
output matrix, y, without explicitly forming u. It is therefore more
efficient than other methods for computing the matrix square.
Sum of squares When the input is a column vector (N=1), the
blocks operation is equivalent to a multiply-accumulate (MAC)
process, or inner product. The output is the sum of the squares of the
input, and is always a real scalar.
Correlation matrix When the input is a row vector (M=1), the
output, y, is the symmetric autocorrelation matrix, or outer product.
1-1027
Matrix Square
Dialog
Box
The Signal Attributes pane of the Matrix Square block dialog appears
as follows.
Output minimum
Specify the minimum value the block should output. The default
value is [] (unspecified). Simulink software uses this value to
perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
1-1028
Matrix Square
Output maximum
Specify the maximum value the block should output. The default
value is [] (unspecified). Simulink software uses this value to
perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Output data type
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
1-1029
Matrix Square
Supported
Data
Types
See Also
1-1030
Matrix Multiply
Matrix Product
Matrix Sum
Transpose
Matrix Sum
Purpose
Library
Description
1-1031
Purpose
Library
Description
The Matrix Sum block sums the elements of an M-by-N input matrix u
along its rows, its columns, or over all its elements.
When the Sum over parameter is set to Rows, the block sums across
the elements of each row and outputs the resulting M-by-1 matrix. A
length-N 1-D vector input is treated as a 1-by-N matrix.
u11
u
21
u31
u12
u22
u32
u1 j
j =1
u13
y1 3
u23 y2 = u2 j
y3 j =1
u33
3
u
3 j
j =1
When the Sum over parameter is set to Columns, the block sums down
the elements of each column and outputs the resulting 1-by-N matrix. A
length-M 1-D vector input is treated as a M-by-1 matrix.
u11
u
21
u31
u12
u22
u32
u13
u23
u33
[ y1
1-1032
y2
y3 ]
= ui1
i=1
3
ui2
i=1
3
ui3
i=1
When the Sum over parameter is set to Entire input, the block sums
all the elements of the input together and outputs the resulting scalar.
u11
u
21
u31
u12
u22
u32
u13
3 3
u23 y = ( uij )
i=1 j =1
u33
The output of the Matrix Sum block has the same frame status as the
input. This block accepts real and complex fixed-point and floating-point
inputs except for complex unsigned fixed-point inputs.
You can set the accumulator and output data types in the block dialog
as discussed in Dialog Box on page 1-1034 below.
1-1033
Dialog
Box
The Main pane of the Matrix Sum block dialog appears as follows.
Sum over
Indicate whether to sum the elements of each row, each column,
or of the entire input.
The Fixed-point pane of the Matrix Sum block dialog appears as
follows.
1-1034
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
1-1035
Accumulator
1-1036
Supported
Data
Types
Port
Input
Output
1-1037
See Also
1-1038
Matrix Product
Matrix Multiply
sum
MATLAB
Matrix Viewer
Purpose
Library
Sinks
dspsnks4
Description
Image Properties
Select the Image Properties tab to show the image property
parameters, which control the colormap and display.
You specify the mapping of matrix element values to colors in the
Colormap matrix, Minimum input value, and Maximum input
value parameters. For a colormap with L colors, the colormap matrix
has dimension L-by-3, with one row for each color and one column for
each element of the RGB triple that defines the color. Examples of RGB
triples are
[ 1
0
0 ]
[ 0
0
1 ]
[0.8 0.8 0.8]
(red)
(blue)
(light gray)
1-1039
Matrix Viewer
Axis Properties
Select the Axis Properties tab to show the axis property parameters,
which control labeling and positioning.
The Axis origin parameter determines where the first element of
the input matrix, U(1,1), is displayed. When you specify Upper left
corner, the matrix is displayed in matrix orientation, with U(1,1) in
the upper-left corner.
U11
U
21
U31
U41
When you specify Lower left corner, the matrix is flipped vertically
to image orientation, with U(1,1) in the lower-left corner.
U41
U
31
U21
U11
U42
U32
U22
U12
U43
U33
U23
U13
U44
U34
U24
U14
Axis zoom, when selected, causes the image display to completely fill
the figure window. Axis titles are not displayed. This option can also be
1-1040
Matrix Viewer
selected from the pop-up menu that is displayed when you right-click
in the figure window. When Axis zoom is cleared, the axis labels and
titles are displayed in a gray border surrounding the image axes.
Figure Window
The image title in the figure title bar is the same as the block title.
The axis tick marks reflect the size of the input matrix; the x-axis is
numbered from 1 to N (number of columns), and the y-axis is numbered
from 1 to M (number of rows).
Right-click the image in the figure window to access the following menu
items:
Refresh erases all data on the scope display except for the most
recent image.
Autoscale recomputes the minimum and maximum input values
to fit the range of values observed in a series of 10 consecutive
inputs. The numerical limits selected by the autoscale feature are
shown in the Minimum input value and Maximum input value
parameters, where you can make further adjustments to them
manually.
Axis zoom, when selected, causes the image to completely fill the
figure window. Axis titles are not displayed. When Axis zoom is
cleared, the axis labels and titles are displayed in a gray border
surrounding the scope axes. This option can also be set in the Axis
Properties pane of the parameter dialog.
Colorbar, when selected, displays a bar with the specified colormap
to the right of the image axes.
Save Position automatically updates the Figure position
parameter in the Axis Properties pane to reflect the figure windows
current position and size on the screen. To make the scope window
open at a particular location on the screen when the simulation runs,
drag the window to the desired location, resize it, and select Save
Position. The parameter dialog must be closed when you select
Save Position for the Figure position parameter to be updated.
1-1041
Matrix Viewer
Examples
See the Spectral Analysis Using the Periodogram Method example for
a demonstration of using the Matrix Viewer block to create a moving
spectrogram, or time-frequency plot, of a speech signal by updating just
one column of the input matrix at each sample time.
Dialog
Box
Colormap matrix
A 3-column matrix defining the colormap as a set of RGB triples,
or a call to a colormap-generating function such as hot or spring.
See the ColorSpec property for complete information about
1-1042
Matrix Viewer
1-1043
Matrix Viewer
Axis origin
The position within the axes where the first element of the input
matrix, U(1,1), is plotted; bottom left or top left. Tunable.
X-axis title
The text to be displayed below the x-axis. Tunable.
Y-axis title
The text to be displayed to the left of the y-axis. Tunable.
Colorbar title
The text to be displayed to the right of the color bar, when
Display colorbar is currently selected. Tunable.
1-1044
Matrix Viewer
Supported
Data
Types
Port
Input
See Also
Spectrum Analyzer
Vector Scope
colormap
MATLAB
ColorSpec
MATLAB
image
MATLAB
1-1045
Maximum
Purpose
Library
Statistics
dspstat3
Description
The Maximum block identifies the value and/or position of the largest
element in each row or column of the input, along vectors of a specified
dimension of the input, or of the entire input. The Maximum block can
also track the maximum values in a sequence of inputs over a period of
time. The Mode parameter specifies the blocks mode of operation and
can be set to Value, Index, Value and Index, or Running.
The Maximum block supports real and complex floating-point,
fixed-point, and Boolean inputs. Real fixed-point inputs can be either
signed or unsigned, while complex fixed-point inputs must be signed.
The data type of the maximum values output by the block match the
data type of the input. The index values output by the block are double
when the input is double, and uint32 otherwise.
For the Value, Index, and Value and Index modes, the Maximum
block produces identical results as the MATLAB max function when it
is called as [y I] = max(u,[],D), where u and y are the input and
output, respectively, D is the dimension, and I is the index.
Value Mode
When the Mode parameter is set to Value, the block computes the
maximum value in each row or column of the input, along vectors of a
specified dimension of the input, or of the entire input at each sample
time, and outputs the array y. Each element in y is the maximum
value in the corresponding column, row, vector, or entire input. The
output y depends on the setting of the Find the maximum value
over parameter. For example, consider a 3-dimensional input signal
of size M-by-N-by-P:
Each row The output at each sample time consists of an
M-by-1-by-P array, where each element contains the maximum
value of each vector over the second dimension of the input. For an
1-1046
Maximum
Index Mode
When Mode is set to Index, the block computes the maximum value in
each row or column of the input, along vectors of a specified dimension
of the input, or of the entire input, and outputs the index array I.
1-1047
Maximum
1-1048
Maximum
When inputs to the block are double-precision values, the index values
are double-precision values. Otherwise, the index values are 32-bit
unsigned integer values.
Running Mode
When Mode is set to Running, the block tracks the maximum value of
each channel in a time sequence of M-by-N inputs. In this mode, you
must also specify a value for the Input processing parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains
the maximum value observed in element uij for all inputs since the
last reset.
When you select Columns as channels (frame based), the block
outputs an M-by-N matrix. Each element yij of the output contains
the maximum value observed in the jth column of all inputs since the
last reset, up to and including element uij of the current input.
Running Mode for Variable-Size Inputs
When your inputs are of variable size, and you set the Mode to Running
, there are two options:
If you set the Input processing parameter to Elements as
channels (sample based), the state is reset.
If you set the Input processing parameter to Columns as channels
(frame based), then there are two cases:
1-1049
Maximum
Rising edge
Rising edge
Rising edge
1-1050
Rising edge
Maximum
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-1051
Maximum
ROI Processing
To calculate the statistical value within a particular region of interest
(ROI) of the input, select the Enable ROI processing check box. This
applies to any mode other than running mode and when you set the
Find the maximum value over parameter to Entire input and you
select the Enable ROI processing check box. ROI processing applies
only for 2-D inputs.
Note Full ROI processing is available only if you have a Computer
Vision System Toolbox license. If you do not have a Computer Vision
System Toolbox license, you can still use ROI processing, but are limited
to the ROI type Rectangles.
Use the ROI type parameter to specify whether the ROI is a rectangle,
line, label matrix, or binary mask. A binary mask is a binary image
that enables you to specify which pixels to highlight, or select. In a label
matrix, pixels equal to 0 represent the background, pixels equal to 1
represent the first object, pixels equal to 2 represent the second object,
and so on. When the ROI type parameter is set to Label matrix, the
Label and Label Numbers ports appear on the block. Use the Label
Numbers port to specify the objects in the label matrix for which the
block calculates statistics. The input to this port must be a vector
of scalar values that correspond to the labeled regions in the label
matrix. For more information about the format of the input to the ROI
port when the ROI is a rectangle or a line, see the Draw Shapes block
reference page.
For rectangular ROIs, use the ROI portion to process parameter to
specify whether to calculate the statistical value for the entire ROI
or just the ROI perimeter.
Use the Output parameter to specify the block output. The block can
output separate statistical values for each ROI or the statistical value
for all specified ROIs. This parameter is not available if, for the ROI
type parameter, you select Binary mask.
1-1052
Maximum
If, for the ROI type parameter, you select Rectangles or Lines, the
Output flag indicating if ROI is within image bounds check box
appears in the dialog box. If you select this check box, the Flag port
appears on the block. The following tables describe the Flag port output
based on the block parameters.
Output = Individual statistics for each ROI
Flag
Port
Output
Description
Description
If the ROI is partially outside the image, the block only computes the
statistical values for the portion of the ROI that is within the image.
If, for the ROI type parameter, you select Label matrix, the Output
flag indicating if input label numbers are valid check box appears
in the dialog box. If you select this check box, the Flag port appears on
the block. The following tables describe the Flag port output based
on the block parameters.
1-1053
Maximum
Description
Description
Examples
1-1054
Maximum
1-1055
Maximum
Dialog
Box
Mode
Specify the blocks mode of operation:
Value Output the maximum value of each input
Index Output the index of the maximum value
Value and index Output both the value and the index
1-1056
Maximum
1-1057
Maximum
1-1058
Maximum
ROI type
Specify the type of ROI you want to use. Your choices are
Rectangles, Lines, Label matrix, or Binary mask.
1-1059
Maximum
1-1060
Maximum
Note The parameters on the Data Types pane are only used for
complex fixed-point inputs. The sum of the squares of the real and
imaginary parts of such an input are formed before a comparison is
made, as described in Value Mode on page 1-1046. The results of the
squares of the real and imaginary parts are placed into the product
output data type. The result of the sum of the squares is placed into
the accumulator data type. These parameters are ignored for other
types of inputs.
1-1061
Maximum
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-1054 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
Same
as product output
1-1062
Maximum
Supported
Data
Types
Port
Input
Reset
Idx
Val
1-1063
Maximum
See Also
1-1064
Mean
Minimum
MinMax
Simulink
max
MATLAB
Mean
Purpose
Library
Statistics
dspstat3
Description
The Mean block computes the mean of each row or column of the input,
along vectors of a specified dimension of the input, or of the entire
input. The Mean block can also track the mean value in a sequence of
inputs over a period of time. To track the mean value in a sequence of
inputs, select the Running mean check box.
Basic Operation
When you do not select the Running mean check box, the block
computes the mean value in each row or column of the input, along
vectors of a specified dimension of the input, or of the entire input at
each individual sample time. Each element in the output array y is the
mean value of the corresponding column, row, vector, or entire input.
The output array y depends on the setting of the Find the mean value
over parameter. For example, consider a 3-dimensional input signal
of size M-by-N-by-P:
Entire input The output at each sample time is a scalar that
contains the mean value of the M-by-N-by-P input matrix.
y = mean(u(:))
1-1065
Mean
Running Operation
When you select the Running mean check box, the block tracks the
mean value of each channel in a time sequence of inputs. In this mode,
you must also specify a value for the Input processing parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains the
mean value of the elements uij for all inputs since the last reset.
1-1066
Mean
When your inputs are of variable size, and you select the Running
mean check box, there are two options:
If you set the Input processing parameter to Elements as
channels (sample based), the state is reset.
If you set the Input processing parameter to Columns as channels
(frame based), then there are two cases:
1-1067
Mean
Rising edge Triggers a reset operation when the Rst input does
one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-1068
Mean
Falling edge
Falling edge
Falling edge
Falling edge
ROI Processing
To calculate the statistical value within a particular region of interest
(ROI) of the input, select the Enable ROI processing check box.
This option is only available when the Find the mean value over
parameter is set to Entire input and the Running mean check box is
not selected. ROI processing is only supported for 2-D inputs.
1-1069
Mean
1-1070
Mean
Description
Description
If the ROI is partially outside the image, the block only computes the
statistical values for the portion of the ROI that is within the image.
If, for the ROI type parameter, you select Label matrix, the Output
flag indicating if input label numbers are valid check box appears
in the dialog box. If you select this check box, the Flag port appears on
the block. The following tables describe the Flag port output based
on the block parameters.
Output = Individual statistics for each ROI
Flag
Port
Output
Description
1-1071
Mean
Description
You can set the accumulator and output data types in the block dialog,
as discussed in Dialog Box on page 1-1073.
Examples
1-1072
In the ex_mean_ref model, the Mean block calculates the running mean
of a 3-by-2 matrix input, u. The Input processing parameter is set
to Columns as channels (frame based), so the block processes the
input as a two channel signal with a frame size of three. The running
mean is reset at t=2 by an impulse to the blocks Rst port.
Mean
Dialog
Box
1-1073
Mean
Running mean
Enables running operation when selected.
Input processing
Specify how the block should process the input when computing
the running mean. You can set this parameter to one of the
following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
1-1074
Mean
1-1075
Mean
Dimension
Specify the dimension (one-based value) of the input signal,
over which the mean is computed. The value of this parameter
cannot exceed the number of dimensions in the input signal. This
parameter is only visible when the Find the mean value over
parameter is set to Specified dimension.
Enable ROI Processing
Select this check box to calculate the statistical value within a
particular region of each image. This parameter is only available
when the Find the mean value over parameter is set to Entire
input, and the block is not in running mode.
Note Full ROI processing is available only if you have a
Computer Vision System Toolbox license. If you do not have a
Computer Vision System Toolbox license, you can still use ROI
processing, but are limited to the ROI type Rectangles.
ROI type
Specify the type of ROI you want to use. Your choices are
Rectangles, Lines, Label matrix, or Binary mask.
ROI portion to process
Specify whether you want to calculate the statistical value for
the entire ROI or just the ROI perimeter. This parameter is only
visible if, for the ROI type parameter, you specify Rectangles.
Output
Specify the block output. The block can output a vector of separate
statistical values for each ROI or a scalar value that represents
the statistical value for all the specified ROIs. This parameter is
not available if, for the ROI type parameter, you select Binary
mask.
Output flag
Output flag indicating if ROI is within image bounds
1-1076
Mean
1-1077
Mean
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Accumulator data type
Specify the accumulator data type. See Fixed-Point Data
Types on page 1-1072 for illustrations depicting the use of the
accumulator data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
as input
1-1078
Same
Mean
Same
as accumulator
1-1079
Mean
Maximum
Specify the maximum value that the block should output. The
default value is [] (unspecified). Simulink software uses this
value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Reset
1-1080
Mean
Port
ROI
Label
Label
8-, 16-, and 32-bit unsigned integers
Numbers
Output
Flag
See Also
Boolean
Maximum
Median
Minimum
Standard Deviation
mean
MATLAB
1-1081
Median
Purpose
Library
Statistics
dspstat3
Description
The Median block computes the median value of each row or column of
the input, along vectors of a specified dimension of the input, or of the
entire input. The median of a set of input values is calculated as follows:
1 The values are sorted.
2 If the number of values is odd, the median is the middle value.
3 If the number of values is even, the median is the average of the
1-1082
Median
y = median(u)
Accumulator data
type
Product output
data type
Even M
Odd M
Odd M and
complex
Even M and
complex
1-1083
Median
The accumulator and output data types and scalings are used for
fixed-point signals when M is even. The result of the sum performed
while calculating the average of the two central rows of the input matrix
is stored in the accumulator data type and scaling. The total result of
the average is then put into the output data type and scaling.
The accumulator and product output parameters are used for complex
fixed-point inputs. The sum of the squares of the real and imaginary
parts of such an input are formed before the input elements are sorted,
as described in Description. The results of the squares of the real
and imaginary parts are placed into the product output data type
and scaling. The result of the sum of the squares is placed into the
accumulator data type and scaling.
For fixed-point inputs that are both complex and have even M, the data
types are used in all of the ways described. Therefore, in such cases, the
accumulator type is used in two different ways.
Dialog
Box
1-1084
Median
Sort algorithm
Specify whether to sort the elements of the input using a Quick
sort or an Insertion sort algorithm.
Find the median value over
Specify whether to find the median value along rows, columns,
entire input, or the dimension specified in the Dimension
parameter. For more information, see Description.
1-1085
Median
1-1086
Median
1-1087
Median
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-1083 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
Same
as product output
1-1088
Median
Same
as accumulator
1-1089
Median
Supported
Data
Types
Port
Input
Output
See Also
1-1090
Maximum
Mean
Minimum
Sort
Standard Deviation
Variance
median
MATLAB
MIDI Controls
Purpose
Library
Sources
dspsrcs4
Description
The MIDI Controls block outputs values from controls on a MIDI control
surface in real time.
Use the MIDI device parameter to specify the name of the MIDI control
surface device from which to receive control values. You can choose:
Default
Specify other
If you choose Default, the block looks for a MATLAB preference with
a group named midi and preference named DefaultDevice. You can
set this preference using the MATLAB setpref function. For example,
if the desired device is named BCF2000, you can type the following
command at the MATLAB command line:
>> setpref('midi', 'DefaultDevice', 'BCF2000');
If the block does not find this preference, it then attempts to choose a
device using an algorithm that is unspecified and platform dependent.
If you choose Specify other, then a MIDI device name edit box
appears for you to enter a MATLAB expression for the device name.
Enter any MATLAB expression that can evaluate to a string. Literal
names must be enclosed in quotes, (for example, 'BCF2000').
You can determine the name of your MIDI device using the MATLAB
function midiid, discussed in Identifying MIDI Device Names and
Control Numbers on page 1-1093.
Use the MIDI controls parameter to specify the controls on the
MIDI device to which the block should respond. This parameter also
determines the size of the block output port. You can choose:
1-1091
MIDI Controls
1-1092
MIDI Controls
Output Port
The MIDI Controls block output is a vector whose width is determined
by the MIDI controls and MIDI control numbers parameters
previously described. The output data type can be either real
double-precision floating point, or uint8 integer if the output mode is
'Raw MIDI'. The output values range from 0.0 to 1.0, inclusively, and
in the raw mode, they range from 0 to 127, inclusively. The output
port back inherits its sample time.
You are prompted to move the control in which you are interested.
>> [ctlnum devname] = midiid
Move the control you wish to identify; type ^C to abort.
1-1093
MIDI Controls
using setpref. Then, enter the control number in the block dialog.
Concatenate the number with other control numbers as needed.
Examples
1-1094
MIDI Controls
Verify that a particular control changes the display value and that
other controls do not.
Use midiid to determine the number of a few more controls, and set
those on the MIDI Controls block.
Verify that the display block shows the correct number of values. Also
verify that the controls you specified change the appropriate display
values and that the other controls do not change the values.
Set each control to have a unique initial value.
Verify that the correct initial values appear on the display when the
model starts.
If your MIDI device is bidirectional, on the MIDI Controls block, select
the Send initial values to device at start check box.
Verify that the controls are set to the correct initial values when the
model starts.
1-1095
MIDI Controls
Dialog
Box
1-1096
MIDI device
Specify whether to use a default MIDI device, or specify a
particular device by name.
MIDI Controls
Supported
Data
Types
Port
Output
1-1097
Minimum
Purpose
Library
Statistics
dspstat3
Description
The Minimum block identifies the value and/or position of the smallest
element in each row or column of the input, along vectors of a specified
dimension of the input, or of the entire input. The Minimum block can
also track the minimum values in a sequence of inputs over a period of
time. The Mode parameter specifies the blocks mode of operation, and
can be set to Value, Index, Value and Index, or Running.
The Minimum block supports real and complex floating-point,
fixed-point, and Boolean inputs. Real fixed-point inputs can be either
signed or unsigned, while complex fixed-point inputs must be signed.
The data type of the minimum values output by the block match the
data type of the input. The index values output by the block are double
when the input is double, and uint32 otherwise.
For the Value, Index, and Value and Index modes, the Minimum
block produces identical results as the MATLAB min function when it
is called as [y I] = min(u,[],D), where u and y are the input and
output, respectively, D is the dimension, and I is the index.
Value Mode
When the Mode parameter is set to Value, the block computes the
minimum value in each row or column of the input, along vectors of a
specified dimension of the input, or of the entire input at each sample
time, and outputs the array y. Each element in y is the minimum
value in the corresponding column, row, vector, or entire input. The
output y depends on the setting of the Find the minimum value
over parameter. For example, consider a 3-dimensional input signal
of size M-by-N-by-P:
Each row The output at each sample time consists of an
M-by-1-by-P array, where each element contains the minimum value
of each vector over the second dimension of the input. For an input
1-1098
Minimum
Index Mode
When Mode is set to Index, the block computes the minimum value in
each row or column of the input, along vectors of a specified dimension
1-1099
Minimum
of the input, or of the entire input, and outputs the index array I.
Each element in I is an integer indexing the minimum value in the
corresponding column, row, vector, or entire input. The output I depends
on the setting of the Find the minimum value over parameter. For
example, consider a 3-dimensional input signal of size M-by-N-by-P:
Each row The output at each sample time consists of an
M-by-1-by-P array, where each element contains the index of the
minimum value of each vector over the second dimension of the
input. For an input that is an M-by-N matrix, the output at each
sample time is an M-by-1 column vector.
Each column The output at each sample time consists of a
1-by-N-by-P array, where each element contains the index of the
minimum value of each vector over the first dimension of the input.
For an input that is an M-by-N matrix, the output at each sample
time is a 1-by-N row vector.
In this mode, the block treats length-M unoriented vector inputs
as M-by-1 column vectors.
Entire input The output at each sample time is a 1-by-3 vector
that contains the location of the minimum value in the M-by-N-by-P
input matrix. For an input that is an M-by-N matrix, the output will
be a 1-by-2 vector.
Specified dimension The output at each sample time depends
on Dimension. If Dimension is set to 1, the output is the same as
when you select Each column. If Dimension is set to 2, the output
is the same as when you select Each row. If Dimension is set to
3, the output at each sample time is an M-by-N matrix containing
the indices of the minimum values of each vector over the third
dimension of the input.
When a minimum value occurs more than once, the computed index
corresponds to the first occurrence. For example, when the input is the
column vector [-1 2 3 2 -1]', the computed one-based index of the
minimum value is 1 rather than 5 when Each column is selected.
1-1100
Minimum
Running Mode
When Mode is set to Running, the block tracks the minimum value of
each channel in a time sequence of M-by-N inputs. In this mode, you
must also specify a value for the Input processing parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains
the minimum value observed in element uij for all inputs since the
last reset.
When you select Columns as channels (frame based), the block
outputs an M-by-N matrix. Each element yij of the output contains
the minimum value observed in the jth column of all inputs since the
last reset, up to and including element uij of the current input.
Running Mode for Variable-Size Inputs
When your inputs are of variable size, and you set the Mode to Running
, there are two options:
If you set the Input processing parameter to Elements as
channels (sample based), the state is reset.
If you set the Input processing parameter to Columns as channels
(frame based), then there are two cases:
1-1101
Minimum
Rising edge
Rising edge
Rising edge
1-1102
Rising edge
Minimum
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-1103
Minimum
ROI Processing
To calculate the statistical value within a particular region of interest
(ROI) of the input, select the Enable ROI processing check box. This
applies to any mode other than the running mode and when you set the
Find the minimum value over parameter to Entire input and you
select the Enable ROI processing check box. ROI processing applies
only for 2-D inputs.
Note Full ROI processing is only available to users who have a
Computer Vision System Toolbox license. If you only have a DSP
System Toolbox license, you can still use ROI processing, but are limited
to the ROI type Rectangles.
Use the ROI type parameter to specify whether the ROI is a rectangle,
line, label matrix, or binary mask. A binary mask is a binary image
that enables you to specify which pixels to highlight, or select. In a label
matrix, pixels equal to 0 represent the background, pixels equal to 1
represent the first object, pixels equal to 2 represent the second object,
and so on. When the ROI type parameter is set to Label matrix, the
Label and Label Numbers ports appear on the block. Use the Label
Numbers port to specify the objects in the label matrix for which the
block calculates statistics. The input to this port must be a vector
of scalar values that correspond to the labeled regions in the label
matrix. For more information about the format of the input to the ROI
port when the ROI is a rectangle or a line, see the Draw Shapes block
reference page.
For rectangular ROIs, use the ROI portion to process parameter to
specify whether to calculate the statistical value for the entire ROI
or just the ROI perimeter.
Use the Output parameter to specify the block output. The block can
output separate statistical values for each ROI or the statistical value
for all specified ROIs. This parameter is not available if, for the ROI
type parameter, you select Binary mask.
1-1104
Minimum
If, for the ROI type parameter, you select Rectangles or Lines, the
Output flag indicating if ROI is within image bounds check box
appears in the dialog box. If you select this check box, the Flag port
appears on the block. The following tables describe the Flag port output
based on the block parameters.
Output = Individual statistics for each ROI
Flag
Port
Output
Description
Description
If the ROI is partially outside the image, the block only computes the
statistical values for the portion of the ROI that is within the image.
If, for the ROI type parameter, you select Label matrix, the Output
flag indicating if input label numbers are valid check box appears
in the dialog box. If you select this check box, the Flag port appears on
the block. The following tables describe the Flag port output based
on the block parameters.
1-1105
Minimum
Description
Description
Examples
1-1106
Minimum
1-1107
Minimum
Dialog
Box
Mode
Specify the blocks mode of operation:
Value Output the minimum value of each input
Index Output the index of the minimum value
Value and index Output both the value and the index
1-1108
Minimum
1-1109
Minimum
Reset port
Specify the reset event that causes the block to reset the running
minimum. The sample time of the input to the Rst port must be a
positive integer multiple of the input sample time. This parameter
appears only when you set the Mode parameter to Running. For
information about the possible values of this parameter, see
Resetting the Running Minimum on page 1-1102.
Treat sample-based row input as a column
Select to treat sample-based length-M row vector inputs as M-by-1
column vectors. This parameter is only visible when the Find the
minimum value of parameter is set to Each column.
Note This check box will be removed in a future release. See
Sample-Based Row Vector Processing Changes in the DSP
System Toolbox Release Notes.
Dimension
Specify the dimension (one-based value) of the input signal, over
which the minimum is computed. The value of this parameter
cannot exceed the number of dimensions in the input signal. This
parameter is only visible when the Find the minimum value
over parameter is set to Specified dimension.
Enable ROI processing
Select this check box to calculate the statistical value within a
particular region of each image. This parameter is only available
when the Find the minimum value over parameter is set to
Entire input, and the block is not in running mode.
Note Full ROI processing is only available to users who have a
Computer Vision System Toolbox license. If you only have a DSP
System Toolbox license, you can still use ROI processing, but are
limited to the ROI type Rectangles.
1-1110
Minimum
ROI type
Specify the type of ROI you want to use. Your choices are
Rectangles, Lines, Label matrix, or Binary mask.
1-1111
Minimum
1-1112
Minimum
Note The parameters on the Data Types pane are only used for
complex fixed-point inputs. The sum of the squares of the real and
imaginary parts of such an input are formed before a comparison is
made, as described in Value Mode on page 1-1098. The results of the
squares of the real and imaginary parts are placed into the product
output data type. The result of the sum of the squares is placed into
the accumulator data type. These parameters are ignored for other
types of inputs.
1-1113
Minimum
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-1106 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
Same
as input
1-1114
Minimum
Supported
Data
Types
Port
Input
Reset
Idx
Val
1-1115
Minimum
See Also
1-1116
Maximum
Mean
MinMax
Simulink
Histogram
min
MATLAB
Purpose
Library
Description
H ( z) =
G
G
=
A( z) 1 + a(2) z1 + + a( p + 1) z p
You specify the order, p, of the all-pole model in the Estimation order
parameter. To guarantee a valid output, you must set the Estimation
order parameter to be less than or equal to two thirds the input vector
length.
The output port labeled A outputs the normalized estimate of the AR
model coefficients in descending powers of z.
[1 a(2) ... a(p+1)]
1-1117
Dialog
Box
References
Estimation order
Specify the order of the AR model, p.
Kay, S. M. Modern Spectral Estimation: Theory and Application.
Englewood Cliffs, NJ: Prentice-Hall, 1988.
Marple, S. L., Jr., Digital Spectral Analysis with Applications.
Englewood Cliffs, NJ: Prentice-Hall, 1987.
Supported
Data
Types
Port
Input
The output data type is the same as the input data type.
1-1118
See Also
Burg AR Estimator
Covariance AR Estimator
Yule-Walker AR Estimator
armcov
1-1119
Purpose
Library
Description
1-1120
If these conditions do not hold, clear the Inherit sample time from
input check box. You can then specify a sample time using the Sample
time of original time series parameter.
See the Burg Method block reference for a comparison of the Burg
Method, Covariance Method, Modified Covariance Method, and
Yule-Walker Method blocks.
Examples
1-1121
Dialog
Box
Estimation order
Specify the order of the AR model. To guarantee a valid output,
the Estimation order parameter must be less than or equal to
two thirds of the input vector length.
Inherit FFT length from estimation order
When you select this check box, the option specifies that the FFT
length is one greater than the estimation order. To specify the
number of points on which to perform the FFT, clear this check
box. You can then specify a power of two FFT length using the
FFT length parameter.
FFT length
Enter the number of data points, Nfft, on which to perform the
FFT. When Nfft is larger than the input frame size, the block
zero-pads each frame as needed. When Nfft is smaller than the
input frame size, the block wraps each frame as needed. This
1-1122
parameter becomes visible only when you clear the Inherit FFT
length from estimation order check box.
Inherit sample time from input
If you select the Inherit sample time from input check box, the
block computes the frequency data from the sample period of the
input signal. For the block to produce valid output, the following
conditions must hold:
The input to the block is the original signal, with no samples
added or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time
from input check box. You can then specify a sample time using
the Sample time of original time series parameter.
Sample time of original time series
Specify the sample time of the original time-domain signal. This
parameter becomes visible only when you clear the Inherit
sample time from input check box.
References
1-1123
Supported
Data
Types
Port
Input
Output
The output data type is the same as the input data type.
See Also
Burg Method
Covariance Method
Modified Covariance
AR Estimator
Short-Time FFT
Yule-Walker Method
1-1124
Multiphase Clock
Purpose
Library
Sources
dspsrcs4
Description
Examples
1-1125
Multiphase Clock
The Scope window below shows the Multiphase Clock blocks output.
Note that the first active level appears at t=0 on y(3), the second active
level appears at t=0.002 on y(4), the third active level appears at
t=0.004 on y(5), the fourth active level appears at t=0.006 on y(1), and
the fifth active level appears at t=0.008 on y(2). Each signal becomes
active 1/(5*100) seconds after the previous signal.
1-1126
Multiphase Clock
1-1127
Multiphase Clock
Dialog
Box
Clock frequency
The frequency of all output clock signals.
Number of phases
The number of different phases, N, in the output vector.
Starting phase
The vector index of the output signal to first become active.
Number of phase intervals over which clock is active
The duration of the active level for every output signal.
Active level
The active level, High (1) or Low (0).
Output data type
The output data type.
1-1128
Multiphase Clock
Supported
Data
Types
See Also
Clock
Simulink
Counter
Pulse Generator
Simulink
Event-Count Comparator
1-1129
Multiport Selector
Purpose
Library
Description
Examples
Example 1
Consider the following Indices to output cell array:
{4,[1:2 5],[7;8],10:-1:6}
1-1130
Multiport Selector
the dimensions of these outputs when Select = Rows and the input
dimension is M-by-N.
Cell
Expression
Description
Output Size
Row 4 of input
1-by-N
[1:2 5]
3-by-N
[7;8]
2-by-N
10:-1:6
5-by-N
1-1131
Multiport Selector
Dialog
Box
Select
Specify the dimension of the input to select, Rows or Columns.
Indices to output
A cell array specifying the row- or column-subsets to propagate
to each of the output ports. The number of cells in the array
determines the number of output ports on the block.
Invalid index
Specify how the block handles an invalid index value. You can
select one of the following options:
Clip index Clip the index to the nearest valid value, and do
not issue an alert.
1-1132
Multiport Selector
Supported
Data
Types
Port
Input
Outputs
1-1133
Multiport Selector
See Also
1-1134
Permute Matrix
Selector
Simulink
Submatrix
Variable Selector
N-Sample Enable
Purpose
Library
Sources
dspsrcs4
Description
1-1135
N-Sample Enable
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-1136
N-Sample Enable
Dialog
Box
Trigger count
Specify the number of samples for which the block outputs the
active value. Tunable.
Active level
Specify the value to output after the first N sample times, 0 or
1. Tunable.
Reset input
Select to enable the Rst input port.
1-1137
N-Sample Enable
Trigger type
Select type of event that triggers a reset when the Rst port is
enabled.
Sample time
Specify the sample period, Ts, for the blocks counter. The block
switches from the active value to the inactive value at t=Ts*(N+1).
Output data type
Select the output data type.
Supported
Data
Types
See Also
1-1138
Counter
N-Sample Switch
N-Sample Switch
Purpose
Library
Description
The N-Sample Switch block outputs the signal connected to the top
input port during the first N sample times after the simulation begins
or the block is reset, where you specify N in the Switch count
parameter. Beginning with output sample N+1, the block outputs the
signal connected to the bottom input until the next reset event or the
end of the simulation.
You specify the sample period of the output in the Sample time
parameter (that is, the output sample period is not inherited from the
sample period of either input). The block applies a zero-order hold at
the input ports, so the value the block reads from a given port between
input sample times is the value of the most recent input to that port.
Both inputs must have the same dimension, except in the following
two cases:
When one input is a scalar, the block expands the scalar input to
match the size of the other input.
When one input is an unoriented vector and the other input is a
row or column vector with the same number of elements, the block
reshapes the unoriented vector to match the dimension of the other
input.
The Reset input check box enables the Rst input port. At any time
during the count, a trigger event at the Rst port resets the counter to
zero. The reset sample time must be a positive integer multiple of the
input sample time. This block supports triggered subsystems when you
select the Reset input check box.
You specify the triggering event in the Trigger type pop-up menu,
and can be one of the following:
1-1139
N-Sample Switch
Rising edge Triggers a reset operation when the Rst input does
one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-1140
N-Sample Switch
Falling edge
Falling edge
Falling edge
Falling edge
1-1141
N-Sample Switch
Dialog
Box
Switch count
The number of sample periods, N, for which the output is
connected to the top input before switching to the bottom input.
Tunable.
Reset input
Enables the Rst input port when selected. The rate of the reset
signal must be a positive integer multiple of the rate of the data
signal input.
Trigger type
The type of event at the Rst port that resets the blocks counter.
This parameter is enabled when you select Reset input. Tunable.
1-1142
N-Sample Switch
Sample time
The sample period, Ts, for the blocks counter. The block switches
inputs at t=Ts*(N+1).
Supported
Data
Types
See Also
Counter
N-Sample Enable
1-1143
NCO
Purpose
Library
Signal Operations
dspsigops
Description
1-1144
NCO
phase increment = (
F0 2 N
)
Fs
Fs =
1
1
=
Ts sample time
f =
1
Ts 2 N
Hz
Given a desired phase offset (in radians), calculate the Phase offset
block parameter with
phase offset =
SFDR = ( 6 P ) dB
without dither
SFDR = ( 6 P + 12 ) dB
witth dither
This block uses a quarter-wave lookup table technique that stores table
values from 0 to /2. The block calculates other values on demand using
the accumulator data type, then casts them into the output data type.
This can lead to quantization effects at the range limits of a given data
1-1145
NCO
type. For example, consider a case where you would expect the value of
the sine wave to be 1 at . Because the lookup table value at that point
must be calculated, the block might not yield exactly 1, depending on
the precision of the accumulator and output data types.
The NCO block supports real inputs only. All outputs are real except
for the output signal in Complex exponential mode.
To produce a multichannel output, specify a vector quantity for the
Phase increment and Phase offset parameters. Both parameters
must have the same length, which defines the number of output
channels. Each element of each vector is applied to a different output
channel.
Fixed-Point
Data
Types
1-1146
The following diagram shows the data types used within the NCO block.
NCO
You can set the accumulator and output data types in the block
dialog as discussed in Dialog Box on page 1-1152 below.
Note The lookup table for this block is constructed from
double-precision floating-point values. Thus, the maximum amount
of precision you can achieve in your output is 53 bits. Setting the
word length of the Output data type to values greater than 53 bits
does not improve the precision of your output.
The phase increment and phase offset inputs must be integers or
fixed-point data types with zero fraction length.
You specify the number of quantized accumulator bits in the
Number of quantized accumulator bits parameter.
1-1147
NCO
Examples
The NCO block is used in the GSM Digital Down Converter product
example. Open this example by typing dspddc at the MATLAB
command line.
You can also try the following example. Design an NCO source with
the following specifications:
Desired output frequency F0 = 510 Hz
Frequency resolution f = 0.05 Hz
Spurious free dynamic range SFDR 90 dB
Sample period Ts = 1 / 8000 s
Desired phase offset / 2
1
f =
1
Ts 2 N
0.05 =
Hz
1
1
2N
8000
Hz
N = 18
Note that N must be an integer value. The value of N is rounded up to
the nearest integer; 18 accumulator bits are needed to accommodate the
value of the frequency resolution.
2
1-1148
NCO
Using this best value of N, calculate the frequency resolution that will
be achieved by the NCO block:
f =
1
Ts 2 N
Hz
1
Hz
1
218
8000
f = 0.0305
f =
Select the number of dither bits. In general, a good choice for the
number of dither bits is the accumulator word length minus the number
of quantized accumulator bits; in this case 4.
5
F0 2 N
)
Fs
510 218
)
8000
1-1149
NCO
The NCO block in the model is populated with the specifications and
quantities you just calculated. The output word length and fraction
length depend on the constraints of your hardware; this example uses a
word length of 16 and a fraction length of 14. You can verify that the
specifications of this problem have been met by looking at the NCO
Characterization pane of the NCO block.
1-1150
NCO
Experiment with the model to observe the effects on the output shown
on the Spectrum Analyzer. For example, try turning dithering on and
off, and try changing the number of dither bits.
1-1151
NCO
Dialog
Box
1-1152
NCO
Phase increment
Specify the phase increment. Only integer data types, including
fixed-point data types with zero fraction length, are allowed. The
dimensions of the phase increment are dictated by those of the
phase offset:
When you specify the phase offset on the block dialog box, the
phase increment must be a scalar or a vector with the same
length as the phase offset. The block applies each element
of the vector to a different channel, and therefore the vector
length defines the number of output channels.
When you specify the phase offset via an input port, the offset
port treats each column of the input as an independent channel.
The phase increment length must equal the number of columns
in the input to the offset port.
This parameter is visible only if you set the Phase increment
source parameter to Specify via dialog.
Phase offset source
Choose how you specify the phase offset. The phase offset can
come from an input port or from the dialog.
If you select Input port, the offset port appears on the block
icon.
If you select Specify via dialog, the Phase offset parameter
appears.
When you specify the phase offset via an input port, it can be
a scalar, vector, or a full matrix. The block treats each column
of the input to the offset port as an independent channel. The
number of channels in the phase offset must match the number of
channels in the data input. For each frame of the input, the block
can apply different phase offsets to each sample and channel.
Only integer data types, including fixed-point data types with
zero fraction length, are allowed.
1-1153
NCO
Phase offset
Specify the phase offset. When you specify the phase offset using
this parameter rather than via an input port, it must be a scalar or
vector with the same length as the phase increment. Scalars are
expanded to a vector with the same length as the phase increment.
Each element of the phase offset vector is applied to a different
channel of the input, and therefore the vector length defines the
number of output channels. Only integer data types, including
fixed-point data types with zero fraction length, are allowed.
This parameter is visible only if Specify via dialog is selected
for the Phase offset source parameter.
Add internal dither
Select to add internal dithering to the NCO algorithm.
Dithering is added using the PN Sequence Generator from the
Communications System Toolbox product.
Number of dither bits
Specify the number of dither bits.
This parameter is visible only if Add internal dither is selected.
Quantize phase
Select to enable quantization of the accumulated phase.
Number of quantized accumulator bits
Specify the number of quantized accumulator bits. This
determines the number of entries in the lookup table. The number
of quantized accumulator bits must be less than the accumulator
word length.
This parameter is visible only if Quantize phase is selected.
Show phase quantization error port
Select to output the phase quantization error. When you select
this, the Qerr port appears on the block icon.
This parameter is visible only if Quantize phase is selected.
1-1154
NCO
Output signal
Choose whether the block should output a Sine, Cosine, Complex
exponential, or Sine and cosine signals. If you select Sine and
cosine, the two signals output on different ports.
Sample time
Specify the sample time in seconds when the block is acting as a
source. When either the phase increment or phase offset come
in via block input ports, the sample time is inherited and this
parameter is not visible.
Samples per frame
Specify the number of samples per frame. When the value of this
parameter is 1, the block outputs a sample-based signal. When the
value is greater than 1, the block outputs a frame-based signal of
the specified size. In frame-based mode, the phase increment and
phase offset can vary from channel to channel and from frame to
frame, but they are constant along each channel in a given frame.
When the phase offset input port exists, it has the same frame
status as any output port present. When the phase increment
input port exists, it does not support frames.
This parameter is only visible if either Phase increment source
or Phase offset source is set to Specify via dialog.
The Data Types pane of the NCO dialog appears as follows.
1-1155
NCO
Rounding mode
The rounding mode used for this block when inputs are fixed
point is always Floor.
Overflow mode
The overflow mode used for this block when inputs are fixed point
is always Wrap.
Accumulator
Specify the word length of the accumulator data type. The fraction
length is always zero; this is an integer data type.
1-1156
NCO
Output
Specify the output data type.
Choose double or single for a floating-point implementation.
When you select Binary point scaling, you can enter the
word length and the fraction length of the output, in bits.
Note The lookup table for this block is constructed from
double-precision floating-point values. Thus, the maximum
amount of precision you can achieve in your output is 53 bits.
Setting the word length of the Output data type to values greater
than 53 bits does not improve the precision of your output.
The NCO Characterization pane of the NCO dialog appears as
follows.
1-1157
NCO
1-1158
NCO
Quarter wave sine lookup table size The quarter wave sine
lookup table size is defined by
(number of data points for lookup table) ( output word length )
8
bytes
Supported
Data
Types
SFDR = ( 6 P ) dB
without dither
SFDR = ( 6 P + 12 ) dB
witth dither
Port
inc
offset
sin
Qerr
1-1159
NCO
See Also
1-1160
PN Sequence
Generator
Sine Wave
Purpose
Library
Signal Operations
dspsigops
Description
The NCO HDL Optimized block generates real or complex sinusoidal
signals, while providing hardware-friendly control signals. It uses the
same phase accumulation and lookup table technology as implemented
in the NCO block. The lookup table in the generated HDL is mapped
to a ROM. You can use the lookup table compression option to reduce
the lookup table size with less than one LSB loss in precision. The NCO
HDL Optimized block provides an optional reset port that triggers
a reset of the phase to its initial value during the sinusoid output
generation. It has an optional input port for external dither and an
optional output port for the current NCO phase.
Signal Attributes
The following image illustrates the port signals of the interface for the
NCO HDL Optimized block.
1-1161
Direction
Description
Data Type
inc
Input
offset
Input
dither
Input
reset
Input
Boolean
validIn
Input
Boolean
Output
Double/single/signed
binary point scaling
Cos
Output
Double/single/signed
binary point scaling
1-1162
Port
Direction
Description
Data Type
phase
Output
fixdt(1,M,0). M is the
quantized accumulator
bits.
validOut
Output
Boolean
Dialog
Boxes
1-1163
1-1164
the dialog box. The default value is Input port. If you select
Property, the Phase increment parameter appears in the dialog
box.
Phase increment
Specify the phase increment. The default value is 100. This value
is scalar.
This parameter is visible when you set Phase increment source
to Property.
Phase offset source
Defines how you specify the phase offset. You can set the phase
offset from an input port or from the dialog box. The default value
is Property. If you select Input port, the offset port appears
on the block icon.
Phase offset
Specify the phase offset. The default value is 0. This value is
scalar. You can use integer data types, including fixed-point data
types with zero fraction length.
This parameter is visible when you set Phase offset source to
Property.
Dither source
Defines how you specify the dither. The default value is Property.
You can set the dither from an input port or from the dialog box.
If you select Property, the Number of dither bits parameter
appears in the dialog box.
If you select None , the block does not add dither.
Number of dither bits
Specify the dither bits. The default value is 4. This value must be
a positive integer.
This option is visible when you set Dither source to Property.
1-1165
Quantize phase
Select to enable quantization of the accumulated phase. The
default value is selected.
When you select Quantize phase, the Number of quantizer
accumulator bits parameter appears.
Number of quantizer accumulator bits
Specify the number of quantized accumulator bits. The default
value is 12. This parameter determines the number of entries
needed in the lookup table of sine values. The number of quantized
accumulator bits must be less than the accumulator word length.
This parameter is visible only if you select Quantize phase.
Enable lookup table compression method
Compress the lookup table when selected. The default value is
not selected.
Enable reset input port
Reset the accumulator to 0 when selected. The default value is
not selected.
Type of output signal
Choose whether the block output is Sine, Cosine, Complex
exponential, or Sine and cosine signals. If you select complex
exponential, the output is of the form sine + j*cosine. If you
select Sine and cosine, the sine and cosine values are sent out
on different ports. The default is Sine.
Show phase port
Output the current phase when selected. The default is not
selected.
Simulate using
Type of simulation to run. The default is Code generation. This
parameter does not affect generated HDL code.
Code generation
1-1166
Simulate model using generated C code. The first time you run
a simulation, Simulink generates C code for the block. The C
code is reused for subsequent simulations. This option requires
additional startup time, but provides faster simulation speed
than Interpreted execution.
Interpreted execution
Simulate model using the MATLAB interpreter. This option
shortens startup times, but has slower simulation speeds than
Code Generation.
1-1167
Rounding Mode
The rounding mode when inputs are fixed point is Floor.
Overflow Mode
The overflow mode when inputs are fixed point is Wrap.
1-1168
1-1169
Architecture
The NCO HDL Optimized block supports the default architecture
only.
ConstrainedOutputPipeline
Specify a nonnegative number of registers at the outputs of a
block. See ConstrainedOutputPipeline.
InputPipeline
Specify an implementation with input pipelining for selected
blocks. The parameter value specifies the number of input pipeline
stages (pipeline depth) in the generated code. See InputPipeline
LUTRegisterResetType
The reset type of the lookup table output register. Select None to
synthesize the lookup table to a ROM.
1-1170
OutputPipeline
Specify a implementation with output pipelining for selected
blocks. The parameter value specifies the number of output
pipeline stages (pipeline depth) in the generated code. See
OutputPipeline
Algorithms
(0 A
)
2
(0 B
24 )
2
(0 C
2 8 )
2
1-1171
a fine correction factor that you can truncate to fewer bits without
losing precision. With the default accumulator size of 16 bits, and the
example phase width of 12 bits, the LUTs use only 2816 plus 284 bits
(5kb). A quarter sine lookup table would use 21216 bits (65kb). This
approximation is accurate within 1 LSB which gives an SNR of at least
60 dB on the output. See L. Cordesses, "Direct Digital Synthesis: A
Tool for Periodic Wave Generation (Part 1)", IEEE Signal Processing
Magazine, DSP Tips & Tricks column, pp. 5054, Vol. 21, No. 4 July
2004.
Control Signals
There are two input control signals, reset and validIn, and one output
control signal, validOut. When reset is high, the block sets the phase
accumulator to zero. When validIn is high, the block increments the
phase. When validIn is low, the block stops the phase accumulator and
holds its state. When validOut is high, the output is valid.
Delays
The latency introduced by the NCO HDL Optimized block is 6 cycles.
See Also
Related
Examples
1-1172
NCO
IEEE 802.11 WLAN - HDL Optimized Beacon Frame Receiver with
Captured Data
Normalization
Purpose
Library
Description
V (i, k) = U 2 (i, j, k)
j =1
Y (i, j, k) =
U (i, j, k)
V (i, k) + b
Y (i, j, k) =
U (i, j, k)
V (i, k)2 + b
1-1173
Normalization
Examples
See Zero Algorithmic Delay in the DSP System Toolbox Users Guide
for an example.
Dialog
Box
1-1174
Normalization
Norm
Specify the type of normalization to perform, 2-norm or Squared
2-norm. 2-norm mode supports floating-point signals only.
Squared 2-norm supports both fixed-point and floating-point
signals.
Normalization bias
Specify the real value b to be added in the denominator to avoid
division by zero. Tunable.
1-1175
Normalization
Normalize over
Specify whether to normalize along rows, columns, or the
dimension specified in the Dimension parameter.
Dimension
Specify the one-based value of the dimension over which to
normalize. The value of this parameter cannot exceed the number
of dimensions in the input signal. This parameter is only visible
if Specified dimension is selected for the Normalize over
parameter.
Treat sample-based row input as a column
Select to treat a sample-based row input as a column.
Note This check box will be removed in a future release. See
Sample-Based Row Vector Processing Changes in the DSP
System Toolbox Release Notes.
The Data Types pane of the Normalization dialog appears as follows.
1-1176
Normalization
1-1177
Normalization
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-1174 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
Same
as product output
1-1178
Normalization
Same
as product output
1-1179
Normalization
Supported
Data
Types
Port
Input
Output
See Also
1-1180
Array-Vector
Multiply
Reciprocal Condition
norm
MATLAB
Nyquist Filter
Purpose
Library
Description
Dialog
Box
See Nyquist Filter Design Dialog Box Main Pane on page 4-764 for
more information about the parameters of this block. The Data Types
and Code Generation panes are not available for blocks in the DSP
System Toolbox Filter Designs library.
Parameters of this block that do not change filter order or structure
are tunable.
1-1181
Nyquist Filter
1-1182
Nyquist Filter
Filter Specifications
In this group, you specify your filter format, such as the impulse
response and the filter order.
Band
Specifies the location of the center of the transition region between
the passband and the stopband. The center of the transition
region, Fc, is calculated using the value for Band:
Fc = Fs/(2Band).
The default value, 2, corresponds to a halfband filter.
Impulse response
Select either FIR or IIR from the drop-down list. FIR is the
default. When you choose an impulse response, the design
methods and structures you can use to implement your filter
change accordingly. These options are both available only when
Band is 2. For values of Band greater than 2, only FIR designs
are supported.
1-1183
Nyquist Filter
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Filter order mode
Select either Minimum (the default) or Specify from the drop-down
list. Selecting Specify enables the Order option (see the
following sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, the block specifies a single-rate filter.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Filter order mode.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default value is 2.
Interpolation Factor
Enter the interpolation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default value is 2.
Frequency Specifications
The parameters in this group allow you to specify your filter response
curve.
1-1184
Nyquist Filter
Frequency constraints
Select the filter features that the block uses to define the
frequency response characteristics.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Transition width
Specify the width of the transition between the end of the
passband and the edge of the stopband. Specify the value in
normalized frequency units or the absolute units you select in
Frequency units.
Magnitude Specifications
Parameters in this group specify the filter response in the passbands
and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. From the drop-down list, select one of the following
options:
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Squared Specify the magnitude in squared units.
1-1185
Nyquist Filter
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
1-1186
Nyquist Filter
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is Butterworth, and the default FIR
method is Kaiser window.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method.
This section does not present all of the available options for
all designs and design methods. There are many more that
you encounter as you select different design methods and filter
specifications. The following options represent some of the most
common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in
the grid is the value you enter for Density factor times
(filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the
time required to design the filter. The default value of
1-1187
Nyquist Filter
1-1188
Nyquist Filter
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
1-1189
Nyquist Filter
1-1190
Nyquist Filter
Supported
Data
Types
Port
Input
Output
1-1191
Octave Filter
Purpose
Library
Description
Dialog
Box
See Octave Filter Design Dialog Box Main Pane on page 4-772 for
more information about the parameters of this block. The Data Types
and Code Generation panes are not available for blocks in the DSP
System Toolbox Filter Designs library.
Parameters of this block that do not change filter order or structure
are tunable.
1-1192
Octave Filter
1-1193
Octave Filter
Filter Specifications
Order
Specify filter order. Possible values are: 4, 6, 8, 10.
Bands per octave
Specify the number of bands per octave. Possible values are: 1,
3, 6, 12, 24.
Frequency units
Specify frequency units as Hz or kHz.
Input Fs
Specify the input sampling frequency in the frequency units
specified previously.
Center Frequency
Select from the drop-down list of available center frequency
values.
Algorithm
Design Method
Butterworth is the design method used for this type of filter.
Scale SOS filter coefficients to reduce chance of overflow
Select the check box to scale the filter coefficients.
1-1194
Octave Filter
Filter Implementation
Structure
Specify filter structure. Choose from:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Optimize for unit-scale values
Select this check box to scale unit gains between sections in SOS
filters. This parameter is available only for SOS filters.
1-1195
Octave Filter
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed
see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
Rate options
When the Filter type parameter specifies a multirate filter,
select the rate processing rule for the block from following options:
Enforce single-rate processing When you select this
option, the block maintains the sample rate of the input.
Allow multirate processing When you select this option,
the block adjusts the rate at the output to accommodate an
increased or reduced number of samples. To select this option,
you must set the Input processing parameter to Elements as
channels (sample based).
Use symbolic names for coefficients
Select this check box to enable the specification of coefficients
using MATLAB variables. The available coefficient names differ
depending on the filter structure. Using symbolic names allows
1-1196
Octave Filter
Supported
Data
Types
Port
Input
Output
1-1197
Offset
Purpose
Library
Signal Operations
dspsigops
Description
The Offset block removes or keeps values from the beginning or end of
the input vectors. You specify the length of the output vectors using the
Output port length parameter. The inputs to the In ports (In1, In2,
...) can be scalars or vectors, but they must be the same size and data
type. The offset values are the inputs to the O ports (O1, O2, ...); they
must be scalar values with the same data type. These offset values
should be integer values because they determine the number of values
the block discards or retains from each input vector. The block rounds
any offset value that is a noninteger value to the nearest integer value.
There is one output port for each pair of In and O ports.
Use the Mode parameter to determine which values the block discards
or retains from the input vector. To discard the initial values of the
vector, select Remove beginning samples. To discard the final values
of the vector, select Remove ending samples. To retain the initial
values of the vector, select Keep beginning samples. To retain the
final values of a vector, select Keep ending samples.
Use the Number of input data-offset pairs parameter to specify the
number of inputs to the block. The number of input ports is twice the
scalar value you enter. For example, if you enter 3, ports In1, O1, In2,
O2, In3, and O3 appear on the block.
The block uses the Output port length parameter to determine the
length of the output vectors. If you select Same as input, the block
outputs vectors that are the same length as the input to the In ports.
If you select User-defined, the Output length parameter appears.
Enter a scalar that represents the desired length of the output vectors.
If your desired output length is greater than the number of values you
extracted from your input vector, the block zero-pads the end of the
vector to reach the length you specified.
1-1198
Offset
Use the Action for out of range offset value parameter to determine
how the block behaves when an offset value is not in the range 0 offset
value N, where N is the input vector length. Select Clip if you want
any offset values less than 0 to be set to 0 and any offset values greater
than N to be set to N. Select Clip and warn if you want to be warned
when any offset values less than 0 are set to 0 and any offset values
greater than N are set to N. Select Error if you want the simulation to
stop and display an error when the offset values are out of range.
Dialog
Box
Mode
Use this parameter to determine which values the block discards
or retains from the input vector. Your choices are Remove
beginning samples, Remove ending samples, Keep beginning
samples, and Keep ending samples.
Number of input data-offset pairs
Specify the number of inputs to the block. The number of input
ports is twice the scalar value you enter.
1-1199
Offset
1-1200
Offset
Supported
Data
Types
Port
In
Out
1-1201
Purpose
Library
Description
H ( z) = B( z) = b1 + b2 z1 + + bn+1 z n
The numerator coefficients for H(z) are specified as a vector by the FIR
coefficients parameter. The coefficient vector, b = [b(1) b(2) ...
b(n+1)], can be generated by one of the filter design functions in the
Signal Processing Toolbox product, such as fir1. All filter states are
internally initialized to zero.
When either the filter coefficients or the inputs to the block are complex,
the Output parameter should be set to Complex. Otherwise, the default
Output setting, Real, instructs the block to take only the real part
of the solution.
The blocks overlap-add operation is equivalent to
1-1202
y = ifft(fft(u(i:i+L-1),nfft) .* fft(b,nfft))
Latency
In single-tasking operation, the Overlap-Add FFT Filter block has a
latency of nfft-n+1 samples. The first nfft-n+1 consecutive outputs
from the block are zero; the first filtered input value appears at the
output as sample nfft-n+2.
In multitasking operation, the Overlap-Add FFT Filter block has a
latency of 2*(nfft-n+1) samples. The first 2*(nfft-n+1) consecutive
outputs from the block are zero; the first filtered input value appears at
the output as sample 2*(nfft-n)+3.
Note For more information on latency and the Simulink software
tasking modes, see Excess Algorithmic Delay (Tasking Latency) and
Scheduling in the Simulink Coder documentation.
1-1203
Dialog
Box
FFT size
The size of the FFT, which should be a power-of-two value greater
than the length of the specified FIR filter.
FIR coefficients
The filter numerator coefficients.
1-1204
Output
The complexity of the output; Real or Complex. When the input
signal or the filter coefficients are complex, this should be set
to Complex.
Treat Mx1 and unoriented sample-based signals as
Specify how the block treats sample-based M-by-1 column vectors
and unoriented sample-based vectors of length M. You can select
one of the following options:
One channel When you select this option, the block treats
M-by-1 and unoriented sample-based inputs as a column vector
(one channel).
M channels (this choice will be removed
see
release notes) When you select this option, the block
treats M-by-1 and unoriented sample-based inputs as a 1-by-M
row vector.
Note This parameter will be removed in a future release. At that
time, the block will always treat M-by-1 and unoriented vectors as
a single channel.
References
Supported
Data
Types
See Also
1-1205
Purpose
Library
Description
H ( z) = B( z) = b1 + b2 z1 + + bn+1 z n
The numerator coefficients for H(z) are specified as a vector by the FIR
coefficients parameter. The coefficient vector, b = [b(1) b(2) ...
b(n+1)], can be generated by one of the filter design functions in the
Signal Processing Toolbox product, such as fir1. All filter states are
internally initialized to zero.
When either the filter coefficients or the inputs to the block are complex,
the Output parameter should be set to Complex. Otherwise, the default
Output setting, Real, instructs the block to take only the real part
of the solution.
The circular convolution of each section is computed by multiplying the
FFTs of the input section and filter coefficients, and computing the
inverse FFT of the product.
y = ifft(fft(u(i:i+(L-1)),nfft) .* fft(b,nfft))
1-1206
where you specify nfft in the FFT size parameter as a power of two
value greater (typically much greater) than n+1. Values for FFT
size that are not powers of two are rounded upwards to the nearest
power-of-two value to obtain nfft.
The first n points of the circular convolution are invalid and are
discarded. The Overlap-Save FFT Filter block outputs the remaining
nfft-n points, which are equivalent to the linear convolution.
Latency
In single-tasking operation, the Overlap-Save FFT Filter block has a
latency of nfft-n+1 samples. The first nfft-n+1 consecutive outputs
from the block are zero; the first filtered input value appears at the
output as sample nfft-n+2.
In multitasking operation, the Overlap-Save FFT Filter block has a
latency of 2*(nfft-n+1) samples. The first 2*(nfft-n+1) consecutive
outputs from the block are zero; the first filtered input value appears at
the output as sample 2*(nfft-n)+3.
Note For more information on latency and the Simulink environment
tasking modes, see Excess Algorithmic Delay (Tasking Latency) and
Scheduling in the Simulink Coder documentation.
1-1207
Dialog
Box
FFT size
The size of the FFT, which should be a power of two value greater
than the length of the specified FIR filter.
FIR coefficients
The filter numerator coefficients.
1-1208
Output
The complexity of the output; Real or Complex. When the input
signal or the filter coefficients are complex, this should be set
to Complex.
Treat Mx1 and unoriented sample-based signals as
Specify how the block treats sample-based M-by-1 column vectors
and unoriented sample-based vectors of length M. You can select
one of the following options:
One channel When you select this option, the block treats
M-by-1 and unoriented sample-based inputs as a column vector
(one channel).
M channels (this choice will be removed
see
release notes) When you select this option, the block
treats M-by-1 and unoriented sample-based inputs as a 1-by-M
row vector.
Note This parameter will be removed in a future release. At that
time, the block will always treat M-by-1 and unoriented vectors as
a single channel.
References
Supported
Data
Types
See Also
Overlap-Add FFT
Filter
1-1209
Overwrite Values
Purpose
Library
Description
The block accepts scalars, vectors and matrices. The output always has
the same size as the original input signal, not necessarily the same
size as the signal containing the overwriting values. The input(s) and
output of this block must have the same data type.
1-1210
Overwrite Values
overwriting values at each time step. The output inherits its size and
rate from the input signal, not the overwriting values.
The rate at which you provide the overwriting values through input
port V must match the rate at which the block receives each input
matrix at input port A. In other words, the input signals must have
the same Simulink sample time.
Example
A single element in
the input
v = 9
A length-k portion of
the diagonal
k=3
v = [2 4 6]
or
2
4
6
1-1211
Overwrite Values
A length-k portion of a
row
A length-k portion of a
column
An m-by-n submatrix
Example
k=3
v = [2 4 6]
k=2
4
v=
6
m=2
n=3
1-1212
4 5 6
v=
7 8 9
Overwrite Values
Dialog
Box
Note Only some of the following parameters are visible in the dialog
box at any one time.
1-1213
Overwrite Values
Overwrite
Determines whether to overwrite a specified submatrix or a
specified portion of the diagonal.
Source of overwriting value(s)
Determines where you must provide the overwriting values: either
through an input port, or by providing them in the Overwrite
with parameter. For more information, see Specifying the
Overwriting Values on page 1-1210.
Overwrite with
The value(s) with which to overwrite the specified portion of
the input matrix. Enabled only when Source of overwriting
value(s) is set to Specify via dialog. To learn how to specify
valid overwriting values, see Valid Overwriting Values on page
1-1211.
Row span
The range of input rows to be overwritten. Options are All rows,
One row, or Range of rows. For descriptions of these options, see
Dialog Box on page 1-1213.
Row/Starting row
The input row that is the first row of the submatrix that the
block overwrites. For a description of the options for the Row
and Starting row parameters, see Settings for Row, Column,
Starting Row, and Starting Column Parameters on page 1-1219.
Row is enabled when Row span is set to One row, and Starting
row when Row span is set to Range of rows.
Row index/Starting row index
Index of the input row that is the first row of the submatrix that
the block overwrites. See how to use these parameters in Settings
for Row, Column, Starting Row, and Starting Column Parameters
on page 1-1219. Row index is enabled when Row is set to Index,
and Starting row index when Starting row is set to Index.
Row offset/Starting row offset
The offset of the input row that is the first row of the submatrix
that the block overwrites. See how to use these parameters in
1-1214
Overwrite Values
1-1215
Overwrite Values
1-1216
Overwrite Values
1-1217
Overwrite Values
but Last.
Ending element index
Index of the input diagonal element that is the last element of
the subdiagonal that the block overwrites. See how to use this
parameter in Ending Element Parameters on page 1-1224. This
parameter is enabled when Ending element is set to Index.
Ending element offset
The offset of the input diagonal element that is the last element
of the subdiagonal that the block overwrites. See how to use this
parameter in Ending Element Parameters on page 1-1224. This
parameter is enabled when Ending element is set to Offset
from middle or Offset from last.
Examples
Overwriting a Submatrix
To overwrite a submatrix, follow these steps:
1 Set the Overwrite parameter to Submatrix.
2 Specify the overwriting values as described in Specifying the
the submatrix that you want to overwrite by setting the Row span
parameter to one of the following options and the Column span to
the analogous column-related options:
All rows The submatrix contains all rows of the input matrix.
One row The submatrix contains only one row of the input
matrix, which you must specify in the Row parameter, as
described in the following table.
Range of rows The submatrix contains one or more rows of the
input, which you must specify in the Starting Row and Ending
row parameters, as described in the following tables.
1-1218
Overwrite Values
4 When you set Row span to One row or Range of rows, you need
First
Index
Offset from
last
Last
1-1219
Overwrite Values
Settings for Row, Column, Starting Row, and Starting Column Parameters
(Continued)
Settings for
Specifying
the
Submatrixs
First Row or
Column
Offset from
middle
Middle
floor(M/2 + 1 - rowOffset)
where M is the number of input
rows, and rowOffset is the value of
floor(M/2 + 1)
where M is the number of input rows
Index
Offset from
last
N - colOffset
where N is the number of input
1-1220
Overwrite Values
Last
Offset from
middle
floor(M/2 + 1 - rowOffset)
where M is the number of input
rows, and rowOffset is the value of
floor(N/2 + 1 - rowOffset)
where N is the number of input
columns, and colOffset is the
Middle
floor(M/2 + 1)
where M is the number of input rows
1-1221
Overwrite Values
There are often several possible parameter combinations that select the
same submatrix from the input. For example, instead of specifying Last
for Ending column, you could select the same submatrix by specifying
Ending column = Index
Ending column index = 5
1-1222
Overwrite Values
Overwriting a Subdiagonal
To overwrite a subdiagonal, follow these steps:
1 Set the Overwrite parameter to Diagonal.
2 Specify the overwriting values as described in Specifying the
First
Index
1-1223
Overwrite Values
Last
Index
Last
1-1224
Overwrite Values
Middle
floor(M/2 + 1)
where M is the number of input rows
Supported
Data
Types
The input(s) and output of this block must have the same data type.
Port
1-1225
Overwrite Values
Port
See Also
1-1226
Reshape
Simulink
Selector
Simulink
Submatrix
Variable Selector
reshape
MATLAB
Pad
Purpose
Library
Signal Operations
dspsigops
Description
The Pad block extends or crops the dimensions of the input by padding
or truncating along its columns, rows, columns and rows, or any
dimension(s) you specify. Truncation occurs when you specify output
dimensions that are shorter than the corresponding input dimensions. If
the input and output lengths are the same, the block is a pass-through.
You can enter the pad value in the block mask or via an input port. You
can enter output sizes in the block mask, or have the block pad the
specified dimensions until their length is the next highest power of two.
The Pad signal at parameter controls whether the specified input
dimensions are padded or truncated at their beginning, end, or both.
For odd pad or truncation lengths, the extra pad value or truncation
is applied to the end of the signal. When the block is in Specified
dimensions mode, you can specify either the output size or the pad size.
You can have the block warn or error when an input signal is truncated
using the Action when truncation occurs parameter.
1-1227
Pad
Dialog
Box
Pad over
Specify the dimensions over which to pad or truncate: Columns,
Rows, Columns and rows, None, or Specified dimensions.
Dimensions to pad
Specify the one-based dimension(s) over which to pad or truncate.
The value for this parameter can be a scalar or a vector. For
example, specify 1 to pad columns. Specify [1 2] to pad columns
and rows. Specify [1 3 5] to pad the first, third, and fifth
dimensions.
This parameter is only visible when Specified dimensions is
selected for the Pad over parameter.
1-1228
Pad
1-1229
Pad
1-1230
Pad
1-1231
Pad
Supported
Data
Types
Port
Input
Double-precision floating-point
Single-precision floating-point
Fixed point (signed and unsigned)
Boolean
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
Output
Double-precision floating-point
Single-precision floating-point
Fixed point (signed and unsigned)
Boolean
1-1232
Pad
Port
See Also
Upsample
Variable Selector
1-1233
Parametric Equalizer
Purpose
Library
Description
Dialog
Box
1-1234
Parametric Equalizer
1-1235
Parametric Equalizer
Filter Specifications
Order mode
Select Minimum to design a minimum order filter that meets the
design specifications, or Specify to enter a specific filter order.
The order mode also affects the possible frequency constraints,
which in turn limit the gain specifications. For example, if you
specify a Minimum order filter, the available frequency constraints
are:
1-1236
Parametric Equalizer
Order
Specify the filter order. This parameter is enabled only if the
Order mode is set to Specify.
Frequency specifications
Depending on the filter order, the possible frequency constraints
change. Once you choose the frequency constraints, the input boxes in
this area change to reflect the selection.
Frequency constraints
Select the specification to represent the frequency constraints.
The following options are available:
Center frequency, bandwidth, passband width (available
for minimum order only)
Center frequency, bandwidth, stopband width (available
for minimum order only)
Center frequency, bandwidth (available for a specified order
only)
Center frequency, quality factor (available for a specified
order only)
Shelf type, cutoff frequency, quality factor (available
for a specified order only)
Shelf type, cutoff frequency, shelf slope parameter
(available for a specified order only)
Low frequency, high frequency (available for a specified
order only)
Frequency units
Select the frequency units from the available drop down list
(Normalized, Hz, kHz, MHz, GHz). If Normalized is selected,
then the Input Fs box is disabled for input.
1-1237
Parametric Equalizer
Input Fs
Enter the input sampling frequency. This input box is disabled
for input if Normalized is selected in the Frequency units input
box.
Center frequency
Enter the center frequency in the units specified by the value in
Frequency units.
Bandwidth
The bandwidth determines the frequency points at which the
filter magnitude is attenuated by the value specified as the
Bandwidth gain in the Gain specifications section. By default,
the Bandwidth gain defaults to db(sqrt(.5)), or 3 dB relative
to the center frequency. The Bandwidth property only applies
when the Frequency constraints are: Center frequency,
bandwidth, passband width, Center frequency, bandwidth,
stopband width, or Center frequency, bandwidth.
Passband width
The passband width determines the frequency points at which
the filter magnitude is attenuated by the value specified as the
Passband gain in the Gain specifications section. This option
is enabled only if the filter is of minimum order, and the frequency
constraint selected is Center frequency, bandwidth, passband
width.
Stopband width
The stopband width determines the frequency points at which
the filter magnitude is attenuated by the value specified as the
Stopband gain in the Gain specifications section. This option
is enabled only if the filter is of minimum order, and the frequency
constraint selected is Center frequency, bandwidth, stopband
width.
Low frequency
Enter the low frequency cutoff. This option is enabled only if the
filter order is user specified and the frequency constraint selected
1-1238
Parametric Equalizer
Gain Specifications
Depending on the filter order and frequency constraints, the possible
gain constraints change. Also, once you choose the gain constraints the
input boxes in this area change to reflect the selection.
Gain constraints
Select the specification array to represent gain constraints,
and remember that not all of these options are available for all
configurations. The following is a list of all available options:
Reference, center frequency, bandwidth, passband
Reference, center frequency, bandwidth, stopband
Reference, center frequency, bandwidth, passband,
stopband
1-1239
Parametric Equalizer
Bandwidth gain
Specifies the gain in Gain units at which the bandwidth is
defined. This property applies only when the Frequency
constraints specification contains a bandwidth parameter, or is
Low frequency, high frequency.
Center frequency gain
Specify the center frequency in Gain units
Passband gain
The passband gain determines the level in Gain units at which
the passband is defined. The passband is determined either by
the Passband width value, or the Low frequency and High
frequency values in the Frequency specifications section.
Stopband gain
The stopband gain is the level in Gain units at which the
stopband is defined. This property applies only when the Order
mode is minimum and the Frequency constaints are Center
frequency, bandwidth, stopband width.
Boost/cut gain
The boost/cut gain applies only when the designing a shelving
filter. Shelving filters include the Shelf type parameter in the
Frequency constraints specification. The gain in the passband
of the shelving filter is increased by Boost/cut gain dB from a
floor gain of 0 dB.
Algorithm
Design method
Select the design method from the drop-down list. Different
methods are available depending on the chosen filter constraints.
Scale SOS filter coefficients to reduce chance of overflow
Select the check box to scale the filter coefficients.
1-1240
Parametric Equalizer
Filter Implementation
Structure
Specify filter structure. Choose from:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
The high-level implementation provides better compatibility
across various filter structures, especially filters that would
contain algebraic loops when constructed using basic elements.
On the other hand, using basic elements enables the following
optimization parameters:
Optimize for zero gains Terminate chains that contain
Gain blocks with a gain of zero.
Optimize for unit gains Remove Gain blocks that scale
by a factor of one.
Optimize for delay chains Substitute delay chains made
up of n unit delays with a single delay by n.
Optimize for negative gains Use subtraction in Sum
blocks instead of negative gains in Gain blocks.
Optimize for unit-scale values
Select this check box to scale unit gains between sections in SOS
filters. This parameter is available only for SOS filters.
1-1241
Parametric Equalizer
Input processing
Specify how the block should process the input. The available
options may vary depending on he settings of the Filter
Structure and Use basic elements for filter customization
parameters. You can set this parameter to one of the following
options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed
see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
Rate options
When the Filter type parameter specifies a multirate filter,
select the rate processing rule for the block from following options:
Enforce single-rate processing When you select this
option, the block maintains the sample rate of the input.
Allow multirate processing When you select this option,
the block adjusts the rate at the output to accommodate an
increased or reduced number of samples. To select this option,
you must set the Input processing parameter to Elements as
channels (sample based).
Use symbolic names for coefficients
Select this check box to enable the specification of coefficients
using MATLAB variables. The available coefficient names differ
depending on the filter structure. Using symbolic names allows
1-1242
Parametric Equalizer
Supported
Data
Types
Port
Input
Output
1-1243
Peak Finder
Purpose
Library
Signal Operations
dspsigops
Description
The Peak Finder block counts the number of local extrema in each
column of the real-valued input signal. The block outputs the number
of local extrema at the Cnt port. You can also configure the block to
output the extrema indices, the extrema values, and a binary indicator
of whether or not the extrema are maxima or minima.
To qualify as an extrema, a point has to be larger (or smaller) than
both of its neighboring points. Thus, end points are never considered
extrema.
If you select the Output peak indices check box, the Idx port appears
on the block. The block outputs the zero-based extrema indices at the
Idx port. If you select the Output peak values check box, the Val
port appears on the block. The block outputs the extrema values at the
Val port. If you select either of these check boxes and set the Peak
type(s) to Maxima and Minima, the Pol port also appears on the block.
If the signal value is a maximum, the block outputs a 1 at the Pol
("Polarity") port. If the signal value is a minimum, the block outputs
a 0 at the Pol port.
Use the Maximum number of peaks to find parameter to specify how
many extrema to look for in each input signal. The block stops searching
the input signal once this maximum number of extrema has been found.
If you select the Ignore peaks within threshold of neighboring
values check box, the block no longer detects low-amplitude peaks.
This feature allows the block to ignore noise within a threshold value
that you define. Enter a threshold value for the Threshold parameter.
Now, the current value is a maximum if (current previous) > threshold
and (current next) > threshold. The current value is a minimum if
(current previous) < threshold and (current next) < threshold.
1-1244
Peak Finder
Examples
Example 1
Consider the input vector
[9 6 10 3 4 5 0 12]
The table below shows the analysis made by the Peak Finder block.
Note that the first and last input signal values are not considered:
Previous, current, and next values
9 6 10
6 10 3
10 3 4
345
4 5
0
5 0 12
10
Therefore, for this example the outputs at the block ports are
Cnt: 5
Idx: [1 2 3 5 6]
Val: [6 10 3 5 0]
Pol: [0 1 0 1 0]
Example 2
Note that the Overflow mode parameter can affect the output of the
block when the input is fixed point. Consider the following model:
1-1245
Peak Finder
1-1246
Peak Finder
1-1247
Peak Finder
Dialog
Box
The Main pane of the Peak Finder block dialog appears as follows.
Peak type(s)
Specify whether you are looking for maxima, minima, or both.
Output peak indices
Select this check box if you want the block to output the extrema
indices at the Idx port.
Output peak values
Select this check box if you want the block to output the extrema
values at the Val port.
1-1248
Peak Finder
1-1249
Peak Finder
Overflow mode
Select the overflow mode to be used when block inputs are fixed
point.
1-1250
Peak Finder
Supported
Data
Types
Port
Input
Cnt
Idx
Val
Pol
See Also
Boolean
Maximum
Minimum
1-1251
Peak-Notch Filter
Purpose
Library
Description
Dialog
Box
See Peak/Notch Filter Design Dialog Box Main Pane on page 4-781
for more information about the parameters of this block. The Data
Types and Code Generation panes are not available for blocks in the
DSP System Toolbox Filter Designs library.
Parameters of this block that do not change filter order or structure
are tunable.
1-1252
Peak-Notch Filter
1-1253
Peak-Notch Filter
Filter Specifications
In this area you can specify whether you want to design a peaking filter
or a notching filter, as well as the order of the filter.
Response
Select Peak or Notch from the drop-down list. The rest of the
parameters that specify are equivalent for either filter type.
Order
Enter the filter order. The order must be even.
Frequency Specifications
This group of parameters allows you to specify frequency constraints
and units.
Frequency Constraints
Select the frequency constraints for filter specification. There are
two choices as follows:
Center frequency and quality factor
Center frequency and bandwidth
Frequency units
The frequency units are normalized by default. If you specify
units other than normalized, the block assumes that you wish to
specify an input sampling frequency, and enables this input box.
The choice of frequency units are: Normalized (0 to 1), Hz,
kHz, MHz, GHz.
1-1254
Peak-Notch Filter
Input Fs
This input box is enabled if Frequency units other than
Normalized (0 to 1) are specified. Enter the input sampling
frequency.
Center frequency
Enter the center frequency in the units specified previously.
Quality Factor
This input box is enabled only when Center frequency and
quality factor is chosen for the Frequency Constraints.
Enter the quality factor.
Bandwidth
This input box is enabled only when Center frequency and
bandwidth is chosen for the Frequency Constraints. Enter
the bandwidth.
Magnitude Specifications
This group of parameters allows you to specify the magnitude
constraints, as well as their values and units.
Magnitude Constraints
Depending on the choice of constraints, the other input boxes
are enabled or disabled. Select from four magnitude constraints
available:
Unconstrained
Passband ripple
Stopband attenuation
Passband ripple and stopband attenuation
Magnitude units
Select the magnitude units: either dB or squared.
1-1255
Peak-Notch Filter
Apass
This input box is enabled if the magnitude constraints selected
are Passband ripple or Passband ripple and stopband
attenuation. Enter the passband ripple.
Astop
This input box is enabled if the magnitude constraints selected
are Stopband attenuation or Passband ripple and stopband
attenuation. Enter the stopband attenuation.
Algorithm
The parameters in this group allow you to specify the design method
and structure of your filter.
Design Method
Lists all design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter the methods available to design filters
changes as well.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Filter Implementation
Structure
Specify filter structure. Choose from:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
1-1256
Peak-Notch Filter
1-1257
Peak-Notch Filter
Supported
Data
Types
Port
Input
Output
1-1258
Periodogram
Purpose
Library
Description
1-1259
Periodogram
Dialog
Box
1-1260
Measurement
Specify the type of measurement for the block to perform: Power
spectral density or Mean-square spectrum. Tunable.
Periodogram
Window
Select the type of window to apply. See the Window Function
block reference page for more details. Tunable.
Stopband attenuation in dB
Enter the level, in decibels (dB), of stopband attenuation, Rs, for
the Chebyshev window. This parameter becomes visible if, for the
Window parameter, you choose Chebyshev. Tunable.
Beta
Enter the parameter for the Kaiser window. This parameter
becomes visible if, for the Window parameter, you chose
Kaiser. Increasing Beta widens the mainlobe and decreases the
amplitude of the sidelobes in the displayed frequency magnitude
response. Tunable. See the Window Function block reference
page for more details.
Window sampling
From the list, choose Symmetric or Periodic. See the Window
Function block reference page for more details.Tunable.
FFT implementation
Set this parameter to FFTW [1], [2] to support an arbitrary length
input signal. The block restricts generated code with FFTW
implementation to MATLAB host computers.
Set this parameter to Radix-2 for bit-reversed processing, fixed
or floating-point data, or for portable C-code generation using the
Simulink Coder. The first dimension M, of the input matrix must
be a power of two. To work with other input sizes, use the Pad
block to pad or truncate these dimensions to powers of two, or if
possible choose the FFTW implementation.
Set this parameter to Auto to let the block choose the FFT
implementation. For non-power-of-two transform lengths, the
block restricts generated code to MATLAB host computers.
1-1261
Periodogram
1-1262
Periodogram
Example
References
References
[1] FFTW (http://www.fftw.org)
[2] Frigo, M. and S. G. Johnson, FFTW: An Adaptive Software
Architecture for the FFT,Proceedings of the International Conference on
Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.
1-1263
Periodogram
Supported
Data
Types
Port
Input
Output
See Also
Burg Method
Magnitude FFT
Short-Time FFT
Spectrum Analyzer
Window Function
Yule-Walker Method
1-1264
Permute Matrix
Purpose
Library
Description
For row permutation, the block treats length-M unoriented vector input
at the A port as an M-by-1 matrix.
When the Permute parameter is set to Columns, the block uses the
columns of A to create a new matrix with the same row dimension.
Input P is a length-L vector whose elements determine where each
column from A should be placed in the M-by-L output matrix.
% Equivalent MATLAB code
y = [A(:,P(1)) A(:,P(2)) A(:,P(3)) ... A(:,P(end))]
1-1265
Permute Matrix
Examples
In the model below, the top Permute Matrix block places the second row
of the input matrix in both the first and fifth rows of the output matrix,
and places the third row of the input matrix in the three middle rows of
the output matrix. The bottom Permute Matrix block places the second
column of the input matrix in both the first and fifth columns of the
output matrix, and places the third column of the input matrix in the
three middle columns of the output matrix.
As shown in the example above, rows and columns of A can appear any
number of times in the output, or not at all.
1-1266
Permute Matrix
Dialog
Box
Permute
Method of constructing the output matrix; by permuting rows
or columns of the input.
Index mode
When set to One-based, a value of 1 in the permutation vector P
refers to the first row or column of the input matrix A. When set to
Zero-based, a value of 0 in P refers to the first row or column of A.
Invalid permutation index
Response to an invalid index value. Tunable.
Error when length of P is not equal to Permute dimension size
Option to display an error dialog box and terminate the simulation
when the length of the permutation vector P is not equal to the
number of rows or columns of the input matrix A.
1-1267
Permute Matrix
Supported
Data
Types
Port
Output
See Also
1-1268
Submatrix
Transpose
Permute Matrix
Variable Selector
permute
MATLAB
1-1269
Polynomial Evaluation
Purpose
Library
Description
y = u4 + 2u3 + 3u2 + 4u + 5
y = u4 + 3u2 + 5
y = u4 + ( 2 + i ) u3 + 3u2 + ( 4 3i ) u + 5i
1-1270
Polynomial Evaluation
Dialog
Box
Supported
Data
Types
See Also
Math Function
Simulink
Sum
Simulink
polyval
MATLAB
1-1271
Purpose
Library
Description
f ( x) = u1 x M 1 + u2 x M 2 + + uM
arranged in order of descending exponents, u1, u2, ..., uM. The polynomial
has order M-1 and positive integer exponents.
Inputs to the block represent the polynomial coefficients as shown in
the previous equation. The block always treats length-M unoriented
vector input as an M-by-1 matrix.
The output is a 1-by-N matrix with each column containing the value
1 or 0. The value 1 indicates that the polynomial in the corresponding
column of the input is stable; that is, the magnitudes of all solutions
to f(x) = 0 are less than 1. The value 0 indicates that the polynomial in
the corresponding column of the input might be unstable; that is, the
magnitude of at least one solution to f(x) = 0 is greater than or equal to 1.
Applications
This block is most commonly used to check the pole locations of the
denominator polynomial, A(z), of a transfer function, H(z).
H ( z) =
1-1272
B( z) b1 + b2 z1 + + bm z(m1)
=
A( z) a1 + a2 z1 + + an z(n1)
The poles are the n-1 roots of the denominator polynomial, A(z). When
any poles are located outside the unit circle, the transfer function H(z)
is unstable. As is typical in DSP applications, the transfer function
above is specified in descending powers of z-1 rather than z.
Dialog
Box
Supported
Data
Types
See Also
Polynomial Evaluation
polyfit
MATLAB
1-1273
Pseudoinverse
Purpose
Library
Description
A = VSU
where U and V are orthogonal matrices, and S is a diagonal matrix.
The pseudoinverse has the following properties:
AA = ( AA )
A A = ( A A)
AA A = A
1-1274
Pseudoinverse
Dialog
Box
References
1-1275
Pseudoinverse
Supported
Data
Types
Port
See Also
Boolean
Cholesky Inverse
LDL Inverse
LU Inverse
Singular Value
Decomposition
inv
MATLAB
1-1276
Purpose
Library
Description
Dialog
Box
1-1277
1-1278
Filter Specifications
In this group, you specify the shape and length of the filter.
Pulse shape
Select the shape of the impulse response from the following
options:
Raised Cosine
Square Root Raised Cosine
Gaussian
Order mode
This specification is only available for raised cosine and square
root raised cosine filters. For these filters, select one of the
following options:
Minimum This option will result in the minimum-length filter
satisfying the user-specified Frequency specifications.
Specify orderThis option allows the user to construct a
raised cosine or square root cosine filter of a specified order by
entering an even number in the Order input box. The length
of the impulse response will be Order+1 .
1-1279
Frequency specifications
In this group, you specify the frequency response of the filter. For raised
cosine and square root raised cosine filters, the frequency specifications
include:
Rolloff factor
The rolloff factor takes values in the range [0,1]. The smaller the
rolloff factor, the steeper the transition in the stopband.
Frequency units
1-1280
Bandwidth-time product
This option allows the user to specify the width of the Gaussian
filter. Note that this is independent of the length of the filter.
The bandwidth-time product (BT) must be a positive real number.
Smaller values of the bandwidth-time product result in larger
pulse widths in time and steeper stopband transitions in the
frequency response.
Frequency units
Magnitude specifications
If the Order mode is specified as minimum, the magnitude units may
be selected from:
dB Specify the magnitude in decibels (default).
Linear Specify the magnitude in linear units.
Algorithm
The only design method available for FIR pulse-shaping filters is the
window method.
Filter Implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. FIR filters use direct-form structure.
Use basic elements to enable filter customization
Select this check box to implement the filter as a subsystem of
basic Simulink blocks. Clear the check box to implement the filter
as a high-level subsystem. By default, this check box is cleared.
1-1281
1-1282
Supported
Data
Types
Port
Input
Output
1-1283
QR Factorization
Purpose
Library
Description
i= j
When you select Full for the output size, Q is an M-by-M unitary
matrix, and R is a M-by-N upper-triangular matrix.
[Q R E] = qr(A)
1-1284
QR Factorization
Examples
command line.
2 Double-click the QR Factorization block, set the Output size
1-1285
QR Factorization
1-1286
QR Factorization
1-1287
QR Factorization
Dialog
Box
Output size
Specify the size of output matrices Q and R:
Economy When this output size is selected, the block outputs
an M-by-min(M,N) unitary matrix Q and a min(M,N)-by-N
upper-triangular matrix R.
Full When this output size is selected, the block outputs
an M-by-M unitary matrix Q and a M-by-N upper-triangular
matrix R.
References
Supported
Data
Types
Port
Input
Output
1-1288
QR Factorization
See Also
Cholesky Factorization
LU Factorization
QR Solver
qr
MATLAB
1-1289
QR Solver
Purpose
Library
Description
The QR Solver block solves the linear system AX=B, which can be
overdetermined, underdetermined, or exactly determined. The system
is solved by applying QR factorization to the M-by-N matrix, A, at the
A port. The input to the B port is the right side M-by-L matrix, B. The
block treats length-M unoriented vector input as an M-by-1 matrix.
The output at the x port is the N-by-L matrix, X. X is chosen to minimize
the sum of the squares of the elements of B-AX. When B is a vector,
this solution minimizes the vector 2-norm of the residual (B-AX is the
residual). When B is a matrix, this solution minimizes the matrix
Frobenius norm of the residual. In this case, the columns of X are the
solutions to the L corresponding systems AXk=Bk, where Bk is the kth
column of B, and Xk is the kth column of X.
X is known as the minimum-norm-residual solution to AX=B. The
minimum-norm-residual solution is unique for overdetermined
and exactly determined linear systems, but it is not unique for
underdetermined linear systems. Thus when the QR Solver is applied
to an underdetermined system, the output X is chosen such that the
number of nonzero entries in X is minimized.
Algorithm
1-1290
QR Solver
and
QRX = Be
is solved for X by noting that Q-1 = Q* and substituting Y = Q*Be.
This requires computing a matrix multiplication for Y and solving
a triangular system for X.
RX = Y
Dialog
Box
Supported
Data
Types
See Also
Levinson-Durbin
LDL Solver
LU Solver
QR Factorization
SVD Solver
1-1291
Quantizer
Purpose
Library
Quantizers
dspquant2
Description
1-1292
Queue
Purpose
Library
Description
The Queue block stores a sequence of input samples in a first in, first
out (FIFO) register. The register capacity is set by the Register size
parameter, and inputs can be scalars, vectors, or matrices.
The block pushes the input at the In port onto the end of the queue
when a trigger event is received at the Push port. When a trigger event
is received at the Pop port, the block pops the first element off the queue
and holds the Out port at that value. The first input to be pushed onto
the queue is always the first to be popped off.
1-1293
Queue
A trigger event at the optional Rst port empties the queue contents.
When you select Clear output port on reset, then a trigger event at
the Rst port empties the queue and sets the value at the Out port to
zero. This setting also applies when a disabled subsystem containing
the Queue block is reenabled; the Out port value is only reset to zero in
this case when you select Clear output port on reset.
When you select the Allow direct feedthrough check box and two or
more of the control input ports are triggered at the same time step, the
operations are executed in the following order:
1 Rst
2 Push
3 Pop
When you clear the Allow direct feedthrough check box and two or
more of the control input ports are triggered at the same time step, the
operations are executed in the following order:
1 Rst
2 Pop
3 Push
The rate of the trigger signal must be the same as the rate of the data
signal input. You specify the triggering event for the Push, Pop, and
Rst ports by the Trigger type pop-up menu:
Rising edge Triggers execution of the block when the trigger
input does one of the following:
1-1294
Queue
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge
Falling edge
Falling edge
Falling edge
1-1295
Queue
Note If your model contains any referenced models that use a Queue
block with the Push onto full register parameter set to Dynamic
reallocation, you cannot simulate your top-level model in Simulink
Accelerator mode.
The Push onto full register parameter specifies the blocks behavior
when a trigger is received at the Push port but the register is full. The
Pop empty register parameter specifies the blocks behavior when
a trigger is received at the Pop port but the register is empty. The
following options are available for both cases:
Ignore Ignore the trigger event, and continue the simulation.
Warning Ignore the trigger event, but display a warning message
in the MATLAB Command Window.
Error Display an error dialog box and terminate the simulation.
Note The Push onto full register and Pop empty register
parameters are diagnostic parameters. Like all diagnostic parameters
on the Configuration Parameters dialog box, they are set to Ignore in
the code generated for this block by Simulink Coder code generation
software.
The Push onto full register parameter additionally offers the
Dynamic reallocation option, which dynamically resizes the register
to accept as many additional inputs as memory permits. To find out
how many elements are on the queue at a given time, enable the Num
output port by selecting the Show number of register entries port
parameter.
1-1296
Queue
Examples
Example 1
The table below illustrates the Queue blocks operation for a Register
size of 4, Trigger type of Either edge, and Clear output port on
reset enabled. Because the block triggers on both rising and falling
edges in this example, each transition from 1 to 0 or 0 to 1 in the Push,
Pop, and Rst columns below represents a distinct trigger event. A 1
in the Empty column indicates an empty queue, while a 1 in the Full
column indicates a full queue.
In
Queue
Out
Empty Full
Num
1-1297
Queue
In
10
11
12
Queue
Out
Empty Full
Num
Note that at the last step shown, the Push and Rst ports are triggered
simultaneously. The Rst trigger takes precedence, and the queue is
first cleared and then pushed.
Example 2
The dspqdemo example provides another example of the operation of
the Queue block.
1-1298
Queue
Dialog
Box
Register size
The number of entries that the FIFO register can hold.
Trigger type
The type of event that triggers the blocks execution. The rate of
the trigger signal must be the same as the rate of the data signal
input.
1-1299
Queue
1-1300
Queue
Supported
Data
Types
Port
In
Push
1-1301
Queue
Port
Pop
Rst
Out
Empty
1-1302
Queue
Port
Full
Num
See Also
Buffer
Delay Line
Stack
1-1303
Random Source
Purpose
Library
Sources
dspsrcs4
Description
Distribution Type
When the Source type parameter is set to Uniform, the output samples
are drawn from a uniform distribution whose minimum and maximum
values are specified by the Minimum and Maximum parameters,
respectively. All values in this range are equally likely to be selected. A
length-N vector specified for one or both of these parameters generates
an N-channel output (M-by-N matrix) containing a unique random
distribution in each channel.
For example, specify
Minimum = [ 0 0 -3 -3]
1-1304
Random Source
Output Complexity
The blocks output can be either real or complex, as determined by
the Real and Complex options in the Complexity parameter. These
settings control all channels of the output, so real and complex data
cannot be combined in the same output. For complex output with a
1-1305
Random Source
channel are both drawn from the same uniform random distribution,
defined by the Minimum and Maximum parameters for that channel.
For complex output with a Gaussian distribution, the real and
imaginary components in each channel are drawn from normal
distributions with different means. In this case, the Mean parameter
for each channel should specify a complex value; the real component
of the Mean parameter specifies the mean of the real components in
the channel, while the imaginary component specifies the mean of
the imaginary components in the channel. When either the real or
imaginary component is omitted from the Mean parameter, a default
value of 0 is used for the mean of that component.
For example, a Mean parameter setting of [5+2i 0.5 3i] generates a
three-channel output with the following means.
Channel 1 mean
real = 5
imaginary = 2
Channel 2 mean
real = 0.5
imaginary = 0
Channel 3 mean
real = 0
imaginary = 3
1-1306
2
Re
=
2
2
2
Im
=
2
2
Random Source
Output Repeatability
The Repeatability parameter determines whether or not the block
outputs the same signal each time you run the simulation. You can set
the parameter to one of the following options:
Repeatable Outputs the same signal each time you run the
simulation. The first time you run the simulation, the block randomly
selects an initial seed. The block reuses these same initial seeds
every time you rerun the simulation.
Specify seed Outputs the same signal each time you run the
simulation. Every time you run the simulation, the block uses the
initial seed(s) specified in the Initial seed parameter. Also see
Specifying the Initial Seed on page 1-1307.
Not repeatable Does not output the same signal each time you
run the simulation. Every time you run the simulation, the block
randomly selects an initial seed.
1-1307
Random Source
Sample Period
The Sample time parameter value, Ts, specifies the random sequence
sample period when the Sample mode parameter is set to Discrete.
In this mode, the block generates the number of samples specified by
the Samples per frame parameter value, M, and outputs this frame
1-1308
Random Source
with a period of M*Ts. For M=1, the output is sample based; otherwise,
the output is frame based.
When Sample mode is set to Continuous, the block is configured for
continuous-time operation, and the Sample time and Samples per
frame parameters are disabled. Note that many DSP System Toolbox
blocks do not accept continuous-time inputs.
Dialog
Box
Only some of the parameters described below are visible in the dialog
box at any one time.
1-1309
Random Source
Source type
The distribution from which to draw the random values, Uniform
or Gaussian. For more information, see Distribution Type on
page 1-1304.
Method
The method by which the block computes the Gaussian random
values, Ziggurat or Sum of uniform values. This parameter
is enabled when Source type is set to Gaussian. For more
information, see Distribution Type on page 1-1304.
Minimum
The minimum value in the uniform distribution. This parameter
is enabled when you select Uniform from the Source type
parameter. Tunable.
Maximum
The maximum value in the uniform distribution. This parameter
is enabled when you select you select Uniform from the Source
type parameter. Tunable.
Number of uniform values to sum
The number of uniformly distributed random values to sum to
compute a single number in a Gaussian random distribution. This
parameter is enabled when the Source type parameter is set to
Gaussian, and the Method parameter is set to Sum of uniform
values. For more information, see Distribution Type on page
1-1304.
Mean
The mean of the Gaussian (normal) distribution. This parameter
is enabled when you select Gaussian from the Source type
parameter. Tunable.
Variance
The variance of the Gaussian (normal) distribution. This
parameter is enabled when you select Gaussian from the Source
type parameter. Tunable.
1-1310
Random Source
Repeatability
The repeatability of the block output: Not repeatable,
Repeatable, or Specify seed. In the Repeatable and Specify
seed settings, the block outputs the same signal every time you
run the simulation. For details, see Output Repeatability on
page 1-1307.
Initial seed
The initial seed(s) to use for the random number generator when
you set the Repeatability parameter to Specify seed. For
details, see Specifying the Initial Seed on page 1-1307. Tunable.
Inherit output port attributes
When you select this check box, block inherits the sample mode,
sample time, output data type, complexity, and signal dimensions
of a sample-based signal from a downstream block. When you
select this check box, the Sample mode, Sample time, Samples
per frame, Output data type, and Complexity parameters
are disabled.
Suppose you want to back propagate a 1-D vector. The output
of the Random Source block is a length M sample-based 1-D
vector, where length M is inherited from the downstream block.
When the Minimum, Maximum, Mean, or Variance parameter
specifies N channels, the 1-D vector output contains M/N samples
from each channel. An error occurs in this case when M is not
an integer multiple of N.
Suppose you want to back propagate a M-by-N signal. When
N>1, your signal has N channels. When N = 1, your signal has
M channels. The value of the Minimum, Maximum, Mean, or
Variance parameter can be a scalar or a vector of length equal
to the number of channels. You can specify these parameters
as either row or column vectors, except when the signal is a
row vector. In this case, the Minimum, Maximum, Mean, or
Variance parameter must also be specified as a row vector.
1-1311
Random Source
Sample mode
The sample mode, Continuous or Discrete. This parameter is
enabled when the Inherit output port attributes check box
is cleared.
Sample time
The sample period, Ts, of the random output sequence. The
output frame period is M*Ts. This parameter is enabled when the
Inherit output port attributes check box is cleared.
Samples per frame
The number of samples, M, in each output frame. When the value
of this parameter is 1, the block outputs a sample-based signal.
This parameter is enabled when the Inherit output port
attributes check box is cleared.
Output data type
The data type of the output, single-precision or double-precision.
This parameter is enabled when the Inherit output port
attributes check box is cleared.
Complexity
The complexity of the output, Real or Complex. This parameter
is enabled when the Inherit output port attributes check box
is cleared.
Supported
Data
Types
See Also
1-1312
Double-precision floating-point
Single-precision floating-point
Discrete Impulse
Maximum
Minimum
Random Source
Signal From
Workspace
Standard Deviation
Variance
Constant
Simulink
Random Number
Simulink
Signal Generator
Simulink
rand
MATLAB
randn
MATLAB
RandStream
MATLAB
1-1313
Real Cepstrum
Purpose
Library
Transforms
dspxfrm3
Description
The Real Cepstrum block computes the real cepstrum of each column in
the real-valued M-by-N input matrix, u. The block treats each column of
the input as an independent channel containing M consecutive samples.
The block does not accept complex-valued inputs.
The output is a real Mo-by-N matrix, where you specify Mo in the FFT
length parameter. Each output column contains the length-Mo real
cepstrum of the corresponding input column.
y = real(ifft(log(abs(fft(u,Mo)))))
When you select the Inherit FFT length from input port
dimensions check box, the output frame size matches the input frame
size (Mo=M). In this case, the block processes sample-based length-M
row vector inputs as a single channel (that is, as an M-by-1 column
vector), and returns the result as a length-M column vector. The block
always processes unoriented vector inputs as a single channel, and
returns the result as a length-M column vector.
The output port rate is the same as the input port rate.
1-1314
Real Cepstrum
Dialog
Box
Supported
Data
Types
See Also
Complex Cepstrum
DCT
FFT
rceps
1-1315
Reciprocal Condition
Purpose
Library
Description
or
y=
1
1
=
1
A
A
1
A 1 = 1 j M aij
i=1
1-1316
Reciprocal Condition
Dialog
Box
References
Supported
Data
Types
See Also
Matrix 1-Norm
Normalization
rcond
MATLAB
1-1317
Purpose
Library
dspobslib
Description
Note The Remez FIR Filter Design block is still supported but is likely
to be obsoleted in a future release. We strongly recommend replacing
this block with the Digital Filter block.
The Remez FIR Filter Design block implements the Parks-McClellan
algorithm to design and apply a linear-phase filter with an arbitrary
multiband magnitude response. The filter design, which uses the
Signal Processing Toolbox firpm function, minimizes the maximum
error between the desired frequency response and the actual frequency
response. Such filters are called equiripple due to the equiripple
behavior of their approximation error. The block applies the filter to a
discrete-time input using the Direct-Form II Transpose Filter block.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
The Filter type parameter allows you to specify one of the following
filters:
Multiband
The multiband filter has an arbitrary magnitude response and linear
phase.
Differentiator
The differentiator filter approximates the ideal differentiator.
Differentiators are antisymmetric FIR filters with approximately
linear magnitude responses. To obtain the correct derivative, scale
1-1318
1-1319
Examples
Example 1: Multiband
Consider a lowpass filter with a transition band in the normalized
frequency range 0.4 to 0.5, and 10 times greater error minimization in
the stopband than in the passband.
In this case:
Filter type = Multiband
1-1320
Example 2: Differentiator
Assume the specifications for a differentiator filter require it to have
order 21. The ramp response extends over the entire frequency range.
In this case, specify:
Filter type = Differentiator
Band-edge frequency vector = [0 1]
Gains at these frequencies = [0 pi*Fs]
Filter order = 21
For a type III even order filter, the differentiation band should stop
short of half the sample frequency. For example, if the filter order is 20,
you could specify the block parameters as follows:
Filter type = Differentiator
Band-edge frequency vector = [0 0.9]
Gains at these frequencies = [0 0.9*pi*Fs]
Filter order = 20
1-1321
Dialog
Box
Filter type
The filter type. Tunable.
Band-edge frequency vector
A vector of frequency points, in ascending order, in the range 0
to 1. The value 1 corresponds to half the sample frequency. This
vector must have even length. Tunable.
Gains at these frequencies
A vector of frequency-response magnitudes corresponding to the
points in the Band-edge frequency vector. This vector must be
the same length as the Band-edge frequency vector. Tunable.
Weights
A vector containing one weight for each frequency band. This
vector must be half the length of the Band-edge frequency and
Gains at these frequencies vectors. Tunable.
1-1322
Filter order
The filter order.
References
1-1323
Repeat
Purpose
Library
Signal Operations
dspsigops
Description
The Repeat block upsamples each channel of the Mi-by-N input to a rate
L times higher than the input sample rate. To do so, the block repeats
each consecutive input sample L times at the output. You specify the
integer L in the Repetition count parameter.
You can use the Repeat block inside of triggered subsystems when you
set the Rate options parameter to Enforce single-rate processing.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block upsamples each column of the
input over time. In this mode, the block can perform either single-rate
or multirate processing. You can use the Rate options parameter to
specify how the block upsamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input and output of the block have the same sample
rate. In this mode, the block outputs a signal with a proportionally
larger frame size than the input. The block upsamples each channel
independently by repeating each row of the input matrix L times at
the output. For upsampling by a factor of L, the output frame size is
L times larger than the input frame size (Mo = Mi*L), but the input
and output frame rates are equal.
For an example of single-rate upsampling, see Example: Single-Rate
Processing on page 1-1326.
When you set the Rate options parameter to Allow multirate
processing, the block treats an Mi-by-N matrix input as N
independent channels. The block generates the output at the faster
(upsampled) rate by using a proportionally shorter frame period at
the output port than at the input port. For L repetitions of the input,
the output frame period is L times shorter than the input frame
1-1324
Repeat
period (Tfo = Tfi/L). In this mode, the output always has the same
frame size as the input.
See Example: Multirate, Frame-Based Processing on page 1-1326 for
an example that uses the Repeat block in this mode.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats an M-by-N matrix input
as M*N independent channels, and upsamples each channel over time.
The block upsamples each channel over time such that the output
sample rate is L times higher than the input sample rate (Tso = Tsi/L).
In this mode, the output is always the same size as the input.
Zero Latency
The Repeat block has zero-tasking latency for all single-rate operations.
The block is in a single-rate mode if you set the Repetition count
parameter to 1 or if you set the Input processing parameter to
Columns as channels (frame based) and the Rate options
parameter to Enforce single-rate processing.
The Repeat block also has zero-tasking latency for multirate operations
if you run your model in Simulink single-tasking mode.
Zero-tasking latency means that the block repeats the first input
(received at t=0) for the first L output samples, the second input for the
next L output samples, and so on.
Nonzero Latency
The Repeat block has tasking latency for multirate, multitasking
operation:
In multirate, sample-based processing mode, the initial condition for
each channel is repeated for the first L output samples. The channels
first input appears as output sample L+1. The Initial conditions
parameter can be an Mi-by-N matrix containing one value for each
channel, or a scalar to be applied to all signal channels.
1-1325
Repeat
Examples
1-1326
Repeat
Dialog
Box
Repetition count
The integer number of times, L, that the input value is repeated
at the output. This is the factor by which the block increases the
output frame size or sample rate.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select this
option, the block treats each column of the input as a separate
1-1327
Repeat
1-1328
Repeat
Supported
Data
Types
Port
Input
Output
See Also
FIR Interpolation
Upsample
1-1329
Purpose
Compute filter estimates for input using RLS adaptive filter algorithm
Library
dspobslib
Description
Note The RLS Adaptive Filter block is still supported but is likely to be
obsoleted in a future release. We strongly recommend replacing this
block with the RLS Filter block.
The RLS Adaptive Filter block recursively computes the recursive least
squares (RLS) estimate of the FIR filter coefficients.
The corresponding RLS filter is expressed in matrix form as
k(n) =
1 P (n 1)u(n)
1 + 1u H (n) P (n 1)u(n)
H
y(n) = w (n 1)u(n)
e(n) = d(n) y(n)
w(n) = w(n 1) + k(n) e* (n)
P (n) = 1 P (n 1) 1 k(n)u H (n) P (n 1)
where -1 denotes the reciprocal of the exponential weighting factor.
The variables are as follows
Variable
Description
u(n)
P(n)
k(n)
w(n)
1-1330
Variable
Description
y(n)
e(n)
d(n)
The block icon has port labels corresponding to the inputs and outputs
of the RLS algorithm. Note that inputs to the In and Err ports must be
sample-based scalars. The signal at the Out port is a scalar, while the
signal at the Taps port is a sample-based vector.
Block Ports
Corresponding Variables
In
Out
Err
Taps
An optional Adapt input port is added when you select the Adapt
input check box in the dialog box. When this port is enabled, the block
continuously adapts the filter coefficients while the Adapt input is
nonzero. A zero-valued input to the Adapt port causes the block to stop
adapting, and to hold the filter coefficients at their current values until
the next nonzero Adapt input.
The implementation of the algorithm in the block is optimized by
exploiting the symmetry of the inverse correlation matrix P(n). This
decreases the total number of computations by a factor of two.
The FIR filter length parameter specifies the length of the filter
that the RLS algorithm estimates. The Memory weighting factor
corresponds to in the equations, and specifies how quickly the filter
1-1331
Examples
1-1332
Dialog
Box
1-1333
References
Supported
Data
Types
See Also
Kalman Adaptive
Filter (Obsolete)
1-1334
RLS Filter
Purpose
Compute filtered output, filter error, and filter weights for given input
and desired signal using RLS adaptive filter algorithm
Library
Description
The RLS Filter block recursively computes the least squares estimate
(RLS) of the FIR filter weights. The block estimates the filter weights,
or coefficients, needed to convert the input signal into the desired
signal. Connect the signal you want to filter to the Input port. The
input signal can be a scalar or a column vector. Connect the signal you
want to model to the Desired port. The desired signal must have the
same data type, complexity, and dimensions as the input signal. The
Output port outputs the filtered input signal. The Error port outputs
the result of subtracting the output signal from the desired signal.
The corresponding RLS filter is expressed in matrix form as
k(n) =
1 P(n 1)u(n)
1 + 1 u H (n)P(n 1)u(n)
y(n) = w(n 1)u(n)
e(n) = d(n) y(n)
u(n)
P(n)
1-1335
RLS Filter
Variable Description
The gain vector at step n
k(n)
w(n)
y(n)
e(n)
d(n)
1
1
< < 1 , where L is the filter length. You can specify a forgetting
2
factorLusing the input port, Lambda, or enter a value in the Forgetting
factor (0 to 1) parameter in the Block Parameters: RLS Filter dialog
box.
Enter the initial filter weights, w(0) , as a vector or a scalar for the
Initial value of filter weights parameter. When you enter a scalar,
the block uses the scalar value to create a vector of filter weights. This
vector has length equal to the filter length and all of its values are
equal to the scalar value.
The initial value of P(n) is
1-1336
RLS Filter
Rising edge
Rising edge
Rising edge
Rising edge
1-1337
RLS Filter
Falling edge
Falling edge
Falling edge
Falling edge
Examples
1-1338
RLS Filter
Dialog
Box
Filter length
Enter the length of the FIR filter weights vector.
Specify forgetting factor via
Select Dialog to enter a value for the forgetting factor in the
Block parameters: RLS Filter dialog box. Select Input port to
specify the forgetting factor using the Lambda input port.
1-1339
RLS Filter
Forgetting factor (0 to 1)
Enter the exponential weighting factor in the range 0 1. A
value of 1 specifies an infinite memory. Tunable.
Initial value of filter weights
Specify the initial values of the FIR filter weights.
Initial input variance estimate
The initial value of 1/P(n).
Adapt port
Select this check box to enable the Adapt input port.
Reset input
Select this check box to enable the Reset input port.
Output filter weights
Select this check box to export the filter weights from the Wts port.
References
Supported
Data
Types
See Also
Kalman Adaptive
Filter (Obsolete)
LMS Filter
1-1340
RMS
Purpose
Library
Statistics
dspstat3
Description
The RMS block computes the RMS value of each row or column of the
input, along vectors of a specified dimension of the input, or of the entire
input. The RMS block can also track the RMS value in a sequence of
inputs over a period of time. The Running RMS parameter selects
between basic operation and running operation.
Basic Operation
When you do not select the Running RMS check box, the block
computes the RMS value of each row or column of the input, along
vectors of a specified dimension of the input, or of the entire input at
each individual sample time, and outputs the array y. Each element in
y is the RMS value of the corresponding column, row, vector, or entire
input. The output y depends on the setting of the Find the RMS value
over parameter. For example, consider a 3-dimensional input signal
of size M-by-N-by-P:
Entire input The output at each sample time is a scalar that
contains the RMS value of the entire input.
Each row The output at each sample time consists of an
M-by-1-by-P array, where each element contains the RMS value of
each vector over the second dimension of the input. For an input that
is an M-by-N matrix, the output at each sample time is an M-by-1
column vector.
Each column The output at each sample time consists of a
1-by-N-by-P array, where each element contains the RMS value of
each vector over the first dimension of the input. For an input that
is an M-by-N matrix, the output at each sample time is a 1-by-N
row vector.
1-1341
RMS
yj =
uij
i=1
1 j N
y = sqrt(sum(u.*conj(u))/size(u,1))
Running Operation
When you select the Running RMS check box, the block tracks the
RMS value of successive inputs to the block. In this mode, you must
also specify a value for the Input processing parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains the
RMS value of the element uij over all inputs since the last reset.
When you select Columns as channels (frame based), the block
outputs an M-by-N matrix. Each element yij of the output contains
the RMS value of the jth column over all inputs since the last reset,
up to and including element uij of the current input.
Running Operation for Variable-Size Inputs
When your inputs are of variable size, and you select the Running
RMS check box, there are two options:
1-1342
RMS
1-1343
RMS
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
Falling edge
Falling edge
Falling edge
Falling edge
1-1344
RMS
Examples
1-1345
RMS
1-1346
RMS
Dialog
Box
Running RMS
Enables running operation when selected.
Input processing
Specify how the block should process the input when computing
the running RMS. You can set this parameter to one of the
following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
This parameter appears only when you select the Running RMS
check box.
1-1347
RMS
1-1348
RMS
Supported
Data
Types
See Also
Mean
Variance
1-1349
Purpose
Library
Signal Operations
dspsigops
Description
The Sample and Hold block acquires the input at the signal port
whenever it receives a trigger event at the trigger port (marked by ).
The block then holds the output at the acquired input value until the
next triggering event occurs.
The trigger input must be a sample-based scalar with sample rate equal
to the input frame rate at the signal port. You specify the trigger event
using the Trigger type parameter:
Rising edge triggers the block to acquire the signal input when the
trigger input rises from a negative value or zero to a positive value.
Falling edge triggers the block to acquire the signal input when the
trigger input falls from a positive value or zero to a negative value.
Either edge triggers the block to acquire the signal input when the
trigger input either rises from a negative value or zero to a positive
value or falls from a positive value or zero to a negative value.
You specify the blocks output prior to the first trigger event using the
Initial condition parameter. When the acquired input is an M-by-N
matrix, the Initial condition can be an M-by-N matrix, or a scalar
to be repeated across all elements of the matrix. When the input is a
length-M unoriented vector, the Initial condition can be a length-M
row or column vector, or a scalar to be repeated across all elements of
the vector.
If you select the Latch (buffer) input check box, the block outputs the
value of the input from the previous time step until the next triggering
event occurs. To use this block in a loop, select this check box.
1-1350
Dialog
Box
Trigger type
The type of event that triggers the block to acquire the input
signal.
Initial condition
The blocks output prior to the first trigger event.
Latch (buffer) input
If you select this check box, the block outputs the value of the
input from the previous time step until the next triggering event
occurs.
1-1351
Supported
Data
Types
Port
Input
Trigger
Outputs
See Also
1-1352
Downsample
N-Sample Switch
Purpose
Convert input signal into set of quantized output values or index values,
or convert set of index values into quantized output signal
Library
dspobslib
Description
1-1353
The boundary points can have equal or varied spacing. Any input
values between 0 and 0.5 would correspond to index 0. Input values
between 0.5 and 3.7 would correspond to index 1, and so on.
Suppose you wanted to create an unbounded quantizer with the
following boundary points:
[-inf 0 2 5.5 7.1 10 inf]
When your input signal has values less than 0, these values would be
assigned to index 0. When your input signal has values greater than
10, these values would be assigned to index 6.
When an input value is the same as a boundary point, the Tie-breaking
rule parameter defines the index to which the value is assigned. When
you want the input value to be assigned to the lower index value, select
Choose the lower index. To assign the input value with the higher
index, select Choose the higher index.
In Decoder and Encoder and decoder mode, the Codebook is a vector
of quantized output values that correspond to each index value.
In Encoder and Encoder and decoder mode, the Searching method
determines how the appropriate quantizer index is found. Select Linear
and the Scalar Quantizer block compares the input value to the first
region defined by the first two boundary points. When the input value
does not fall within this region, the block then compares the input
value to the next region. This process continues until the input value is
determined to be within a region and is associated with the appropriate
index value. The computational cost of this process is of the order P,
where P is the number of boundary points.
1-1354
Select Binary for the Searching method and the block compares the
input value to the middle value of the boundary points vector. When
the input value is larger than this boundary point, the block discards
the boundary points that are lower than this middle value. The block
then compares the input value to the middle boundary point of the
new range, defined by the remaining boundary points. This process
continues until the input value is associated with the appropriate index
value. The computational cost of this process is of the order log2P,
where P is the number of boundary points. In most cases, the Binary
option is faster than the Linear option.
In Decoder mode, the input to this block is a vector of index values,
where 0 index <N and N is the length of the codebook vector. Use the
Action for out of range input parameter to determine what happens
when an input index value is out of this range. When you want any
index values less than 0 to be set to 0 and any index values greater than
or equal to N to be set to N -1, select Clip. When you want to be warned
when any index values less than 0 are set to 0 and any index values
greater than or equal to N are set to N -1, select Clip and warn. When
you want the simulation to stop and display an error when the index
values are out of range, select Error.
In Encoder and decoder mode, you can select the Output the
quantization error check box. The quantization error is the difference
between the input value and the quantized output value. Select this
check box to output the quantization error for each input value from
the Err port on this block.
1-1355
int32. The data type of the codebook values can be double, single,
uint8, uint16, uint32, int8, int16, or int32.
1-1356
Dialog
Box
1-1357
1-1358
1-1359
Quantizer mode
Specify Encoder, Decoder, or Encoder and decoder as a mode of
operation.
Source of quantizer parameters
Choose Specify via dialog to type the parameters into the
block parameters dialog box. Select Input ports to specify the
parameters using the blocks input ports. In Encoder and Encoder
and decoder mode, input the Boundary points using port B. In
Decoder and Encoder and decoder mode, input the Codebook
values using port C.
Boundary points
Enter a vector of values that represent the boundary points of
the quantizer regions. Tunable.
Codebook
Enter a vector of quantized output values that correspond to each
index value. Tunable.
Searching method
Select Linear and the block finds the region in which the input
value is located using a linear search. Select Binary and the
block finds the region in which the input value is located using a
binary search.
Tie-breaking rule
Set this parameter to determine the behavior of the block when
the input value is the same as the boundary point. When you
select Choose the lower index, the input value is assigned to
lower index value. When you select Choose the higher index,
the value is assigned to the higher index.
Action for out of range input
Choose the blocks behavior when an input index value is out of
range, where 0 index <N and N is the length of the codebook
vector. Select Clip, when you want any index values less than 0
to be set to 0 and any index values greater than or equal to N
to be set to N -1. Select Clip and warn, when you want to be
warned when any index values less than 0 are set to 0 and any
1-1360
References
Supported
Data
Types
1-1361
See Also
1-1362
Quantizer
Simulink
Uniform Encoder
Uniform Decoder
Purpose
Library
Quantizers
dspquant2
Description
1-1363
If, for the Source of codebook parameter you select Input port,
the quantized output values have the same data type as the codebook
values input at port C.
Dialog
Box
The Main pane of the Scalar Quantizer Decoder block dialog appears
as follows.
1-1364
Source of codebook
Choose Specify via dialog to type the codebook values into
the block parameters dialog box. Select Input port to specify
the codebook using input port C.
Codebook values
Enter a vector of quantized output values that correspond to each
index value. Tunable.
The Data Types pane of the Scalar Quantizer Decoder block dialog
appears as follows.
Same
1-1365
References
Supported
Data
Types
Port
Q(U)
1-1366
Port
For more information on what data types are supported for each
quantizer mode, see Data Type Support on page 1-1363.
See Also
Quantizer
Simulink
Uniform Encoder
Uniform Decoder
1-1367
Purpose
Library
Quantizers
dspquant2
Description
1-1368
the design process to stop when the fractional drop in the squared
quantization error is below a certain value, select Relative threshold.
Then, for Relative threshold, type the maximum acceptable fractional
drop. When you want the design process to stop after a certain
number of iterations, choose Maximum iteration. Then, enter the
maximum number of iterations you want the block to perform in the
Maximum iteration field. For Stopping criteria, you can also
choose Whichever comes first and enter a Relative threshold and
Maximum iteration value. The block stops iterating as soon as one of
these conditions is satisfied.
With each iteration, the block quantizes the training set values based
on the newly calculated codebook values and boundary points. When
the training point lies on a boundary point, the algorithm uses the
Tie-breaking rules parameter to determine which region the value is
associated with. When you want the training point to be assigned to the
lower indexed region, select Lower indexed codeword. To assign the
training point with the higher indexed region, select Higher indexed
codeword.
The Searching methods parameter determines how the block
compares the training points to the boundary points. Select Linear
search and SQDTool compares each training point to each quantization
1-1369
region sequentially. This process continues until all the training points
are associated with the appropriate regions.
Select Binary search for the Searching methods parameter and the
block compares the training point to the middle value of the boundary
points vector. When the training point is larger than this boundary
point, the block discards the lower boundary points. The block then
compares the training point to the middle boundary point of the
new range, defined by the remaining boundary points. This process
continues until the training point is associated with the appropriate
region.
Click Design and Plot to design the quantizer with the parameter
values specified on the left side of the GUI. The performance curve and
the staircase character of the quantizer are updated and displayed in
the figures on the right side of the GUI.
Note You must click Design and Plot to apply any changes you make
to the parameter values in the SQDTool dialog box.
SQDTool can export parameter values that correspond to the figures
displayed in the GUI. Click the Export Outputs button, or press
Ctrl+E, to export the Final Codebook, Final Boundary Points, and
Error values to the workspace, a text file, or a MAT-file. The Error
values represent the mean squared error for each iteration.
In the Model section of the GUI, specify the destination of the block
that will contain the parameters of your quantizer. For Destination,
select Current model to create a block with your parameters in the
model you most recently selected. Type gcs in the MATLAB Command
Window to display the name of your current model. Select New model to
create a block in a new model file.
From the Block type list, select Encoder to design a Scalar Quantizer
Encoder block. Select Decoder to design a Scalar Quantizer Decoder
block. Select Both to design a Scalar Quantizer Encoder block and a
Scalar Quantizer Decoder block.
1-1370
In the Encoder block name field, enter a name for the Scalar
Quantizer Encoder block. In the Decoder block name field, enter a
name for the Scalar Quantizer Decoder block. When you have a Scalar
Quantizer Encoder and/or Decoder block in your destination model with
the same name, select the Overwrite target block(s) check box to
replace the blocks parameters with the current parameters. When you
do not select this check box, a new Scalar Quantizer Encoder and/or
Decoder block is created in your destination model.
Click Generate Model. SQDTool uses the parameters that correspond
to the current plots to set the parameters of the Scalar Quantizer
Encoder and/or Decoder blocks.
1-1371
Dialog
Box
1-1372
Training Set
Enter the samples of the signal you would like to quantize. This
data set can be a MATLAB function or a variable defined in the
MATLAB workspace. The typical length of this data vector is 1e6.
Source of initial codebook
Select Auto-generate to have the block choose the initial
codebook values. Select User defined to enter your own initial
codebook values.
Number of levels
Enter the length of the codebook vector. For a b-bit quantizer, the
length should be N = 2b.
Initial codebook
Enter your initial codebook values. From the Source of initial
codebook list, select User defined in order to activate this
parameter.
Source of initial boundary points
Select Mid-points to locate the boundary points at the midpoint
between the codebook values. Choose User defined to enter your
own boundary points. From the Source of initial codebook list,
select User defined in order to activate this parameter.
Initial boundary points (unbounded)
Enter your initial boundary points. This block assumes that you
are designing an unbounded quantizer. Therefore, the first and
last boundary point are -inf and inf, regardless of any other
boundary point values you might enter. From the Source of
initial boundary points list, select User defined in order to
activate this parameter.
Stopping criteria
Choose Relative threshold to enter the maximum acceptable
fractional drop in the squared quantization error. Choose Maximum
iteration to specify the number of iterations at which to stop.
Choose Whichever comes first and the block stops the iteration
process as soon as the relative threshold or maximum iteration
value is attained.
1-1373
Relative threshold
Type the value that is the maximum acceptable fractional drop in
the squared quantization error.
Maximum iteration
Enter the maximum number of iterations you want the block
to perform. From the Stopping criteria list, select Maximum
iteration in order to activate this parameter.
Searching methods
Choose Linear search to use a linear search method when
comparing the training points to the boundary points. Choose
Binary search to use a binary search method when comparing
the training points to the boundary points.
Tie-breaking rules
When a training point lies on a boundary point, choose Lower
indexed codeword to assign the training point to the lower
indexed quantization region. Choose Higher indexed codeword
to assign the training point to the higher indexed region.
Design and Plot
Click this button to display the performance curve and the
staircase character of the quantizer in the figures on the right
side of the GUI. These plots are based on the current parameter
settings.
You must click Design and Plot to apply any changes you make
to the parameter values in the SQDTool GUI.
Export Outputs
Click this button, or press Ctrl+E, to export the Final Codebook,
Final Boundary Points, and Error values to the workspace, a
text file, or a MAT-file.
Destination
Choose Current model to create a Scalar Quantizer block in
the model you most recently selected. Type gcs in the MATLAB
Command Window to display the name of your current model.
Choose New model to create a block in a new model file.
1-1374
Block type
Select Encoder to design a Scalar Quantizer Encoder block. Select
Decoder to design a Scalar Quantizer Decoder block. Select
Both to design a Scalar Quantizer Encoder block and a Scalar
Quantizer Decoder block.
Encoder block name
Enter a name for the Scalar Quantizer Encoder block.
Decoder block name
Enter a name for the Scalar Quantizer Decoder block.
Overwrite target block(s)
When you do not select this check box and a Scalar Quantizer
Encoder and/or Decoder block with the same block name exists
in the destination model, a new Scalar Quantizer Encoder and/or
Decoder block is created in the destination model. When you
select this check box and a Scalar Quantizer Encoder and/or
Decoder block with the same block name exists in the destination
model, the parameters of these blocks are overwritten by new
parameters.
Generate Model
Click this button and SQDTool uses the parameters that
correspond to the current plots to set the parameters of the Scalar
Quantizer Encoder and/or Decoder blocks.
References
Supported
Data
Types
See Also
Quantizer
Simulink
1-1375
1-1376
Uniform Encoder
Uniform Decoder
Purpose
Library
Quantizers
dspquant2
Description
1-1377
The block assigns any input values between 0 and 0.5 to index 0, input
values between 0.5 and 3.7 to index 1, and so on. The block assigns
any values that are less than 0 to index 0, the lowest index value.
The block assigns any values that are greater than 11 to index 4, the
highest index value.
To create an unbounded quantizer, from the Partitioning list, select
Unbounded and enter the following boundary points:
[0 0.5 3.7 5.8 6.0 11]
The block assigns any input values between 0 and 0.5 to index 1, input
values between 0.5 and 3.7 to index 2, and so on. The block assigns
any input values less than 0 to index 0 and any values greater than 11
to index 6.
The Searching method parameter determines how the appropriate
quantizer index is found. When you select Linear, the Scalar Quantizer
Encoder block compares the input value to the first region defined
by the first two boundary points. When the input value does not fall
within this region, the block then compares the input value to the next
region. This process continues until the input value is determined to
be within a region and is associated with the appropriate index value.
The computational cost of this process is of the order P, where P is the
number of boundary points.
When you select Binary for the Searching method, the block
compares the input value to the middle value of the boundary points
vector. When the input value is larger than this boundary point, the
block discards the boundary points that are lower than this middle
value. The block then compares the input value to the middle boundary
point of the new range, defined by the remaining boundary points.
This process continues until the input value is associated with the
appropriate index value. The computational cost of this process is of the
order log2P, where P is the number of boundary points. In most cases,
the Binary option is faster than the Linear option.
When an input value is the same as a boundary point, the Tie-breaking
rule parameter determines the region to which the value is assigned.
1-1378
When you want the input value to be assigned to the lower indexed
region, select Choose the lower index. To assign the input value with
the higher indexed region, select Choose the higher index.
Select the Output codeword check box to output the codeword values
that correspond to each index value at port Q(U).
Select the Output the quantization error check box to output the
quantization error for each input value from the Err port on this block.
The quantization error is the difference between the input value and
the quantized output value.
When you select either the Output codeword check box or the Output
quantization error check box, you must also enter your codebook
values. If, from the Source of quantizer parameters list, you choose
Specify via dialog, use the Codebook parameter to enter a vector
of quantized output values that correspond to each region. If, from the
Source of quantizer parameters list, you choose Input port, use
input port C to specify your codebook values.
If, for the Partitioning parameter, you select Bounded, the Output
clipping status check box and the Action for out of range input
parameter appear. When you select the Output clipping status check
box, port S appears on the block. Any time an input value is outside the
range defined by the Boundary points parameter, the block outputs a
1 at the S port. When the value is inside the range, the blocks outputs
a 0.
You can use the Action for out of range input parameter to
determine the blocks behavior when an input value is outside the range
defined by the Boundary points parameter. Suppose the boundary
points for a bounded quantizer are defined as [p0 p1 p2 p3 ... pN]
and the possible index values are defined as [i0 i1 i2 ... i(N-1)],
where i0=0 and i0<i1<i2<...<i(N-1). When you want any input
value less than p0 to be assigned to index value i0 and any input values
greater than pN to be assigned to index value i(N-1), select Clip. When
you want to be warned when clipping occurs, select Clip and warn.
When you want the simulation to stop and the block to display an error
when the index values are out of range, select Error.
1-1379
Dialog
Box
1-1380
The Main pane of the Scalar Quantizer Encoder block dialog appears
as follows.
1-1381
1-1382
Codebook
Enter a vector of quantized output values that correspond to
each index value. If, for the Partitioning parameter, you select
Bounded and your boundary points vector has length N, then you
must specify a codebook of length N-1. If, for the Partitioning
parameter, you select Unbounded and your boundary points vector
has length N, then you must specify a codebook of length N+1.
This parameter is visible when you select Specify via dialog
from the Source of quantizer parameters list and you select
either the Output codeword or Output quantization error
check box. Tunable.
Output clipping status
When you select this check box, port S appears on the block. Any
time an input value is outside the range defined by the Boundary
points parameter, the block outputs a 1 at this port. When the
value is inside the range, the block outputs a 0. This parameter is
visible when you select Bounded from the Partitioning list.
Action for out of range input
Use this parameter to determine the behavior of the block when
an input value is outside the range defined by the Boundary
points parameter. Suppose the boundary points are defined as
[p0 p1 p2 p3 ... pN] and the index values are defined as
[i0 i1 i2 ... i(N-1)]. When you want any input value less
than p0 to be assigned to index value i0 and any input values
greater than pN to be assigned to index value i(N-1), select Clip.
When you want to be warned when clipping occurs, select Clip
and warn. When you want the simulation to stop and the block
to display an error when the index values are out of range, select
Error. This parameter is visible when you select Bounded from
the Partitioning list.
Index output data type
Specify the data type of the index output from the block at port I.
You can choose int8, uint8, int16, uint16, int32, or uint32.
1-1383
The Data Types pane of the Scalar Quantizer Encoder block dialog
appears as follows.
1-1384
1-1385
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode to be used when block inputs are fixed
point.
References
Supported
Data
Types
Port
1-1386
Port
Q(U)
Err
Boolean
For more information on what data types are supported for each
quantizer mode, see Data Type Support on page 1-1380.
See Also
Quantizer
Simulink
Uniform Encoder
Uniform Decoder
1-1387
Selector
Purpose
Library
Description
1-1388
Short-Time FFT
Purpose
Library
Transforms
dspxfrm3
Description
Input x
data type
Input x
data type
FFT output
data type
Input w
data type
1-1389
Short-Time FFT
Examples
1-1390
Short-Time FFT
Dialog
Box
1-1391
Short-Time FFT
References
Supported
Data
Types
Port
x(n)
w(n)
1-1392
Short-Time FFT
Port
X(n,k)
1-1393
Short-Time FFT
See Also
Burg Method
Magnitude FFT
Periodogram
Spectrum Analyzer
Window Function
Yule-Walker Method
pwelch
1-1394
Purpose
Library
Sources
dspsrcs4
Description
The Signal From Workspace block imports a signal from the MATLAB
workspace into the Simulink model. The Signal parameter specifies the
name of a MATLAB workspace variable containing the signal to import,
or any valid MATLAB expression defining a matrix or 3-D array.
When the Signal parameter specifies an M-by-N matrix (M1), each
of the N columns is treated as a distinct channel. You specify the
frame size in the Samples per frame parameter, Mo, and the output
is an Mo-by-N matrix containing Mo consecutive samples from each
signal channel. You specify the output sample period in the Sample
time parameter, Ts, and the output frame period is Mo*Ts. For Mo=1,
the output is sample based; otherwise the output is frame based. For
convenience, an imported row vector (M=1) is treated as a single
channel, so the output dimension is Mo-by-1.
When the Signal parameter specifies an M-by-N-by-P array, each of
the P pages (an M-by-N matrix) is output in sequence with period Ts.
The Samples per frame parameter must be set to 1, and the output is
always sample based.
1-1395
block with the Warn when frame size does not evenly divide
input length check box appears in the list in the Contents pane.
3 Select each of the blocks for which you wish to toggle the
Examples
Example 1
In the first model, ex_signal_from_workspace_fb, the Signal From
Workspace imports a two-channel signal from the workspace matrix,A.
The Sample time is set to 1 and the Samples per frame is set to 4, so
the output is frame based with a frame size of 4 and a frame period of
4 seconds. The Form output after final data value by parameter
1-1396
specifies Setting To Zero, so all outputs after the third frame (at t=8)
are zero.
Example 2
In the second model, ex_signal_from_workspace_sb, the Signal From
Workspace block imports a sample-based matrix signal from the 3-D
workspace array, A. Again, the Form output after final data value
by parameter specifies Setting To Zero, so all outputs after the third
(at t=2) are zero.
1-1397
Dialog
Box
Signal
The name of the MATLAB workspace variable from which to
import the signal, or a valid MATLAB expression specifying the
signal.
Sample time
The sample period, Ts, of the output. The output frame period is
Mo*Ts.
Samples per frame
The number of samples, Mo, to buffer into each output frame.
This value must be 1 when you specify a 3-D array in the Signal
parameter.
1-1398
Supported
Data
Types
See Also
From Workspace
Simulink
To Workspace
Simulink
1-1399
1-1400
Signal To Workspace
Purpose
Library
Sinks
dspsnks4
Description
The Signal To Workspace block writes data from your simulation into
an array or structure in the main MATLAB workspace. You can specify
a name for the workspace variable as well as whether the data is saved
as an array, structure, or structure with time.
When the Save format is set to Array or Structure, the dimensions of
the output depend on the input dimensions and the setting of the Save
2-D signals as parameter. The following table summarizes the output
dimensions under various conditions. In the table, K represents the
value of the Limit data points to last parameter.
Input Signal
Dimensions
M-by-N matrix
2-D array
(concatenate along
first dimension)
Signal To
Workspace Output
Dimension
K-by-N matrix.
If you set the Limit
data points to last
parameter to inf,
K represents the
total number of
samples acquired
in each column by
the end of simulation.
This is equivalent
to multiplying the
input frame size (M)
by the total number
1-1401
Signal To Workspace
Input Signal
Dimensions
Signal To
Workspace Output
Dimension
of M-by-N inputs
acquired by the block.
M-by-N matrix
Examples
3-D array
(concatenate along
third dimension)
M-by-N-by-K array.
If you set the Limit
data points to last
parameter to inf, K
represents the total
number of M-by-N
inputs acquired
by the end of the
simulation.
Length-N unoriented
vector
Any setting
K-by-N matrix
N-dimensional array
where N > 2
Any setting
1-1402
Signal To Workspace
dimension), the block concatenates the input along the first dimension
1-1403
Signal To Workspace
1-1404
Signal To Workspace
Dialog
Box
1-1405
Signal To Workspace
Variable name
Specify the name of the array or structure into which the block
logs the simulation data. The block creates this variable in the
MATLAB workspace only after the simulation stops running.
When you enter the name of an existing workspace variable, the
block overwrites that variable with the simulation data.
Limit data points to last
Specify the maximum number of samples or frames the block will
save. When the simulation generates more than the specified
maximum number of samples or frames, the simulation saves
only the most recently generated data. To capture all data, set
this parameter to inf. See the table in the Description section for
more information on how this parameter affects the dimensions
of the logged data.
Decimation
Specify a positive integer d to determine how often the block
writes data to the workspace array or structure. The block writes
data to the array or structure every dth sample. With the default
decimation value of 1, the block writes data at every time step.
Save format
Specify the format in which to save simulation output to the
workspace. You can select one of the following options:
Array Select this option to save the data as an N-dimensional
array. If the input signal is an unoriented vector, the resulting
workspace array is 2-D. Each input vector is saved in a row of
the output matrix, vertically concatenated onto the previous
vector. If the input signal is 2-dimensional, the dimensions
of the resulting workspace array depend on the setting of the
Save 2-D signals as parameter.
Structure Select this option to save the data as a structure
consisting of three fields: time, signals and blockName. In
this mode, the time field is empty, and the blockName field
contains the name of the Signal To Workspace block. The
signals field contains a structure with three additional fields:
1-1406
Signal To Workspace
1-1407
Signal To Workspace
Supported
Data
Types
See Also
1-1408
Triggered To Workspace
To Workspace
Simulink
Sine Wave
Purpose
Library
Sources
dspsrcs4
Description
y = A sin ( 2 ft + )
where you specify A in the Amplitude parameter, f in hertz in
the Frequency parameter, and in radians in the Phase offset
parameter. A complex exponential signal is generated when the
Output complexity parameter is set to Complex, and is defined by
an expression of the type
y = Ae j (2 ft + ) = A {cos ( 2 ft + ) + j sin ( 2 ft + )}
1-1409
Sine Wave
sin ( 2000 t )
y = 2 sin (1000 t )
3 sin 500 t +
2
(channel 1)
(channel 2)
(channel 3)
Sample Mode
The Sample mode parameter specifies the blocks sampling property,
which can be Continuous or Discrete:
Continuous
1-1410
Sine Wave
yi = Ai sin ( 2 fi t + i ) (real)
or
j 2 f t +
yi = Ai e ( i i )
(complex)
1-1411
Sine Wave
Table Lookup
Differential
Note To generate fixed-point sinusoids, you must select Table Lookup.
Trigonometric Fcn
The trigonometric function method computes the sinusoid in the ith
channel, yi, by sampling the continuous function
yi = Ai sin ( 2 fi t + i ) (real)
or
j 2 f t +
yi = Ai e ( i i )
(complex)
with a period of Ts, where you specify Ts in the Sample time parameter.
This mode of operation shares the same benefits and liabilities as the
Continuous sample mode described above.
At each sample time, the block evaluates the sine function at the
appropriate time value within the first cycle of the sinusoid. By
constraining trigonometric evaluations to the first cycle of each
sinusoid, the block avoids the imprecision of computing the sine of very
large numbers, and eliminates the possibility of discontinuity during
extended operations (when an absolute time variable might overflow).
This method therefore avoids the memory demands of the table lookup
method at the expense of many more floating-point operations.
1-1412
Sine Wave
Table Lookup
The table lookup method precomputes the unique samples of every
output sinusoid at the start of the simulation, and recalls the samples
from memory as needed. Because a table of finite length can only be
constructed when all output sequences repeat, the method requires that
the period of every sinusoid in the output be evenly divisible by the
sample period. That is, 1/(fiTs) = ki must be an integer value for every
channel i = 1, 2, ..., N.
When the Optimize table for parameter is set to Speed, the table
constructed for each channel contains ki elements. When the Optimize
table for parameter is set to Memory, the table constructed for each
channel contains ki/4 elements.
For long output sequences, the table lookup method requires far
fewer floating-point operations than any of the other methods, but
can demand considerably more memory, especially for high sample
rates (long tables). This is the recommended method for models that
are intended to emulate or generate code for DSP hardware, and that
therefore need to be optimized for execution speed.
Note The lookup table for this block is constructed from
double-precision floating-point values. Thus, when you use the Table
lookup computation mode, the maximum amount of precision you can
achieve in your output is 53 bits. Setting the word length of the Output
or User-defined data type to values greater than 53 bits does not
improve the precision of your output.
Differential
The differential method uses an incremental algorithm. This algorithm
computes the output samples based on the output values computed at
the previous sample time (and precomputed update terms) by making
use of the following identities.
1-1413
Sine Wave
The update equations for the sinusoid in the ith channel, yi, can
therefore be written in matrix form as
Examples
1-1414
Sine Wave
Dialog
Box
The Main pane of the Sine Wave block dialog appears as follows.
1-1415
Sine Wave
Amplitude
A length-N vector containing the amplitudes of the sine waves
in each of N output channels, or a scalar to be applied to all N
channels. The vector length must be the same as that specified
for the Frequency and Phase offset parameters. Tunable
when Computation method is to Trigonometric fcn or
Differential.
Frequency
A length-N vector containing frequencies, in Hertz, of the sine
waves in each of N output channels, or a scalar to be applied
to all N channels. The vector length must be the same as that
specified for the Amplitude and Phase offset parameters.
You can specify positive, zero, or negative frequencies. Tunable
when Sample mode is Continuous or Computation method
is Trigonometric fcn.
Phase offset
A length-N vector containing the phase offsets, in radians, of
the sine waves in each of N output channels, or a scalar to be
applied to all N channels. The vector length must be the same as
that specified for the Amplitude and Frequency parameters.
Tunable when Sample mode is Continuous or Computation
method is Trigonometric fcn.
Sample mode
The blocks sampling behavior, Continuous or Discrete. This
parameter is not tunable.
Output complexity
The type of waveform to generate: Real specifies a real sine wave,
Complex specifies a complex exponential. This parameter is not
tunable.
Computation method
The method by which discrete-time sinusoids are generated:
Trigonometric fcn, Table lookup, or Differential. This
parameter is not tunable. For more information on each of the
1-1416
Sine Wave
1-1417
Sine Wave
1-1418
Sine Wave
1-1419
Sine Wave
Supported
Data
Types
See Also
1-1420
Chirp
Complex Exponential
Sine Wave
Signal Generator
Simulink
Sine Wave
Simulink
sin
MATLAB
1-1421
Purpose
Library
Description
A = U diag( S) V *
where
U is an M-by-P matrix
V is an N-by-P matrix
S is a length-P vector
P is defined as min(M,N)
When
M = N, U and V are both M-by-M unitary matrices
M > N, V is an N-by-N unitary matrix, and U is an M-by-N matrix
whose columns are the first N columns of a unitary matrix
N > M, U is an M-by-M unitary matrix, and V is an N-by-M matrix
whose columns are the first M columns of a unitary matrix
In all cases, S is an unoriented vector of positive singular values having
length P.
Length-N row inputs are treated as length-N columns.
Note that the first (maximum) element of output S is equal to the
2-norm of the matrix A.
1-1422
Dialog
Box
References
1-1423
Supported
Data
Types
Port
See Also
Boolean
Autocorrelation LPC
Cholesky Factorization
LDL Factorization
LU Inverse
Pseudoinverse
QR Factorization
SVD Solver
svd
MATLAB
1-1424
Sort
Purpose
Library
Statistics
dspstat3
Description
The Sort block ranks the values of the input elements using either a
quick sort or an insertion sort algorithm. The quick sort algorithm
uses a recursive sort method and is faster at sorting more than 32
elements. The insertion sort algorithm uses a non-recursive method
and is faster at sorting less than 32 elements. You should also always
use the insertion sort algorithm when you are generating code from the
Sort block if you do not want recursive function calls in your code. To
specify the sort method, use the Sort algorithm parameter.
The Mode parameter specifies the blocks mode of operation, and can
be set to Value, Index, or Value and index.
Value Mode
When Mode is set to Value, the block sorts the elements in each column
of the M-by-N input matrix u in order of ascending or descending value,
as specified by the Sort order parameter.
val = sort(u)
val = flipud(sort(u))
Index Mode
When Mode is set to Index, the block sorts the elements in each column
of the M-by-N input matrix u,
[val,idx] = sort(u)
[val,idx] = flipud(sort(u))
1-1425
Sort
and outputs the M-by-N index matrix, idx. The jth column of idx is an
index vector that permutes the jth column of u to the desired sorting
order.
val(:,j) = u(idx(:,j),j)
The index value outputs are always 32-bit unsigned integer values.
1-1426
Sort
Dialog
Box
Mode
Specify the blocks mode of operation: Output the sorted matrix
(Value), the index matrix (Index), or both (Value and index).
1-1427
Sort
Sort order
Specify the order in which to sort the training points, Descending
or Ascending.
Sort algorithm
Specify whether the elements of the input are sorted using a
Quick sort or an Insertion sort algorithm.
The Data Types pane of the Sort block dialog appears as follows.
1-1428
Sort
1-1429
Sort
Note The parameters on the Data Types pane are only used for
complex fixed-point inputs. The sum of the squares of the real and
imaginary parts of such an input are formed before a comparison is
made, as described in Value Mode on page 1-1425. The results of the
squares of the real and imaginary parts are placed into the product
output data type. The result of the sum of the squares is placed into
the accumulator data type. These parameters are ignored for other
types of inputs.
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Product output data type
Specify the product output data type. See Fixed-Point Data
Types on page 1-1426 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same
as input
1-1430
Sort
Same
as product output
Supported
Data
Types
Port
Input
Val
1-1431
Sort
Port
See Also
1-1432
MATLAB
Spectrum Analyzer
Purpose
Library
Sinks
dspsnks4
Description
1-1433
Spectrum Analyzer
1-1434
Spectrum Analyzer
Signal
Display
1-1435
Spectrum Analyzer
Simulation status
Resolution Bandwidth
Time Resolution
Offset Display Time
(only for spectrogram)
Note To prevent the scope from opening when you run your model,
right-click on the scope icon and select Comment Out. If the scope is
already open, you can still comment it out in the model. When you do
so, the scope displays a message, No data can be shown because this
scope is commented out. Select Uncomment to turn the scope back on.
Frequency Span The range of values shown on the frequency-axis
on the Spectrum Analyzer window.
1-1436
Spectrum Analyzer
Details
Spectrum Analyzer sets the frequency span using the values of
parameters on the Main options pane of the Spectrum Settings
panel.
SampleRate SampleRate
,
FrequencyOffset hertz.
2
2
1-1437
Spectrum Analyzer
Op
1
NENBW Fs
100
NENBW * Fs
window length and the resulting RBW is
. The
N window
Samples/update in this case is directly related
to RBW by the
Op
100
1-1438
Spectrum Analyzer
Details
Time resolution is the amount of data, in seconds, used to compute
a spectrogram line. The minimum attainable resolution is the
amount of data time it takes to compute a single spectral estimate.
Time Resolution is displayed only when the spectrum Type is
Spectrogram.
Offset The constant frequency offset to apply to the entire
spectrum.
Details
Spectrum Analyzer adds this constant offset parameter to the values
on the frequency-axis using the value of Offset on the Trace options
pane of the Spectrum Settings panel. The offset is the current
time value at the middle of the interval of the line displayed at 0
seconds. The actual time of a particular spectrogram line is the offset
minus the y-axis time listing. You must take this parameter into
consideration when you set the Span (Hz) and CF (Hz) parameters
on the Main options pane of the Spectrum Settings panel to
ensure that the frequency span is within Nyquist limits. The offset is
displayed on the plot only when the spectrum Type is Spectrogram.
Simulation Status Provides the current status of the model
simulation.
Details
The status can be one of the following conditions:
object.
1-1439
Spectrum Analyzer
Display time The amount of time that has progressed since the
last update to the Spectrum Analyzer display.
Details
Every time data is processed by the block, the simulation
time increases by the number of rows in the input signal
divided by the sample rate, as given by the following formula:
length( x)
. When Reduce Plot Rate to Improve
tsim tsim
SampleRate
Performance is checked, the simulation time and display time
might differ. At the beginning of a simulation, you can modify
the SampleRate parameter on the Main options pane of the
Spectrum Settings panel.
The Display time indicator is a component of the Status Bar in
the Spectrum Analyzer window. You can choose to hide or display
the entire Status Bar. From the Spectrum Analyzer menu, select
View > Status Bar .
For more information, see Spectrum Settings on page 1-1447.
1-1440
Spectrum Analyzer
Note When this check box is selected, Spectrum Analyzer may display
a misleading spectrum in some situations. For example, if the input
signal is wide-band with non-stationary behavior, such as a chirp
signal, Spectrum Analyzer might display a stationary spectrum. The
reason for this behavior is that Spectrum Analyzer buffers the input
signal data and only updates the display periodically at approximately
20 times per second. Therefore, Spectrum Analyzer does not render
changes to the spectrum that occur and elapse between updates, which
gives the impression of an incorrect spectrum. To ensure that spectral
estimates are as accurate as possible, clear the Reduce Plot Rate to
Improve Performance check box. When you clear this box, Spectrum
Analyzer calculates spectra whenever there is enough data, rendering
results correctly.
Toolbar
ShortcutDescription
Keys
Ctrl+P Print the current Spectrum Analyzer
window. To enable printing, run the
release method.
To print the current scope window to
a figure rather than sending it to your
printer, select File > Print to figure.
1-1441
Spectrum Analyzer
ButtonMenu
Location
ShortcutDescription
Keys
1-1442
Tools >
Zoom In
N/A
Tools >
Zoom X
N/A
Tools >
Zoom Y
N/A
Tools >
Scaling
Properties
Spectrum Analyzer
Note The axes control (zoom) buttons do not change the settings
related to frequency span for Spectrum Analyzer. These buttons are
purely graphical. Spectrum computations are not affected when you
zoom.
Measurements Buttons
Tools > Measurements
N/A
Open
> Cursor
or close the Cursor
Measurements
Measurements panel. This panel
controls the display of vertical and
horizontal cursors on the spectrum
display.
1-1443
Spectrum Analyzer
1-1444
Spectrum Analyzer
Simulation
Toolbar
Shortcut Description
Keys
Simulation >
Simulation
Stepping
Options
N/A
Simulation >
Step Back
N/A
Simulation >
Run
Ctrl+T,
p,
Space
Simulation >
Continue
p,
Space
Simulation >
Pause
p,
Space
1-1445
Spectrum Analyzer
ButtonMenu
Location
Shortcut Description
Keys
Simulation >
Step
Forward
Right
arrow,
Page
Down
Simulation >
Stop
Ctrl+T,
s
Simulation >
Simulink
Snapshot
N/A
View >
Highlight
Simulink
Block
Ctrl+L
You can control whether this toolbar appears in the scope window.
From the scope menu, select View > Simulation Toolbar.
To see a full listing of the shortcut keys for these simulation controls,
from the scope menu, select Help > Keyboard Command Help.
1-1446
Spectrum Analyzer
Spectrum
Settings
button.
1-1447
Spectrum Analyzer
SampleRate SampleRate
,
FrequencyOffset hertz. If you
2
2
1-1448
Spectrum Analyzer
SampleRate
is 0,
FrequencyOffset hertz. Tunable.
2
Span (Hz) and CF (Hz), or FStart (Hz) and FStop (Hz) When
Span (Hz) is showing in the Main Options pane, you define
the range of values shown on the frequency-axis on the Spectrum
Analyzer window using frequency span and center frequency.
From the drop-down list, select FStart (Hz) to define the range
of frequency-axis values using start frequency and stop frequency
instead.
1-1449
Spectrum Analyzer
1-1450
Frequency
Resolution
RBW
Time
Setting Resolution
Setting
Time Resolution
'RBW'
'Auto'
'Auto'
1/RBW s
'RBW'
'Auto'
Manually
entered
Time Resolution s
'RBW'
Manually 'Auto'
entered
1/RBW s
'RBW'
Manually Manually
entered entered
Must be equal to
or greater than the
minimum attainable
time resolution, 1/RBW
s. Several spectral
estimates are combined
into one spectrogram
line to obtain the
desired time resolution.
Interpolation is used to
obtain time resolution
values that are not
Spectrum Analyzer
Frequency
Resolution
RBW
Time
Setting Resolution
Setting
Time Resolution
integer multiples of
1/RBW s.
'Window
Length'
'Auto'
1/RBW s
RBW =
(NENBW*Fs)/Window
Length, where NENBW
is the normalized
effective noise
bandwidth of the
specified window.
'Window
Length'
Manually
entered
Must be equal to
or greater than the
minimum attainable
time resolution,
(NENBW*Fs)/Window
Length. Several
spectral estimates
are combined into
one spectrogram
line to obtain the
desired time resolution.
Interpolation is used to
obtain time resolution
values that are not
integer multiples of
1/RBW s.
1-1451
Spectrum Analyzer
Op
1
NENBW Fs
100
N samples
or to the window length by this
RBW
Op
1-1452
Spectrum Analyzer
1-1453
Spectrum Analyzer
N window
w2 (n)
n=1
the following equation: NENBW = N window
. The
2
rectangular window has the smallest NENBW,
with a value
of 1. All
N window
1
window has an NENBW value of approximately
Units The units of the spectrum. Available options are dBm, dBW,
and Watts. Tunable.
1-1454
Spectrum Analyzer
SampleRate SampleRate
,
is
FrequencyOffset
2
2
if Two-sided
hertz
spectrum
is
selected, and
SampleRate
FrequencyOffset hertz otherwise.
0,
2
1-1455
Spectrum Analyzer
either the Max hold trace or the Min hold trace check box.
Tunable.
Max hold trace Maximum hold trace view. This property applies
only when the Spectrum Type is Power or Power density. Select
this check box to enable Spectrum Analyzer to plot the maximum
spectral values of all the estimates obtained. Tunable.
Min hold trace Minimum hold trace view. This property applies
only when the Spectrum Type is Power or Power density. Select
this check box to enable Spectrum Analyzer to plot the minimum
spectral values of all the estimates obtained. Tunable.
Two-sided spectrum Select this check box to enable two-sided
spectrum view. In this view, both negative and positive frequencies
are shown. If you clear this check box, Spectrum Analyzer shows
a one-sided spectrum with only positive frequencies. Spectrum
Analyzer requires that this parameter is selected when the input
signal is complex-valued.
Measurements The Measurements panels are the other four panels that appear to
the right side of the Spectrum Analyzer figure. These panels are
Panels
1-1456
Spectrum Analyzer
Button Description
Move the current panel to the top. When you are displaying
more than one panel, this action moves the current panel
above all the other panels.
1-1457
Spectrum Analyzer
You can choose to hide or display the Trace Selection panel. In the
Scope menu, select Tools > Measurements > Trace Selection.
button.
1-1458
Spectrum Analyzer
1-1459
Spectrum Analyzer
Settings Pane
The Settings pane enables you to modify the type of screen cursors
used for calculating measurements. When more than one signal is
displayed, you can assign cursors to each trace individually.
Screen Cursors Shows screen cursors (for power and power
density spectra only).
Horizontal Shows horizontal screen cursors (for power and power
density spectra only).
Vertical Shows vertical screen cursors (for power and power
density spectra only).
Waveform Cursors Shows cursors that attach to the input
signals (for power and power density spectra only).
Lock Cursor Spacing Locks the frequency difference between
the two cursors.
Snap to Data Positions the cursors on signal data points.
Measurements Pane
The Measurements pane displays the frequency (Hz), time (s),
and power (dBm) value measurements. Time is displayed only in
spectrogram mode. Channel Power shows the total power between
the cursors.
1 | Shows or enables you to modify the frequency or time (for
spectrograms only), or both, at cursor number one.
2 : Shows or enables you to modify the frequency or time (for
spectrograms only), or both, at cursor number two.
Shows the absolute value of the difference in the frequency,
time (for spectrograms only), and power between cursor number one
and cursor number two.
Channel Power Shows the total power in the channel defined
by the cursors.
1-1460
Spectrum Analyzer
The letter after the value associated with a measurement indicates the
abbreviation for the appropriate International System of Units (SI)
prefix, such as m for milli-.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
micro
10^6
milli
10^3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
button.
1-1461
Spectrum Analyzer
The Peak finder panel is separated into two panes, labeled Settings
and Peaks. You can expand each pane to see the available options.
Settings Pane
The Settings pane enables you to modify the parameters used to
calculate the peak values within the displayed portion of the input
signal. For more information on the algorithms this pane uses, see the
Signal Processing Toolbox findpeaks function reference.
Peak Threshold The level above which peaks are detected. This
setting is equivalent to the MINPEAKHEIGHT parameter, which you can
set when you run the findpeaks function.
Max Num of Peaks The maximum number of peaks to show. The
value you enter must be a scalar integer between 1 and 99. This
setting is equivalent to the NPEAKS parameter, which you can set
when you run the findpeaks function.
Min Peaks Distance The minimum number of samples between
adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE
parameter, which you can set when you run the findpeaks function.
Peak Excursion The minimum height difference between a peak
and its neighboring samples. Peak excursion is illustrated alongside
peak threshold in the following figure.
1-1462
Spectrum Analyzer
1-1463
Spectrum Analyzer
Peaks Pane
The Peaks pane displays all of the largest calculated peak values.
It also shows the coordinates at which the peaks occur, using the
parameters you define in the Settings pane. You set the Max Num of
Peaks parameter to specify the number of peaks shown in the list.
1-1464
Spectrum Analyzer
Use the check boxes to control which peak values are shown on the
display. By default, all check boxes are cleared and the Peak Finder
panel hides all the peak values. To show all the peak values on the
display, select the check box in the top-left corner of the Peaks pane.
To hide all the peak values on the display, clear this check box. To
show an individual peak, select the check box directly to the left of its
Value listing. To hide an individual peak, clear the check box directly
to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the
value associated with each measurement indicates the abbreviation for
the appropriate International System of Units (SI) prefix, such as m for
milli-. For example, if the input signal is measured in volts, an m next
to a measurement value indicates that this value is in units of millivolts.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
micro
10^6
milli
10^3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
1-1465
Spectrum Analyzer
button.
1-1466
Spectrum Analyzer
Select the frequency span of the channel, Span(Hz), and specify the
center frequency CF (Hz) of the channel. Alternatively, select the
starting frequency, FStart(Hz), and specify the starting frequency
and ending frequency (FStop (Hz)) values of the channel.
1-1467
Spectrum Analyzer
1-1468
Select the frequency span of the channel, Span (Hz), and specify
the center frequency CF (Hz) of the channel. Alternatively, select
the starting frequency, FStart(Hz), and specify the starting
frequency and ending frequency (FStop (Hz)) values of the
channel.
Spectrum Analyzer
Filter The filter to use for both main and adjacent channels.
Available filters are None, Gaussian, and RRC (root-raised cosine).
button.
1-1469
Spectrum Analyzer
1-1470
Spectrum Analyzer
1-1471
Spectrum Analyzer
1-1472
Spectrum Analyzer
1-1473
Spectrum Analyzer
spectral window. If the TOI has the same amplitude as the input
two-tone signal, reduce the power of that input signal.
1-1474
Spectrum Analyzer
1-1475
Spectrum Analyzer
Visuals
Spectrum
Properties
button.
Display Pane
When the Spectrum Type is Power or Power density, the Display
pane of the VisualsSpectrum Properties dialog box appears as follows:
1-1476
Spectrum Analyzer
Title
Select this check box to show the legend in the display. The channel
legend displays a name for each channel of each input signal. When
the legend appears, you can place it anywhere inside of the scope
window. To turn the legend off, clear the Show legend check box.
This parameter applies only when the Spectrum Type is Power or
Power density. Tunable
You can edit the name of any channel in the legend. To do so,
double-click the current name, and enter a new channel name. By
default, if the signal has multiple channels, the scope uses an index
number to identify each channel of that signal. To change the
appearance of any channel of any input signal in the scope window,
from the scope menu, select View > Style.
Show grid
When you select this check box, a grid appears in the display of the
scope figure. To hide the grid, clear this check box. Tunable
1-1477
Spectrum Analyzer
Y-limits (Minimum)
Specify the text for the scope to display to the left of the y-axis.
Regardless of this property, Spectrum Analyzer always displays power
units after this text as one of 'dBm', 'dBW', 'Watts', 'dBm/Hz',
'dBW/Hz', or 'Watts/Hz'. Tunable.
Color map
Select the color map for the spectrogram, or enter a 3-column matrix
expression for the color map. See colormap for information. Tunable.
Color-limits (Minimum)
Set the signal power for the minimum color value of the spectrogram.
Tunable.
Color-limits (Maximum)
Set the signal power for the maximum color value of the spectrogram.
Tunable.
Style
Dialog
Box
1-1478
In the Style dialog box, you can customize the style of power and power
density displays. This dialog box is not available in spectrogram view.
You are able to change the color of the figure, the background and
foreground colors of the axes, and properties of the lines. From the
Spectrum Analyzer menu, select View > Style to open this dialog box.
Spectrum Analyzer
Properties
The Style dialog box allows you to modify the following properties of
the Spectrum Analyzer figure:
Figure color
Specify the color that you want to apply to the background of the scope
figure. By default, the figure color is gray.
Axes colors
Specify the color that you want to apply to the background of the axes.
Properties for line
Specify the channel for which you want to modify the visibility, line
properties, and marker properties.
Visible
Specify the line style, line width, and line color for the selected channel.
1-1479
Spectrum Analyzer
Marker
Specify marks for the selected channel to show at its data points. This
parameter is similar to the Marker property for the MATLAB Handle
Graphics plot objects. You can choose any of the marker symbols from
the following table.
Specifier
Marker Type
none
No marker (default)
Circle
Square
Cross
Point
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)
1-1480
Spectrum Analyzer
Tools
Axes
Scaling
Properties
Properties
The ToolsAxes Scaling Properties dialog box appears as follows for
power and power density views.
1-1481
Spectrum Analyzer
Specify when the scope should automatically scale the axes. If the
spectrogram is displayed, specify when the scope should automatically
scale the color. You can select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes or color. You can manually scale the
axes or color in any of the following ways:
Auto When you select this option, the scope scales the axes or color
as needed, both during and after simulation. Selecting this option
shows the Do not allow Y-axis limits to shrink or Do not allow
color limits to shrink .
1-1482
Spectrum Analyzer
When you select this property, the y-axis are only allowed to grow
during axes scaling operations. If the spectrogram is displayed,
selecting this property allows the color limits to only grow during axis
scaling. If you clear this check box, the y-axis or color limits may shrink
during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
or Color scaling property. When you set the Axes scaling or Color
scaling property to Manual or After N Updates, the y-axis or color
limits are allowed to shrink. Tunable.
Number of updates
Select this check box to scale the axes when the simulation stops. If the
spectrogram is displayed, select this check box to scale the color when
the simulation stops. The y-axis is always scaled. The x-axis limits are
only scaled if you also select the Scale X-axis limits check box.
Y-axis Data range (%) / Color-limits Data range
Set the percentage of the y-axis that the scope should use to display
the data when scaling the axes. If the spectrogram is displayed, set
the percentage of the power values range within the color map. Valid
values are between 1 and 100. For example, if you set this property
to 100, the Scope scales the y-axis limits such that your data uses
the entire y-axis range. If you then set this property to 30, the scope
1-1483
Spectrum Analyzer
increases the y-axis range or color such that your data uses only 30% of
the y-axis range or color. Tunable.
Y-axis Align / Color-limits Align
Specify where the scope should align your data with respect to the
y-axis when it scales the axes. If the spectrogram is displayed, specify
where the scope should align your data with respect to the y-axis when
it scales the color. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
X-axis Data range (%)
Set the percentage of the x-axis that the Scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the x-axis
limits such that your data uses the entirex-axis range. If you then set
this property to 30, the Scope increases the x-axis range such that your
data uses only 30% of the x-axis range. Use the x-axis Align property to
specify data placement with respect to the x-axis.
This property appears only when you select the Scale X-axis limits
check box. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
Algorithms
1-1484
Spectrum Analyzer uses the RBW or the Window Length setting in the
Spectrum Settings panel to determine the data window length. The
value of the FrequencyResolutionMethod property determines whether
RBW or window length is used. Then, it partitions the input signal into
a number of windowed data segments. Finally, Spectrum Analyzer
uses the modified periodogram method to compute spectral updates,
averaging the windowed periodograms for each segment.
Spectrum Analyzer
Op
1
NENBW Fs
100
N samples
RBW
The normalized effective noise bandwidth, NENBW, is a factor
that depends on the windowing method. Spectrum Analyzer shows
NENBW in the Window Options pane of the Spectrum Settings
panel. Overlap percentage, Op, is the value of the Overlap %
parameter in the Window Options pane of the Spectrum Settings
panel. Fs is the sample rate of the input signal. Spectrum Analyzer
shows sample rate in the Main Options pane of the Spectrum
Settings panel.
a When in RBW mode, the window length required to compute
N window =
NENBW Fs
RBW
1-1485
Spectrum Analyzer
Op
N samples = 1
N window
100
Nsamples
0%
100
50%
50
80%
20
N window
NENBW = N window
w2 (n)
n=1
N window
d When in RBW mode, you can set the resolution bandwidth using
w(n)
the value of the RBW
parameter
on the Main options pane
n=1 panel.
You must specify a value to
of the Spectrum Settings
ensure that there are at least two RBW intervals over the specified
frequency span. The ratio of the overall span to RBW must be
greater than two, as given in the following equation.
1-1486
Spectrum Analyzer
span
2
RBW
By default, the RBW parameter on the Main options pane is
set to Auto. In this case, the Spectrum Analyzer determines the
appropriate value to ensure that there are 1024 RBW intervals
over the specified frequency span. Thus, when you set RBW to
span
1024
e When in window length mode, you specify Nwindow and the resulting
RBW is
Auto, it is calculated by the following equation. RBWauto
NENBW * Fs
N window
In some cases, the number of samples provided in the input are not
sufficient to achieve the resolution bandwidth that you specify. When
this situation occurs, Spectrum Analyzer produces a message on the
display, as shown in the following figure.
1-1487
Spectrum Analyzer
N FFT
2
( p)
[ n]e
j 2 f ( n 1) T
1 P n =1
PSD( f ) =
N window
P p=1
2
F
w [ n]
discrete
s is the
In this equation, x[n]
input signal. On every input
n =1
signal frame, Spectrum Analyzer generates as many overlapping
windows as possible, each window denoted as x(p)[n], and computes
their periodograms. Spectrum Analyzer displays a running average
of the P most current periodograms.
Power Spectrum The power spectrum is the product of the
power spectral density and the resolution bandwidth, as given by the
following equation.
N FFT
F NENBW 1
Pspectrum ( f ) = PSD( f ) RBW = PSD( f ) s
=
N window
P
( p)
[ n]e
j 2 f ( n 1) T
n =1
N window
w[ n ]
Spectrogram Each line of the spectrogram is one periodogram. n =1
1-1488
p=1
Spectrum Analyzer
100 - Occupied BW %
2
100 - Occupied BW %
2
The bandwidth between the lower and upper power frequency values
is the occupied bandwidth.
The frequency halfway between the lower and upper frequency
values is the center frequency.
The Distortion Measurements are computed as follows.
1-1489
Spectrum Analyzer
3 The power and width of the second, and higher order harmonics (P2,
Wsum = W0+W1+W2+...+Wn.
The sum of powers of the second and higher order harmonics are
computed as Pharmonic = P2+P3+P4+...+Pn.
6 The sum of the noise power is then estimated as Pnoise = (Premaining*dF
7 The metrics for SNR, THD, SINAD, and SFDR are then computed
1-1490
Spectrum Analyzer
1-1491
Spectrum Analyzer
1-1492
Spectrum Analyzer
1-1493
Spectrum Analyzer
where F1 and F2 are the sinusoid input frequencies and |A| + |B| =
N. A and B are integer values.
For intermodulation measurements, the third-order intercept (TOI)
point is computed as follows, where P is power in decibels of the
measured power referenced to one milliwatt (dBm).:
Differences
from
Spectrum
Scope
Block
1-1494
R2013a Spectrum
Analyzer does not
require that input
signals are buffered.
Spectrum Analyzer
determines the number
of samples needed using
the value of the RBW
parameter. Regardless
of whether the input
R2013a Spectrum
Analyzer Equivalent
Parameter
RBW =
NENBW Fs
N window
Spectrum Analyzer
Scope
Buffer
R2013a Spectrum
Properties
size
Analyzer uses the RBW
parameter parameter to determine
the requisite number
of samples to calculate
the spectrum, instead
R2013a Spectrum
Analyzer Equivalent
Parameter
In the preceding
equation, NENBW
is the window constant
calculated for a window
length of 1000, Fs
is the sample rate
of the block, and
Nwindow is the buffer
length. If the input
signal to the R2012b
Spectrum Scope block
was frame-based and
the Buffer input check
box was cleared, then
the R2013a Spectrum
Analyzer computes
the RBW value with
Nwindow set to the frame
size of the input signal.
For Spectrum Scope
blocks in R2012b
or earlier models, if
the input signal was
frame-based and the
Buffer input check
1-1495
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
Scope
Buffer
R2013a Spectrum
Properties
Overlap Analyzer has an
parameter Overlap % parameter
that is directly related
to buffer overlap.
R2013a Spectrum
Analyzer will compute
its Overlap % using
the equation:
Op =
Ol
N window
100
In the preceding
equation, Op is
Overlap % parameter
value, Ol is the R2012b
Spectrum Scope Buffer
overlap parameter
value, and Nwindow is
the buffer length.
1-1496
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
Treat
R2013a Spectrum
Scope
Mx1
Analyzer defaults
Properties
and
to treating Mx1
unoriented
and unoriented
sample-based
sample-based signals
signals
as one channel.
as
property is available
only via the Scope
Configuration object.
Window R2013a Spectrum
Scope
parameter Analyzer does not
Properties
have the Bartlett,
Blackman, Triang, or
Hanning settings.
1-1497
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
n/a
hold on
command,
adding
another
line for
each
spectrum
computation
on the
display.
1-1498
Spectrum Scope
blocks in R2012b or
earlier models with
persistence enabled
will have their Max
Hold Trace check box
selected in the R2013a
Spectrum Analyzer.
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
Display Compact
Properties
Display
check
box
There is no equivalent
capability in the
R2013a Spectrum
Analyzer.
n/a
Inherit
Axis
Sample
Properties
time
from
input
check
box
R2013a Spectrum
Analyzer always uses
the sample time of the
input signal.
n/a
FrequencyR2013a Spectrum
Axis
display Analyzer determines
Properties
limits
the range of frequencies
parameter calculated based on
the Full Span, FStart
(Hz), and FStop (Hz)
parameters.
1-1499
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
1-1500
If the User-defined
parameter was
chosen, then this
parameter maps to
the R2013a Spectrum
Analyzer FStart (Hz)
parameter.
MaximumR2013a Spectrum
Axis
frequencyAnalyzer determines
Properties
(Hz)
the range of frequencies
parameter calculated based on
the Full Span, FStart
(Hz), and FStop (Hz)
parameters.
If the User-defined
parameter was chosen,
then this parameter
maps to the R2013a
Spectrum Analyzer
FStop (Hz) parameter.
Line
There are no equivalent
Line
visibilities,
capabilities in the
Properties
Line
R2013a Spectrum
styles,
Analyzer.
Line
markers,
and
Line
Spectrum Analyzer
R2013a Spectrum
Analyzer Equivalent
Parameter
colors
parameters
The R2012b Spectrum Scope allowed you to retain the axes limits over
multiple simulations by selecting Axes > Save Axes Settings. There
is no equivalent capability in the R2013a Spectrum Analyzer. However,
you can automatically scale the axes to a specified range using the Tools
Axes Scaling Properties dialog box.
Supported
Data
Types
Port
Input
Supported
Simulation
Modes
You can use the scope block in models running the following supported
simulation modes.
Mode
Supported
Notes and Limitations
Normal
Yes
Accelerator
Yes
1-1501
Spectrum Analyzer
Mode
Supported
Notes and Limitations
Rapid
Accelerator
Yes
PIL
No
SIL
No
External
Yes
For more information about these modes, see How Acceleration Modes
Work in the Simulink documentation.
1-1502
Spectrum Analyzer
See Also
Related
Examples
1-1503
Stack
Purpose
Library
Description
The Stack block stores a sequence of input samples in a last in, first
out (LIFO) register. The register capacity is set by the Stack depth
parameter, and inputs can be scalars, vectors, or matrices.
The block pushes the input at the In port onto the top of the stack when
a trigger event is received at the Push port. When a trigger event is
received at the Pop port, the block pops the top element off the stack
and holds the Out port at that value. The last input to be pushed onto
the stack is always the first to be popped off.
A trigger event at the optional Rst port empties the stack contents.
When you select Clear output port on reset, then a trigger event at
the Rst port empties the stack and sets the value at the Out port to
zero. This setting also applies when a disabled subsystem containing
1-1504
Stack
the Stack block is reenabled; the Out port value is only reset to zero in
this case when you select Clear output port on reset.
When two or more of the control input ports are triggered at the same
time step, the operations are executed in the following order:
1 Rst
2 Push
3 Pop
The rate of the trigger signal must be the same as the rate of the data
signal input. You specify the triggering event for the Push, Pop, and Rst
ports in the Trigger type pop-up menu:
Rising edge Triggers execution of the block when the trigger
input does one of the following:
Rising edge
Rising edge
Rising edge
Rising edge
1-1505
Stack
Falling edge
Falling edge
Falling edge
Falling edge
1-1506
Stack
Examples
Example 1
The table below illustrates the Stack blocks operation for a Stack
depth of 4, Trigger type of Either edge, and Clear output port on
reset enabled. Because the block triggers on both rising and falling
edges in this example, each transition from 1 to 0 or 0 to 1 in the Push,
Pop, and Rst columns below represents a distinct trigger event. A 1
in the Empty column indicates an empty buffer, while a 1 in the Full
column indicates a full buffer.
1-1507
Stack
In
Push
Pop
Rst
Stack
Out
Empty Full
Num
10
11
12
Note that at the last step shown, the Push and Rst ports are triggered
simultaneously. The Rst trigger takes precedence, and the stack is first
cleared and then pushed.
Example 2
The dspqdemo example provides an example of the related Queue block.
1-1508
Stack
Dialog
Box
Stack depth
The number of entries that the LIFO register can hold.
Trigger type
The type of event that triggers the blocks execution. The rate of
the trigger signal must be the same as the rate of the data signal
input.
Push full stack
Response to a trigger received at the Push port when the register
is full. Inputs to this port must have the same built-in data type
as inputs to the Pop and Rst input ports.
1-1509
Stack
1-1510
Stack
Supported
Data
Types
Port
In
Push
Pop
1-1511
Stack
Port
Rst
Out
Empty
Full
Num
1-1512
Stack
See Also
Buffer
Delay Line
Queue
1-1513
Standard Deviation
Purpose
Library
Statistics
dspstat3
Description
Basic Operation
When you do not select the Running standard deviation check box,
the block computes the standard deviation of each row or column of
the input, along vectors of a specified dimension of the input, or of the
entire input at each individual sample time, and outputs the array y.
Each element in y contains the standard deviation of the corresponding
column, row, vector, or entire input. The output y depends on the
setting of the Find the standard deviation value over parameter.
For example, consider a 3-dimensional input signal of size M-by-N-by-P:
Entire input The output at each sample time is a scalar that
contains the standard deviation of the entire input.
y = std(u(:))
1-1514
Standard Deviation
For purely real or purely imaginary inputs, the standard deviation of the
jth column of an M-by-N input matrix is the square root of its variance:
M
yj = j =
uij j
i=1
M 1
1 j N
For complex inputs, the output is the total standard deviation, which
equals the square root of the total variance, or the square root of the
sum of the variances of the real and imaginary parts. The standard
deviation of each column in an M-by-N input matrix is given by:
j = 2j,Re + 2j,Im
1-1515
Standard Deviation
Note The total standard deviation does not equal the sum of the real
and imaginary standard deviations.
Running Operation
When you select the Running standard deviation check box, the
block tracks the standard deviation of successive inputs to the block.
In this mode, you must also specify a value for the Input processing
parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains
the standard deviation of the element uij over all inputs since the
last reset.
When you select Columns as channels (frame based), the block
outputs an M-by-N matrix. Each element yij of the output contains
the standard deviation of the jth column over all inputs since the last
reset, up to and including element uij of the current input.
Running Operation for Variable-Size Inputs
When your inputs are of variable size, and you select the Running
standard deviation check box, there are two options:
If you set the Input processing parameter to Elements as
channels (sample based), the state is reset.
If you set the Input processing parameter to Columns as channels
(frame based), then there are two cases:
1-1516
Standard Deviation
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-1517
Standard Deviation
Falling edge
Falling edge
Falling edge
Falling edge
ROI
Processing
1-1518
Standard Deviation
1-1519
Standard Deviation
Description
Description
If the ROI is partially outside the image, the block only computes the
statistical values for the portion of the ROI that is within the image.
If, for the ROI type parameter, you select Label matrix, the Output
flag indicating if input label numbers are valid check box appears
in the dialog box. If you select this check box, the Flag port appears on
the block. The following tables describe the Flag port output based
on the block parameters.
Output = Individual statistics for each ROI
1-1520
Flag
Port
Output
Description
Standard Deviation
Examples
Flag
Port
Output
Description
1-1521
Standard Deviation
1-1522
Standard Deviation
Dialog
Box
1-1523
Standard Deviation
1-1524
Standard Deviation
1-1525
Standard Deviation
When you select either of these check boxes, the Flag port appears
on the block. For a description of the Flag port output, see the
tables in ROI Processing on page 1-1518.
The Output flag indicating if ROI is within image bounds
check box is only visible when you select Rectangles or Lines
as the ROI type.
The Output flag indicating if label numbers are valid check
box is only visible when you select Label matrix for the ROI
type parameter.
Supported
Data
Types
Port
Input
Reset
ROI
1-1526
Standard Deviation
Port
Boolean
Label
Label
8-, 16-, and 32-bit unsigned integers
Numbers
Output
Flag
See Also
Boolean
Mean
RMS
Variance
std
MATLAB
1-1527
Submatrix
Purpose
Library
Description
1-1528
Submatrix
1-1529
Submatrix
Last
For rows, this specifies that the last row of u should be used as the
only row of y. When all columns are to be included, this is equivalent
to y = u(M,:).
For columns, this specifies that the last column of u should be used
as the only column of y. When all rows are to be included, this is
equivalent to y = u(:,N).
Offset from middle
When you select this option, the block selects the first row or column
of the output y by adding the specified offset to the middle row or
column of the input u. When the number, X, of input rows or columns
is even, the block defines the middle one as X/2 +1. When the number
of input rows or columns is odd, the block defines the middle one as
ceil(X/2).
When all columns are to be included, the following code defines the
starting row: y(1,:) = u(MiddleRow+Offset,:), where Offset
is the value of the Row offset or Starting row offset parameter.
When all rows are to be included, the following code defines the
starting column: y(1,:) = u(:,MiddleColumn+Offset), where
Offset is the value of the Column offset or Starting column
offset parameter.
Middle
When you select this option, the block uses the middle row or column
of the input u as the first row or column of the output y. When the
number, X, of input rows or columns is even, the block defines the
middle one as X/2 +1. When the number of input rows or columns is
odd, the block defines the middle one as ceil(X/2).
When all columns are to be included, the following code defines
the starting row: y = u(MiddleRow,:). When all rows are to
be included, the following code defines the starting column: y =
u(:,MiddleColumn).
1-1530
Submatrix
1-1531
Submatrix
is even, the block defines the middle one as X/2 +1. When the number
of input rows or columns is odd, the block defines the middle one as
ceil(X/2).
When all columns are to be included, the following code defines the
ending row: y(end,:) = u(MiddleRow+Offset,:), where Offset
is the value of the Ending row offset parameter. When all rows
are to be included, the following code defines the ending column:
y(:,end) = u(:,MiddleColumn+Offset), where Offset is the value
of the Ending column offset parameter.
Middle
When you select this option, the block uses the middle row or column
of the input u as the last row or column of the output y. When the
number, X, of input rows or columns is even, the block defines the
middle one as X/2 +1. When the number of input rows or columns is
odd, the block defines the middle one as ceil(X/2).
When all columns are to be included, the following code defines the
ending row: y(end,:) = u(MiddleRow,:). When all rows are to be
included, the following code defines the ending column: y(:,end) =
u(:,MiddleColumn).
This block supports Simulink virtual buses.
Examples
1-1532
Submatrix
There are often several possible parameter combinations that you can
use to select the same submatrix from the input. For example, in the
case of a 5-by-7 input matrix, instead of specifying Last for Ending
column, you could select the same submatrix by specifying
Ending column = Index
Ending column index = 7
Dialog
Box
The parameters displayed in the dialog box vary for different menu
combinations. Only some of the parameters listed below are visible
in the dialog box at any one time.
1-1533
Submatrix
Row span
The range of input rows to be retained in the output. Options are
All rows, One row, or Range of rows.
Row/Starting row
The input row to be used as the first row of the output. Row is
enabled when you select One row from Row span, and Starting
row when you select Range of rows from Row span.
Row index/Starting row index
The index of the input row to be used as the first row of the output.
Row index is enabled when you select Index from Row, and
Starting row index when you select Index from Starting row.
Row offset/Starting row offset
The offset of the input row to be used as the first row of the
output. Row offset is enabled when you select Offset from
middle or Offset from last from Row, and Starting row offset
is enabled when you select Offset from middle or Offset from
last from Starting row.
Ending row
The input row to be used as the last row of the output. This
parameter is enabled when you select Range of rows from Row
span and you select any option but Last from Starting row.
Ending row index
The index of the input row to be used as the last row of the
output. This parameter is enabled when you select Index from
Ending row.
Ending row offset
The offset of the input row to be used as the last row of the output.
This parameter is enabled when you select Offset from middle
or Offset from last from Ending row.
Column span
The range of input columns to be retained in the output. Options
are All columns, One column, or Range of columns.
1-1534
Submatrix
Column/Starting column
The input column to be used as the first column of the output.
Column is enabled when you select One column from Column
span, and Starting column is enabled when you select Range
of columns from Column span.
Column index/Starting column index
The index of the input column to be used as the first column of the
output. Column index is enabled when you select Index from
Column, and Starting column index is enabled when you select
Index from Starting column.
Column offset/Starting column offset
The offset of the input column to be used as the first column of the
output. Column offset is enabled when you select Offset from
middle or Offset from last from Column. Starting column
offset is enabled when you select Offset from middle or Offset
from last from Starting column.
Ending column
The input column to be used as the last column of the output.
This parameter is enabled when you select Range of columns
from Column span and you select any option but Last from
Starting column.
Ending column index
The index of the input column to be used as the last column of the
output. This parameter is enabled when you select Index from
Ending column.
Ending column offset
The offset of the input column to be used as the last column of the
output. This parameter is enabled when you select Offset from
middle or Offset from last from Ending column.
1-1535
Submatrix
Supported
Data
Types
Port
Input
Output
See Also
Reshape
Simulink
Selector
Simulink
Variable Selector
reshape
MATLAB
1-1536
SVD Solver
Purpose
Library
Description
The SVD Solver block solves the linear system AX=B, which can be
overdetermined, underdetermined, or exactly determined. The system
is solved by applying singular value decomposition (SVD) factorization
to the M-by-N matrix A, at the A port. The input to the B port is the
right side M-by-L matrix, B. The block treats length-M unoriented
vector input as an M-by-1 matrix.
The output at the X port is the N-by-L matrix, X. X is chosen to minimize
the sum of the squares of the elements of B-AX (the residual). When B
is a vector, this solution minimizes the vector 2-norm of the residual.
When B is a matrix, this solution minimizes the matrix Frobenius norm
of the residual. In this case, the columns of X are the solutions to the L
corresponding systems AXk=Bk, where Bk is the kth column of B, and
Xk is the kth column of X.
X is known as the minimum-norm-residual solution to AX=B. The
minimum-norm-residual solution is unique for overdetermined
and exactly determined linear systems, but it is not unique for
underdetermined linear systems. Thus when the SVD Solver block is
applied to an underdetermined system, the output X is chosen such that
the number of nonzero entries in X is minimized.
1-1537
SVD Solver
Dialog
Box
Supported
Data
Types
Port
1-1538
Boolean
SVD Solver
See Also
Autocorrelation LPC
Cholesky Solver
LDL Solver
Levinson-Durbin
LU Inverse
Pseudoinverse
QR Solver
1-1539
Time Scope
Purpose
Library
Sinks
dspsnks4
Description
The Time Scope block displays signals in the time domain. The Time
Scope block accepts input signals with the following characteristics:
Continuous or discrete sample time
Real- or complex-valued
Fixed or variable size dimensions
Floating- or fixed-point data type
N-dimensional
Simulink enumerations
1-1540
Time Scope
You can use the Time Scope block in models running in Normal or
Accelerator simulation modes. You can also use the Time Scope block
in models running in Rapid Accelerator or External simulation modes,
with some limitations. See the Supported Simulation Modes on page
1-1644 section for more information.
You can use the Time Scope block inside of all subsystems and
conditional subsystems. Conditional subsystems include enabled
subsystems, triggered subsystems, enabled and triggered subsystems,
and function-call subsystems. See Conditional Subsystems in the
Simulink documentation for more information.
1-1541
Time Scope
For an example that uses the Time Scope block, see the Display
Time-Domain Data section in the DSP System Toolbox documentation.
See the following sections for more information on the Time Scope:
Displaying Multiple Signals on page 1-1543
Signal Display on page 1-1548
Toolbar on page 1-1552
Configuration Properties Buttons on page 1-1552
Simulation Buttons on page 1-1553
Zoom and Axes Control Buttons on page 3-1521
Measurements Buttons on page 3-1525
Measurements Panels on page 1-1561
Configuration Properties Dialog Box on page 1-1606
Style Dialog Box on page 3-1571
Stepping Options on page 1-1625
ToolsAxes Scaling Properties on page 1-1626
Examples on page 1-1629
Supported Data Types on page 1-1644
Supported Simulation Modes on page 1-1644
Note For information about the Time Scope System object, see
dsp.TimeScope.
For information on controlling the Time Scope programatically, see
Simulink.scopes.TimeScopeConfiguration and Control Time Scope
1-1542
Time Scope
Displaying
Multiple
Signals
By default, the scope names each channel according to either its signal
name or the name of the block from which it comes. If the signal
has multiple channels, the scope uses an index number to identify
each channel of that signal. For example, a 2-channel signal named
Signal1 would have the following default names in the channel legend:
Signal1:1, Signal1:2. In the following example, there is one 3-channel
input signal and one 4-channel input signal to the scope block, one
1-1543
Time Scope
signal named Signal1 and one unnamed signal coming from a block
named Block2.
To see all the signal names, run the simulation and show the legend. To
show the legend, select View > Configuration Properties, click the
Display tab, and select the Show Legend check box. The following
legend appears in the display.
The scope does not display signal names that were labeled within an
unmasked subsystem. You must label all input signals to the scope
block that originate from an unmasked subsystem.
Multiple Signal Colors
By default, the scope has a black axes background and chooses line
colors for each channel in the same manner as the Simulink Scope
block. When the scope axes background is black, it assigns each channel
of each input signal a line color in the order shown above.
If there are more than 7 channels, then the scope repeats this order
to assign line colors to the remaining channels. To choose line colors
1-1544
Time Scope
for each channel in the same manner as the MATLAB plot function,
change the axes background color to any color except black. To change
the axes background color to white, select View > Style, click the Axes
background color button (
), and select white from the color palette.
Run the simulation again. The following legend appears in the display.
When the scope axes background is not black, it assigns each channel of
each input signal a line color in order shown above.If there are more
than 7 channels, then the scope repeats this order to assign line colors
to the remaining channels. To manually modify any line color, select
View > Style to open the Style dialog box. Next to Properties for
line, select the signal name whose color you want to change. Then,
next to Line, click the Line color button (
from the palette.
1-1545
Time Scope
When N is less than the number of input channels, the scope applies
the values you specify in the offset vector to the first N input
channels. The scope does not offset the remaining channels.
When N is greater than the number of input channels, the scope
offsets each input channel according to the corresponding value in
the offset vector. The scope ignores all values in the offset vector that
do not correspond to a channel of the input.
Multiple Displays
You can display multiple channels of data on different displays in the
scope window. In the scope toolbar, select View > Layout, or select
the Layout button (
Properties button.
Note The Layout menu item and button are not available when the
scope is in snapshot mode.
This feature allows you to tile the window into a number of separate
displays, up to a grid of 4 rows and 4 columns. For example, if there
are three inputs to the scope, you can display the signals in separate
displays by selecting row 3, column 1, as shown in the following figure.
1-1546
Time Scope
After you select row 3, column 1, the scope window is partitioned into
three separate displays, as shown in the following figure.
1-1547
Time Scope
When you use the Layout option to tile the window into multiple
displays, the display highlighted in yellow is referred to as the active
display. The scope dialog boxes reference the active display.
Signal
Display
Time Scope uses the simulation start time and stop time in order to
determine the default time range. However, you can define the length
of simulation time for which the Time Scope displays data. To change
the signal display settings, select View > Configuration Properties
to bring up the Configuration Properties dialog box. Then, modify the
values for the Time span and Time display offset parameters on the
Time tab. For example, if you set the Time span to 20 seconds and
the Time display offset to 0, the scope displays 20 seconds worth
of simulation data at a time. The values on the time-axis of the Time
Scope display remain the same throughout simulation.
To communicate the simulation time that corresponds to the current
display, the scope uses the Time units, Time offset, and Simulation
time indicators on the scope window. The following figure highlights
these and other important aspects of the Time Scope window.
1-1548
Time Scope
Note To prevent the scope from opening when you run your model,
right-click on the scope icon and select Comment Out. If the scope is
already open, you can still comment it out in the model. When you do
so, the scope displays a message, No data can be shown because this
scope is commented out. Select Uncomment to turn the scope back on.
Minimum time-axis limit The Time Scope sets the minimum
time-axis limit using the value of the Time display offset parameter
on the Main tab of the VisualsTime Domain Properties dialog
box. If you specify a vector of values for the Time display offset
parameter, the scope uses the smallest of those values to set the
minimum time-axis limit.
Maximum time-axis limit The Time Scope sets the maximum
time-axis limit by summing the value of Time display offset
parameter with the value of the Time span parameter. If you specify
a vector of values for the Time display offset parameter, the scope
sets the maximum time-axis limit by summing the largest of those
values with the value of the Time span parameter.
Simulation status Provides the current status of the model
simulation. The status can be one of the following conditions:
Initializing
Ready
Running
Paused
The Simulation status is part of the Status Bar in the Time Scope
window. You can choose to hide or display the entire Status Bar.
From the Time Scope menu, select View > Status Bar.
Time units The units used to describe the time-axis. The
Time Scope sets the time units using the value of the Time
Units parameter on the Time tab of the Configuration Properties
dialog box. By default, this parameter is set to Metric (based
1-1549
Time Scope
To hide both the word Time and the values on the time-axis, set
the Show time-axis labels parameter to None. To hide both the
word Time and the values on the time-axis in all displays except the
bottom ones in each column of displays, set this parameter to Bottom
Displays Only. This behavior differs from the Simulink Scope block,
which always shows the values but never shows a label on the x-axis.
Time offset The Time offset value helps you determine the
simulation times for which the scope is displaying data. The value is
always in the range 0 Time offset Simulation time. Therefore,
add the Time offset to the fixed time span values on the time-axis to
get the overall simulation time.
For example, if you set the Time span to 20 seconds, and you see a
Time offset of 0 (secs) on the scope window. This value indicates
that the scope is displaying data for the first 0 to 20 seconds of
simulation time. If the Time offset changes to 20 (secs), the scope
displays data for simulation times from 20 seconds to 40 seconds. The
scope continues to update the Time offset value until the simulation
is complete.
Simulation time When the model is running or simulation has
been paused, the scope displays the current simulation time. This
time is the amount of time that the Time Scope has spent processing
the input. If the model simulation completes or is stopped, the scope
displays the time at which the simulation stopped. The Simulation
time is part of the Status Bar in the Time Scope window. You can
choose to hide or display the entire Status Bar. From the Time
Scope menu, select View > Status Bar .
1-1550
Time Scope
Axes Maximization
When the scope is in maximized axes mode, the following figure
highlights the important indicators on the scope window.
To toggle this mode, in the scope menu, select View > Configuration
Properties. In the Main pane, locate the Maximize axes parameter.
Specify whether to display the scope in maximized axes mode. In this
mode, each of the axes is expanded to fit into the entire display. To
conserve space, labels do not appear in each display. Instead, tick-mark
values appear on top of the plotted data. You can select one of the
following options:
Auto In this mode, the axes appear maximized in all displays only
if the Title and YLabel properties are empty for every display. If
you enter any value in any display for either of these properties, the
axes are not maximized.
1-1551
Time Scope
Toolbar
The Time Scope toolbar contains the following buttons. You can control
whether this toolbar appears in the Time Scope window. From the Time
Scope menu, select View > Toolbar.
1-1552
Shortcut Description
Keys
View >
N/A
Configuration
Properties
View >
Style
N/A
Time Scope
N/A
Simulation Buttons
ButtonMenu
Location
Shortcut Description
Keys
1-1553
Time Scope
ButtonMenu
Location
Shortcut Description
Keys
page 1-1625 section for more
information.
1-1554
Simulation > p,
Space
Continue
Simulation > p,
Space
Pause
Time Scope
ButtonMenu
Location
View >
Highlight
Simulink
Block
Shortcut Description
Keys
Ctrl+L
To see a full listing of the shortcut keys for these simulation controls,
from the Time Scope menu, select Help > Keyboard Command Help.
1-1555
Time Scope
1-1556
ShortcutDescription
Keys
Tools >
Zoom In
N/A
Tools >
Zoom X
N/A
Tools >
Zoom Y
N/A
Time Scope
ButtonMenu
Location
ShortcutDescription
Keys
Tools >
Pan
N/A
Tools >
Scale
Y-Axes
Limits
1-1557
Time Scope
ButtonMenu
Location
Tools >
Scale X-Axis
Limits
ShortcutDescription
Keys
N/A
Tools >
Scale X
and Y Axes
Limits
N/A
1-1558
Time Scope
ButtonMenu
Location
ShortcutDescription
Keys
one of the following options from the
Tools menu:
Automatically Scale Axes
Limits When you select this
option, the scope scales the axes as
needed during simulation.
Scale Axes Limits after 10
Updates When you select this
option, the scope scales the axes
after 10 updates. The scope does
not scale the axes again during the
simulation.
Scale Axes Limits at Stop
When you select this option, the
scope scales the axes each time the
simulation is stopped.
Measurements Buttons
Tools >
Triggers
N/A
1-1559
Time Scope
Tools >
N/A
Measurements >
Signal
Statistics
Tools >
N/A
Measurements >
Bilevel
Measurements
1-1560
Time Scope
Tools >
N/A
Measurements >
Peak
Finder
Measurements The Measurements panels are the panels that appear to the right side
of the Time Scope GUI. These panels are labeled Trace selection,
Panels
Cursor measurements,Signal statistics, Bilevel measurements,
and Peak finder.
1-1561
Time Scope
Button Description
Move the current panel to the top. When you are displaying
more than one panel, this action moves the current panel
above all the other panels.
1-1562
Time Scope
You can choose to hide or display the Trace Selection panel. In the
Scope menu, select Tools > Measurements > Trace Selection.
Triggers Panel
The Triggers panel allows you to pause the display only when certain
events occur. You can use the Triggers panel when you want to align
or search for interesting events. You can configure triggers to both
select and align specific regions of interest in the display area of the
scope. Triggers work across multiple displays. You can also choose
to hide or display the Triggers panel. In the scope toolbar, click
the Triggers button (
Tools > Triggers.
1-1563
Time Scope
1-1564
Time Scope
Main Pane
The Main pane lets you choose how often the display updates and in
what position the trigger indicator appears.
Mode Define how often the display should update.
Auto The scope aligns and displays data from the latest trigger
event. If no event is found after a full time span has elapsed, then
the scope displays the last available data. Use this mode to see
your data and have it align whenever a trigger event occurs.
Normal The scope aligns and displays data only from the latest
trigger event. Use this mode to search for infrequently occurring
events in your data.
1-1565
Time Scope
1-1566
Time Scope
In the case of a falling edge, the scope enables the trigger event
when the signal value becomes greater than the level threshold
plus hysteresis. The scope disables the trigger event when the
signal becomes less than the level threshold for the first time. The
scope uses linear interpolation to generate a trigger event at the
time when the signal crosses the level threshold, as shown in the
following figure.
1-1567
Time Scope
1-1568
Time Scope
1-1569
Time Scope
scope encounters the trigger event when the signal crosses the
high threshold. The transition time is when the signal crosses
the middle threshold, located halfway between the high and low
thresholds, as shown in the following figure.
1-1570
Time Scope
following figure. The runt width is the Max Width Min Width.
Any runt pulse width that is less than the minimum width or
greater than the maximum width will not generate a trigger event.
1-1571
Time Scope
1-1572
Time Scope
1-1573
Time Scope
Alternatively, the scope can encounter the trigger event when the
signal stays within the boundaries defined by the hysteresis for
7.50 seconds after the signal crosses the level threshold, as shown
in the following figure.
1-1574
Time Scope
Polarity Select the polarity of the trigger type. The option you
choose for Type directly affects the options available for Polarity,
as shown in the following table.
Trigger Type
Polarity Options
Edge
Pulse Width
Transition
Runt
1-1575
Time Scope
Trigger Type
Polarity Options
Window
Timeout
1-1576
Time Scope
Inside Trigger when the signal stays within the low and high
levels for a specified time duration.
Outside Trigger when the signal stays outside of the low and
high levels for a specified time duration.
1-1577
Time Scope
Rising Trigger when the signal does not cross the reference
level from below.
Falling Trigger when the signal does not cross the reference
level from above.
Either Trigger when the signal does not cross the reference
level from either direction.
Level
Parameters
Auto-Level
Setting
Timing Parameters
Edge
Level,
Hysteresis
High, Low
Level = 50%
n/a
Transition
High, Low
Runt
High, Low
Window
High, Low
Timeout
Level,
Hysteresis
n/a
Timeout
Pulse
Width
1-1578
Time Scope
the Level parameter to 50% of the range of the source signal. If you
set the trigger type to Timeout, the Triggers panel does not show
this option. Setting the trigger type to other menu choices results in
High and Low parameter adjustment. Auto level sets the High
parameter to 90% of the range of the source signal and the Low
parameter to 10% of the range of the source signal.
Level (V) Specify, in volts, the trigger level. This parameter is
visible when you set Type to Edge or Timeout.
Hysteresis (V) Specify, in volts, the hysteresis or noise reject
value. This parameter is visible when you set Type to Edge or
Timeout. If the signal jitters inside this range and briefly crosses
the trigger level, the scope does not register an event. In the case
of an edge trigger with rising polarity, the scope ignores any times
that the signal crosses the trigger level within the hysteresis region,
as shown in the following figure.
1-1579
Time Scope
You can reduce the hysteresis region size by decreasing the hysteresis
value. If you set the hysteresis value to 0.07 in this example, then
the scope also considers the second rising edge to be a trigger event,
as shown in the following figure.
1-1580
Time Scope
1-1581
Time Scope
1-1582
button.
Time Scope
1-1583
Time Scope
1-1584
button.
Time Scope
1-1585
Time Scope
Name
Multiplier
atto
10^-18
femto
10^-15
pico
10^12
nano
10^-9
micro
10^-6
milli
10^-3
10^0
1-1586
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
Time Scope
Abbreviation
Name
Multiplier
peta
10^15
exa
10^18
button.
1-1587
Time Scope
Settings Pane
The Settings pane enables you to modify the properties used to
calculate various measurements involving transitions, overshoots,
undershoots, and cycles. You can modify the high-state level, low-state
level, state-level tolerance, upper-reference level, mid-reference level,
and lower-reference level, as shown in the following figure.
Auto State Level When this check box is selected, the Bilevel
measurements panel autodetects the high- and low- state levels of
a bilevel waveform. For more information on the algorithm this
option uses, see the Signal Processing Toolbox statelevels function
reference. When this check box is cleared, you may enter in values
for the high- and low- state levels manually.
1-1588
Time Scope
1-1589
Time Scope
1-1590
Time Scope
1-1591
Time Scope
Whenever there is a plus sign (+) next to a text label, this symbol refers
to measurement associated with a rising edge, a transition from a
low-state level to a high-state level.
A negative-going transition, or falling edge, in a bilevel waveform
is a transition from the high-state level to the low-state level. A
negative-going transition has a slope value less than zero. The following
figure shows a negative-going transition.
1-1592
Time Scope
1-1593
Time Scope
1-1594
Time Scope
Fall Time Average amount of time required for each falling edge
to cross from the upper-reference level to the lower-reference level.
For more information on the algorithm this measurement uses, see
the Signal Processing Toolbox falltime function reference.
Slew Rate Average slope of each falling edge transition line
within the upper- and lower-percent reference levels in the displayed
portion of the input signal. For more information on the algorithm
this measurement uses, see the Signal Processing Toolbox slewrate
function reference.
Overshoots/Undershoots
The Overshoots/Undershoots pane displays calculated measurements
involving the distortion and damping of the input signal. Overshoot and
undershoot refer to the amount that a signal respectively exceeds and
falls below its final steady-state value. Preshoot refers to the amount
prior to a transition that a signal varies from its initial steady-state
value. This figure shows preshoot, overshoot, and undershoot for a
rising-edge transition.
1-1595
Time Scope
1-1596
Time Scope
1-1597
Time Scope
You can modify the settle seek duration parameter in the Settings
pane. For more information on the algorithm this measurement uses,
see the Signal Processing Toolbox settlingtime function reference.
Preshoot Average highest aberration in the region immediately
preceding each falling transition.
Overshoot Average highest aberration in the region
immediately following each falling transition. For more information
on the algorithm this measurement uses, see the Signal Processing
Toolbox overshoot function reference.
1-1598
Time Scope
1-1599
Time Scope
1-1600
Time Scope
button.
1-1601
Time Scope
The Peak finder panel is separated into two panes, labeled Settings
and Peaks. You can expand each pane to see the available options.
Settings Pane
The Settings pane enables you to modify the parameters used to
calculate the peak values within the displayed portion of the input
signal. For more information on the algorithms this pane uses, see the
Signal Processing Toolbox findpeaks function reference.
Peak Threshold The level above which peaks are detected. This
setting is equivalent to the MINPEAKHEIGHT parameter, which you can
set when you run the findpeaks function.
Max Num of Peaks The maximum number of peaks to show. The
value you enter must be a scalar integer between 1 and 99. This
setting is equivalent to the NPEAKS parameter, which you can set
when you run the findpeaks function.
Min Peaks Distance The minimum number of samples between
adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE
parameter, which you can set when you run the findpeaks function.
Peak Excursion The minimum height difference between a peak
and its neighboring samples. Peak excursion is illustrated alongside
peak threshold in the following figure.
1-1602
Time Scope
1-1603
Time Scope
Peaks Pane
The Peaks pane displays all of the largest calculated peak values.
It also shows the coordinates at which the peaks occur, using the
parameters you define in the Settings pane. You set the Max Num of
Peaks parameter to specify the number of peaks shown in the list.
1-1604
Time Scope
Use the check boxes to control which peak values are shown on the
display. By default, all check boxes are cleared and the Peak Finder
panel hides all the peak values. To show all the peak values on the
display, select the check box in the top-left corner of the Peaks pane.
To hide all the peak values on the display, clear this check box. To
show an individual peak, select the check box directly to the left of its
Value listing. To hide an individual peak, clear the check box directly
to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the
value associated with each measurement indicates the abbreviation for
the appropriate International System of Units (SI) prefix, such as m for
milli-. For example, if the input signal is measured in volts, an m next
to a measurement value indicates that this value is in units of millivolts.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
micro
10^6
milli
10^3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
1-1605
Time Scope
Configuration
Properties
Dialog
Box
button.
Main Pane
The Main pane of the Configuration Properties dialog box appears as
follows.
Select this check box to ensure that the scope opens when the simulation
starts. The following table summarizes the interaction between the
Open at simulation start check box and the Scope figure.
1-1606
Time Scope
Open at
simulation start
Checked
Scope figure
status when
Closed
model saved
Checked
Open
At model loading
Not checked
Closed
Not checked
Open
At model loading
At simulation start
Specify the number of input ports that should appear on the left side of
the scope block.
Layout
Specify the size of the buffer that the scope holds in its memory cache.
If your signal has M rows of data and N data points in each row, M x
N is the number of data points per time step. Multiply this result by
the number of time steps for your model to obtain the required buffer
length. For example, if you have 10 rows of data with each row having
100 data points and your run will be 10 time steps, you should enter
10,000 (which is 10 x 100 x 10) as the buffer length.
The default setting is 50000.
Sample time
Specify the sampling time in seconds. If you enter -1, the sample time
of the input signal is used.
Input processing
Specify whether the Time Scope should treat the input signal as
Columns as channels (frame based) or Elements as channels
(sample based).
1-1607
Time Scope
Specify when the scope should automatically scale the axes. You can
select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes. You can manually scale the axes in
any of the following ways:
1-1608
Time Scope
When the scope figure is the active window, press Ctrl and A
simultaneously.
Auto When you select this option, the scope scales the axes as
needed, both during and after simulation. Selecting this option shows
the Do not allow Y-axis limits to shrink check box.
After N Updates Selecting this option causes the scope to scale
the axes after a specified number of updates. Selecting this option
shows the Number of updates edit box.
By default, this property is set to Auto. This property is Tunable.
Note Click the link labeled Configure to the right of the Axes
scaling property to see additional axes scaling properties. After you
click this button, its label changes to Hide. To hide these additional
properties, click the Hide link.
Scale axes limits at stop
Select this check box to scale the axes when the simulation stops. The
y-axis is always scaled. The x-axis limits are only scaled if you also
select the Scale X-axis limits check box.
Do not allow Y-axis limits to shrink
When you select this property, the y-axis is allowed only to grow during
axes scaling operations. If you clear this check box, the y-axis or color
limits may shrink during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
property. When you set the Axes scaling property to Manual or After
N Updates, the y-axis or color limits are allowed to shrink. Tunable.
Y-axis Data range (%)
Set the percentage of the y-axis that the scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the y-axis
limits such that your data uses the entire y-axis range. If you then set
1-1609
Time Scope
this property to 30, the scope increases the y-axis range such that your
data uses only 30% of the y-axis range. Tunable.
Y-axis Align
Specify where the scope should align your data with respect to the y-axis
when it scales the axes. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
X-axis Data range (%)
Set the percentage of the x-axis that the Scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the x-axis
limits such that your data uses the entirex-axis range. If you then set
this property to 30, the Scope increases the x-axis range such that your
data uses only 30% of the x-axis range. Use the x-axis Align property to
specify data placement with respect to the x-axis.
This property appears only when you select the Scale X-axis limits
check box. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
Time Pane
The Time pane of the Configuration Properties dialog box appears as
follows.
1-1610
Time Scope
Time span
1-1611
Time Scope
Specify how the scope displays new data beyond the visible time span.
You can select one of the following options:
1-1612
Time Scope
Wrap In this mode, the scope displays new data until the data
reaches the maximum time-axis limit. When the data reaches the
maximum time-axis limit of the scope window, the scope clears the
display. The scope then updates the time offset value and begins
displaying subsequent data points starting from the minimum
time-axis limit.
Scroll In this mode, the scope scrolls old data to the left to make
room for new data on the right side of the scope display. This mode is
graphically intensive and can affect run-time performance. However,
it is beneficial for debugging and monitoring time-varying signals.
This property is Tunable.
The default setting is Wrap.
Time units
Specify the units used to describe the time-axis. You can select one of
the following options:
Metric In this mode, the scope converts the times on the time-axis
to the most appropriate measurement units. These can include
milliseconds, microseconds, nanoseconds, minutes, days, etc. The
scope chooses the appropriate measurement units based on the
minimum time-axis limit and the maximum time-axis limit of the
scope window.
Seconds In this mode, the scope always displays the units on the
time-axis as seconds.
None In this mode, the scope does not display any units on the
time-axis. The scope only shows the word Time on the time-axis.
This property is Tunable.
The default setting is Metric.
Time display offset
This property allows you to offset the values displayed on the time-axis
by a specified number of seconds. When you specify a scalar value, the
1-1613
Time Scope
scope offsets all channels equally. When you specify a vector of offset
values, the scope offsets each channel independently. Tunable.
When you specify a Time display offset vector of length N, the scope
offsets the input channels as follows:
When N is equal to the number of input channels, the scope offsets
each channel according to its corresponding value in the offset vector.
When N is less than the number of input channels, the scope applies
the values you specify in the offset vector to the first N input
channels. The scope does not offset the remaining channels.
When N is greater than the number of input channels, the scope
offsets each input channel according to the corresponding value in
the offset vector. The scope ignores all values in the offset vector that
do not correspond to a channel of the input.
The scope computes the time-axis range using the values of the Time
display offset and Time span properties. For example, if you set the
Time display offset to 5e-6 and the Time span to 25e-6, the scope
sets the time-axis limits as shown in the following figure.
Similarly, when you specify a vector of values, the scope sets the
minimum time-axis limit using the smallest value in the vector. To set
the maximum time-axis limit, the scope sums the largest value in the
1-1614
Time Scope
vector with the value of the Time span property. For more information,
see Signal Display on page 1-1548.
Time-axis labels
Specify how to display the time units used to describe the time-axis.
The default setting is All. You can select one of the following options:
All The time-axis labels appear in all displays.
None The time-axis labels do not appear in the displays.
Bottom Displays Only The time-axis labels appear in only the
bottom row of the displays.
Tunable.
Show time-axis label
Select this check box to show the time-axis label on the scope display.
This check box is not available if Time-axis labels is None.
Display Pane
The Display pane of the Configuration Properties dialog box appears
as follows.
1-1615
Time Scope
Active display
1-1616
Time Scope
Show legend
Select this check box to show the legend in the display. The channel
legend displays a name for each channel of each input signal. When
the legend appears, you can place it anywhere inside of the scope
window. To turn the legend off, clear the Show legend check box.
This parameter applies only when the Spectrum Type is Power or
Power density. Tunable
You can edit the name of any channel in the legend. To do so,
double-click the current name, and enter a new channel name. By
default, the scope names each channel according to either its signal
name or the name of the block from which it comes. If the signal has
multiple channels, the scope uses an index number to identify each
channel of that signal.
Time Scope does not display signal names that were labeled within an
unmasked subsystem. You must label all input signals to the scope
block that originate from an unmasked subsystem.
To change the appearance of any channel of any input signal in the
scope window, from the menu, select View > Style.
Show grid
When you select this check box, a grid appears in the display of the
scope figure. To hide the grid, clear this check box. Tunable
Plot signals as magnitude and phase
When you select this check box, the scope splits the display into a
magnitude plot and a phase plot. By default, this check box is cleared.
If the input signal is complex valued, the scope plots the real and
imaginary portions on the same axes. These real and imaginary
portions appear as different-colored lines on the same axes, as shown in
the following figure.
1-1617
Time Scope
Selecting this check box and clicking the Apply or OK button changes
the display. The magnitude of the input signal appears on the top
axes and its phase, in degrees, appears on the bottom axes. See the
following figure.
1-1618
Time Scope
absolute value of the signal for the magnitude. The phase is 0 degrees
for nonnegative input and 180 degrees for negative input. Tunable
Y-limits (Minimum)
Specify as a string the text for the scope to display to the left of the
y-axis. Tunable
This property becomes invisible when you select the Plot signal(s) as
magnitude and phase check box. When you enable that property, the
y-axis label always appears as Magnitude on the top axes and Phase
on the bottom axes.
Logging Pane
The Logging pane of the Configuration Properties dialog box appears
as follows.
1-1619
Time Scope
When you select this check box, the scope logs data in the format you
select in Save format.
The default setting is unchecked and no data is logged.
Variable name
Select the format in which to save logged data. Unless otherwise noted,
you can save logged data for single- and multi-port data, sample-based
and frame-based data, variable-size data, MAT-file logging, and
external mode archiving. Valid values for Save format are:
Structure With Time Save logged data as a structure with
associated time information to the MATLAB workspace. Structure
With Time format does not support single- or multi-port frame-based
data.
1-1620
Time Scope
When you select this check box, the scope limits the number of data
points that it stores in a variable. Specify as a positive integer the
number of data points at the end of the simulation data that the scope
logs.
The default setting is unchecked, so that all data is logged. When
checked, the default is the last 5000 data points.
Decimation
When you select this check box, the scope logs every Nth data point,
where N is the decimation factor you specify.
The default setting is unchecked, so that logged data is not decimated.
When checked, the default decimation rate is 2.
Style
Dialog
Box
In the Style dialog box, you can customize the style of displays. You can
change the color of the figure containing the displays, the background
and foreground colors of display axes, and properties of lines in a
display. From the scope menu, select View > Style or select the Style
button ( ) in the dropdown below the Configuration Properties button
to open this dialog box.
1-1621
Time Scope
Properties
The Style dialog box allows you to modify the following properties of
the scope figure:
Figure color
Specify the color that you want to apply to the background of the scope
figure. By default, the figure color is gray.
Plot type
Specify the type of plot to use. The default setting is Line. Valid values
for Plot type are:
Line Displays input signal as lines connecting each of the sampled
values. This approach is similar to the functionality of the MATLAB
line or plot function.
1-1622
Time Scope
Specify the color that you want to apply to the background of the axes
for the active display.
Properties for line
Specify the signal for which you want to modify the visibility, line
properties, and marker properties.
Visible
Specify the line style, line width, and line color for the selected signal
on the active display.
1-1623
Time Scope
Marker
Specify marks for the selected signal on the active display to show at
data points. This property is similar to the Marker property for the
MATLAB Handle Graphics plot objects. You can choose any of the
marker symbols from the following table.
Specifier
Marker Type
none
No marker (default)
Circle
Square
Cross
Point
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)
1-1624
Time Scope
Stepping
Options
The Simulation Stepping Options dialog box lets you control the
simulation behavior. You can pause the simulation at a specified
time, enable stepping back, or specify options for stepping back.
You can also modify the number of steps by which to step forward
or backward. To open this dialog box, in the Time Scope menu,
select Simulation > Stepping Options to open this dialog box.
Alternatively, if stepping back is disabled, in the Time Scope toolbar,
click the step back
button.
1-1625
Time Scope
Specify the maximum number of back steps that the Time Scope saves
in memory. To maximize simulation speed, the value for this property
should be kept small. The default setting is 10.
Interval between stored back steps
Specify the number of steps between back steps that the Time Scope
saves in memory for stepping backward. Set this property to a larger
number to increase the time span of a back step without increasing the
amount of memory used. The default setting is 1.
Move back/forward by
Specify the number of steps forward or backward that the Scope
progresses when you click the step forward (
buttons. The default setting is 1.
Specify the time at which you want Scope to pause when the check
box is selected.
ToolsAxes
Scaling
Properties
Select Tools > Axes Scaling Properties to open the Axes Scaling
Properties dialog box. This dialog box provides you with the ability to
automatically zoom in on and zoom out of your data, and to scale the
axes of the Scope.
Properties
The ToolsAxes Scaling Properties dialog box appears as follows.
1-1626
Time Scope
Axes scaling
Specify when the scope should automatically scale the axes. You can
select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes. You can manually scale the axes in
any of the following ways:
Auto When you select this option, the scope scales the axes as
needed, both during and after simulation. Selecting this option shows
the Do not allow Y-axis limits to shrink check box.
After N Updates Selecting this option causes the scope to scale
the axes after a specified number of updates. Selecting this option
shows the Number of updates edit box.
1-1627
Time Scope
When you select this property, the y-axis is allowed only to grow during
axes scaling operations. If you clear this check box, the y-axis or color
limits may shrink during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
property. When you set the Axes scaling property to Manual or After
N Updates, the y-axis or color limits are allowed to shrink. Tunable.
Number of updates
Select this check box to scale the axes when the simulation stops. The
y-axis is always scaled. The x-axis limits are only scaled if you also
select the Scale X-axis limits check box.
Y-axis Data range (%)
Set the percentage of the y-axis that the scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the y-axis
limits such that your data uses the entire y-axis range. If you then set
this property to 30, the scope increases the y-axis range such that your
data uses only 30% of the y-axis range. Tunable.
Y-axis Align
Specify where the scope should align your data with respect to the y-axis
when it scales the axes. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
1-1628
Time Scope
Set the percentage of the x-axis that the Scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the x-axis
limits such that your data uses the entirex-axis range. If you then set
this property to 30, the Scope increases the x-axis range such that your
data uses only 30% of the x-axis range. Use the x-axis Align property to
specify data placement with respect to the x-axis.
This property appears only when you select the Scale X-axis limits
check box. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
Examples
The first few examples illustrate how to use the Time Scope block to
view a variety of input signals in the time domain.
Example: Display Complex-valued Input Signal on page 1-1630
Example: Display Input Signal of Changing Size on page 1-1632
Example: Display Simulink Enumeration Input Signal on page
1-1634
The remaining examples demonstrate how to use the Measurements
Panels in the Time Scope figure to glean information about the input
signals.
Example: Use Bilevel Measurements Panel with Clock Input Signal
on page 1-1637
Example: Find Heart Rate Using Peak Finder Panel with ECG
Input Signal on page 1-1641
1-1629
Time Scope
1-1630
Time Scope
1-1631
Time Scope
1-1632
Time Scope
In this example, the size of the input signal to the Time Scope block
changes as the simulation progresses. When the simulation time is less
than 5 seconds, Time Scope plots the signal connected to the third input
port of the Switch block, which has signal dimensions 1 by 2. After 5
seconds, Time Scope plots the signal connected to the first input port of
the Switch block, which has signal dimensions 1 by 3. Run your model
to see the time domain output, as shown in the following figure.
1-1633
Time Scope
As you can see in the figure, the third line on the display, colored red,
appears only after 5 seconds.
1-1634
Time Scope
1-1635
Time Scope
'AddClassNameToEnumNames', true);
end
x = [BasicColors(0), BasicColors(2), BasicColors(1)];
As you can see in the figure, the y-axis shows the units of amplitude as
one of Red, Yellow, or Blue. The input signal value changes from Red to
Blue at 3 seconds and from Blue to Yellow at 6 seconds.
1-1636
Time Scope
1-1637
Time Scope
Run your model to see the time domain output. To show the
Bilevel Measurements panel, in the Time Scope menu, select
Tools > Measurements > Bilevel Measurements. To collapse the
Transitions pane, click the pane collapse button ( ) next to that label.
To expand the Settings pane and the Overshoots / Undershoots
pane, click the pane expand button ( ) next to each label. The Time
Scope figure appears as shown in the following figure.
1-1638
Time Scope
As you can see in the figure, the value for the rising edge Settling
Time parameter is initially not displayed. The reason for this is that
the default value for the Settle Seek parameter is too large for this
example. In this case, the settle seek time is longer than the entire
simulation duration. Enter a value for settle seek of 2e-6, and press
the Enter key. Time Scope now displays a rising edge settling time
value of 118.392 ns.
The settling time value displayed is actually the statistical average of
the settling times for all five rising edges. To show the settling time for
1-1639
Time Scope
only one rising edge, you can zoom in on that transition. In the Time
). Click on the display near a
Scope toolbar, click the Zoom X button (
value of 2 microseconds on the time-axis. Drag to the right and release
near a value of 4 microseconds on the time-axis. Time Scope updates
the rising edge Settling Time value to reflect the new time window,
as shown in the following figure.
1-1640
Time Scope
Example: Find Heart Rate Using Peak Finder Panel with ECG
Input Signal
At the MATLAB command prompt, type ex_timescope_heartbeat to
open the example model. The following Simulink model appears.
In this example, Simulink imports the variable mhb from the MATLAB
workspace. The variable mhb is created when the model loads because
the commands that construct mhb are in the Preload function. To
view these commands, in the Simulink menu, select File > Model
Properties > Model Properties. The Model Properties dialog box
appears. Click the Callbacks tab. The following lines of MATLAB
code appear.
x1 = 3.5*ecg(2700).';
y1 = sgolayfilt(kron(ones(1,13),x1),0,21);
n = (1:30000)';
1-1641
Time Scope
del = round(2700*rand(1));
mhb = y1(n + del);
ts = 0.00025;
1-1642
Time Scope
As you can see from the list of peak values, there is a constant time
difference of 0.675 seconds between each heartbeat. Therefore, the
heart rate of the ECG signal is given by the following equation.
sec
min 88.89 beats (bpm)
sec
min
0.675
beat
60
1-1643
Time Scope
Supported
Data
Types
Port
Input
Supported
Simulation
Modes
1-1644
You can use the scope block in models running the following supported
simulation modes.
Mode
Supported
Notes and Limitations
Normal
Yes
Accelerator
Yes
Rapid
Accelerator
Yes
PIL
No
Time Scope
Mode
Supported
Notes and Limitations
SIL
No
External
Yes
For more information about these modes, see How Acceleration Modes
Work in the Simulink documentation.
See Also
How To
1-1645
Purpose
Library
dspobslib
Description
1-1646
Purpose
Library
dspobslib
Description
1-1647
Toeplitz
Purpose
Library
Description
The Toeplitz block generates a Toeplitz matrix from inputs defining the
first column and first row. The top input (Col) is a vector containing the
values to be placed in the first column of the matrix, and the bottom
input (Row) is a vector containing the values to be placed in the first
row of the matrix.
y = toeplitz(Col,Row)
1
2
4
5
7 3 3 2 1 3
1 7 3 3 2 1
2 1 7 3 3 2
3 2 1 7 3 3
4 3 2 1 7 3
When you select the Symmetric check box, the block generates a
symmetric (Hermitian) Toeplitz matrix from a single input, u, defining
both the first row and first column of the matrix.
1-1648
Toeplitz
y = toeplitz(u)
1
2
2 3 4
1 2 3
2 1 2
3 2 1
Dialog
Box
Symmetric
When selected, enables the single-input configuration for
symmetric Toeplitz matrix output.
Saturate on integer overflow
When you generate a symmetric Toeplitz matrix with this block, if
the input vector is complex, the output is a symmetric Hermitian
matrix whose elements satisfy the relationship
1-1649
Toeplitz
Supported
Data
Types
Port
Input
Toep
Col
1-1650
Toeplitz
Port
Toep
Row
Output
See Also
toeplitz
MATLAB
1-1651
To Audio Device
Purpose
Library
Sinks
dspsnks4
Description
The To Audio Device block sends audio data to your computers audio
device. This block is not supported for use with the Simulink Model
block.
Use the Device parameter to specify the device to which you want to
send the audio data. This parameter is automatically populated based
on the audio devices installed on your system. If you plug or unplug
an audio device from your system, type clear mex at the MATLAB
command prompt to update the list.
Select the Inherit sample rate from input check box if you want the
block to inherit the sample rate of the audio signal from the input to
the block. If you clear this check box, the Sample rate (Hz) parameter
appears on the block. Use this parameter to specify the number of
samples per second in the signal.
The range of supported audio device sample rates and data type
formats, depend on both the sound card and the API which is chosen
for the sound card.
Use the Device data type to specify the data type of the audio data
that is sent to the device. You can choose:
8-bit integer
16-bit integer
24-bit integer
32-bit float
Determine from input data type
If you choose Determine from input data type, the following table
summarizes the blocks behavior.
1-1652
To Audio Device
32-bit integer
24-bit integer
16-bit integer
16-bit integer
8-bit integer
8-bit integer
If you choose Determine from input data type and the device does
not support the input data type, the block uses the next lowest-precision
data type supported by the device.
The generated code for this block relies on prebuilt .dll files. You can
run this code outside the MATLAB environment, or redeploy it, but be
sure to account for these extra .dll files when doing so. The packNGo
function creates a single zip file containing all of the pieces required to
run or rebuild this code. See packNGo for more information.
Buffering
The To Audio Device block buffers the data from a Simulink signal
using the process illustrated by the following figure.
Simulink
Frame
Queue
Buffer
Physical
Device
1-1653
To Audio Device
Specify the size of this queue using the Queue duration (seconds)
parameter. As Simulink runs, the block appends Simulink frames to
the bottom of the queue.
2 At each time step, the blocks sends a buffer of samples from the top of
did not contain enough data to completely fill the buffer, the block
fills the remaining portion of the buffer with zeros. This data has a
the data type specified by the Device data type parameter.
When the simulation throughput rate is lower than the hardware
throughput rate, the queue, which is initially full, becomes empty. If the
queue is empty, the block sends zeros (silence) to the audio device. When
the simulation throughput rate is higher than the hardware throughput
rate, the To Audio Device block waits to write data to the queue.
To minimize the chance of dropouts, the block checks to make sure the
queue duration is at least as large as the maximum of the buffer size
and the frame size. If it is not, the queue duration is automatically
set to this maximum value.
Channel Mapping
The term Channel Mapping refers to a 1-to-1 mapping that associates
channels on the selected audio device to channels of the data. When
you play audio, channel mapping allows you to specify which channel
of the audio device directs input to a specific channel of audio data.
You can specify channel mapping as a vector of output channel
indices corresponding to each output channel of data being written.
The default value in the Device Output Channels parameter is
1:MAXOUTPUTCHANNELS. If you do not select the default mapping,
1-1654
To Audio Device
Troubleshooting
Not Keeping up in Real Time
1-1655
To Audio Device
1-1656
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
To Audio Device
Platform
Command
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
1-1657
To Audio Device
Example
1-1658
To Audio Device
Dialog
Box
Device
Specify which device to send the audio data to.
Inherit sample rate from input
Select this check box if you want the block to inherit the sample
rate of the audio signal from the input to the block.
Sample rate (Hz)
Specify the number of samples per second in the signal. This
parameter is visible when the Inherit sample rate from input
check box is cleared.
Device data type
Specify the data type of the audio data sent to the device.
Automatically determine buffer size
Select this check box to allow the block to calculate a conservative
buffer size.
1-1659
To Audio Device
Supported
Data
Types
Port
Input
See Also
1-1660
To Multimedia File
audioplayer
MATLAB
sound
MATLAB
dsp.AudioPlayer
System Object
To Multimedia File
Purpose
Library
Sinks
dspsnks4
Description
1-1661
To Multimedia File
packNGo function creates a single zip file containing all of the pieces
required to run or rebuild this code. See packNGo for more information.
To run an executable file that was generated from a model containing
this block, you may need to add precompiled shared library files to your
system path. See Understanding Code Generation for details.
Mac OS X
1-1662
To Multimedia File
Windows 7
Mac OS X
Ports
Port
Description
Image
R, G, B
Audio
Y, Cb, Cr
N
2
N
Cr: M x
2
Cb: M x
1-1663
To Multimedia File
Dialog
Box
File name
Specify the name of the multimedia file. The block saves the file
in your current folder. To specify a different file or location, click
the Save As... button.
File type
Specify the file type of the multimedia file. You can select avi,
wav, wma, or wmv.
1-1664
To Multimedia File
Write
Specify whether the block writes video frames, audio samples, or
both to the multimedia file. You can select Video and audio,
Video only, or Audio only.
Audio compressor
Select the type of compression algorithm to use to compress the
audio data. This compression reduces the size of the multimedia
file. Choose None (uncompressed) to save uncompressed audio
data to the multimedia file.
Note The other items available in this parameter list are
the audio compression algorithms installed on your system.
For information about a specific audio compressor, see the
documentation for that compressor.
Audio data type
Select the audio data type. You can use the Audio data type
parameter only for uncompressed wave files.
Video compressor
Select the type of compression algorithm to use to compress the
video data. This compression reduces the size of the multimedia
file. Choose None (uncompressed) to save uncompressed video
data to the multimedia file.
Note The other items available in this parameter list are
the video compression algorithms installed on your system.
For information about a specific video compressor, see the
documentation for that compressor.
File color format
Select the color format of the data stored in the file. You can select
either RGB or YCbCr 4:2:2.
1-1665
To Multimedia File
Image signal
Specify how the block accepts a color video signal. If you select One
multidimensional signal, the block accepts an M-by-N-by-P
color video signal, where P is the number of color planes, at one
port. If you select Separate color signals, additional ports
appear on the block. Each port accepts one M-by-N plane of an
RGB video stream.
1-1666
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
To Multimedia File
Supported
Data
Types
For the block to display video data properly, double- and single-precision
floating-point pixel values must be between 0 and 1. Any other data
type requires the pixel values between the minimum and maximum
values supported by their data type.
Check the specific codecs you are using for supported audio rates.
Port
Supports Complex
Values?
Image
No
No
Audio
No
See Also
No
1-1667
Purpose
Library
dspwin32
Description
Note Models that contain both the To Wave Device block and the From
Wave Device block require a duplex-capable sound card.
The Use default audio device check box allows the To Wave Device
block to detect and use the systems default audio hardware. You should
select this option for systems that have a single sound device installed,
or when the default sound device on a multiple-device system is your
desired target. When the default sound device is not your desired
output device, clear Use default audio device, and set the desired
hardware in the Audio device parameter. This parameter lists the
names of the installed audio devices.
The block input can contain audio data from a mono or stereo signal.
A mono signal is represented as either a sample-based scalar or a
frame-based length-M vector, where M is frame size. A stereo signal
is represented as a sample-based length-2 vector or a frame-based
M-by-2 matrix.
1-1668
When the input data type is uint8, the block conveys the signal
samples to the audio device using 8 bits. When the input data type is
double, single, int16, or fixed point with a word length of 16 and
a fraction length of 15, the block conveys the signal samples to the
audio device using 16 bits by default. For inputs of data type double
and single, you can also set the block to convey the signal samples
using 24 bits by selecting the Enable 24-bit output for double- and
single-precision input signals check box. The 24-bit sample width
requires more memory but in general yields better fidelity.
The amplitude of the input must be in a valid range that depends on the
input data type, as shown in the following table. Amplitudes outside
the valid range are clipped to the nearest allowable value.
Input Data
Type
double
single
int16
uint8
Fixed point
with a word
length of 16
and a fraction
length of 15
1 amplitude < 1
1 amplitude < 1
32768 amplitude 32767
0 amplitude 255
1 amplitude 1 215
Buffering
Because audio devices generate real-time audio output, the Simulink
environment must maintain a continuous flow of data to a device
throughout simulation. Delays in passing data to the audio hardware
can result in hardware errors or distortion of the output. This means
that the To Wave Device block must in principle supply data to the
1-1669
The Queue duration parameter defines the overall size of the blocks
buffer. The block reads in chunks of data in the size of the input
dimensions and stores them in the buffer. The internal buffer size
defines the dimensions of the block output to the hardware. You can
define the internal buffer size yourself in the User-defined internal
buffer size parameter. If you select Automatically determine
internal buffer size instead, the internal buffer size is calculated for
you according to the following rules:
1-1670
If the input to the block has a frame size of 32 samples or larger, the
internal buffer size be the same as the input frame size.
If the input to the block has a frame size smaller than 32 samples,
the internal buffer size is based on the input sample rate according to
the following table, where
Fs = sampling frequency =
1
sample time
1-1671
Fs (Hz)
Fs < 8000
min(64, 2 * Fs )
128
256
512
Fs 96, 000
1024
Troubleshooting
If you are getting undesirable audio output using the To Wave Device
block, first determine whether your model can run in real time. Replace
the To Wave Device block with a To Wave File block, run the model, and
compare the models simulation stop time to the elapsed time on your
watch. If the model simulation stop time is less than the elapsed time
on your watch, your model can probably run in real time. Then,
If your model can run in real time,
1 Select Automatically determine internal buffer size. This
1-1672
If none of these are possible, but the model only runs for a short
period of time, set the Queue duration parameter to a size equal
to a significant fraction of the model stop time and use a similarly
large initial delay. This is not an optimal solution, but might work
in some cases.
1-1673
Dialog
Box
1-1674
1-1675
Supported
Data
Types
Port
Input
See Also
1-1676
To Wave File
(Obsolete)
audioplayer
MATLAB
sound
MATLAB
Purpose
Library
dspwin32
Description
Note AVI files are the only supported file type for non-Windows
platforms.
1-1677
Dialog
Box
File name
Specify the path and name of the file to write. Paths can be
relative or absolute. You do not need to specify the.wav extension.
Sample width (bits)
Specify the number of bits used to represent the signal samples in
the file. The higher sample width settings require more memory
but yield better fidelity for double- and single-precision inputs:
8 Allocates 8 bits to each sample, allowing a resolution of
256 levels
16 Allocates 16 bits to each sample, allowing a resolution
of 65536 levels
24 Allocates 24 bits to each sample, allowing a resolution
of 16777216 levels
32 Allocates 32 bits to each sample, allowing a resolution of
232 levels ranging from -1 to 1
1-1678
The 8-, 16-, and 24-bit modes output integer data, while the 32-bit
mode outputs single-precision floating-point data.
Minimum number of samples for each write to file
Specify the number of consecutive samples, L, to write with each
file access. To reduce the required number of file accesses, the
block writes L consecutive samples to the file during each access
for L M . For L < M , the block instead writes M consecutive
samples during each access. Larger values of L result in fewer file
accesses, which reduces run-time overhead.
Supported
Data
Types
Port
Input
See Also
To Audio Device
Signal To Workspace
To Workspace
Simulink
wavwrite
MATLAB
1-1679
Transpose
Purpose
Transpose matrix
Library
Description
When you do not select the Hermitian check box, the block performs
the nonconjugate transpose.
y = u.'
1-1680
Transpose
Dialog
Box
Hermitian
When selected, specifies the complex conjugate transpose.
Saturate on integer overflow
This parameter is only visible when the Hermitian parameter is
selected because overflows can occur when computing the complex
conjugate of complex fixed-point signals. When you select this
parameter, such overflows saturate. This parameter is ignored for
floating-point signals and for real-valued fixed-point signals.
Supported
Data
Types
Input
1-1681
Transpose
Port
Output
See Also
1-1682
Math Function
Simulink
Permute Matrix
Reshape
Simulink
Submatrix
Purpose
Library
dspobslib
Description
Note The Triggered Delay Line block is still supported but is likely to
be obsoleted in a future release. We strongly recommend replacing this
block with the Delay Line block.
The Triggered Delay Line block acquires a collection of Mo input
samples into a frame, where you specify Mo in the Delay line size
parameter. The block buffers a single sample from input 1 whenever
it is triggered by the control signal at input 2 ( ). When the next
triggering event occurs, the newly acquired input sample is appended to
the output frame so that the new output overlaps the previous output
by Mo-1 samples. Between triggering events the block ignores input 1
and holds the output at its last value.
You specify the triggering event at input 2 in the Trigger type pop-up
menu:
Rising edge triggers execution of the block when the trigger input
rises from a negative value to zero or a positive value, or from zero
to a positive value.
Falling edge triggers execution of the block when the trigger input
falls from a positive value to zero or a negative value, or from zero
to a negative value.
Either edge triggers execution of the block when either a rising or
falling edge (as described above) occurs.
The Triggered Delay Line block has zero latency, so the new input
appears at the output in the same simulation time step. The output
frame period is the same as the input sample period, Tfo=Tsi.
1-1683
Sample-Based Operation
In sample-based operation, the Triggered Delay Line block buffers a
sequence of sample-based length-N vector inputs (1-D, row, or column)
into a sequence of overlapping sample-based Mo-by-N matrix outputs,
where you specify Mo in the Delay line size parameter (Mo>1). That
is, each input vector becomes a row in the sample-based output matrix.
When Mo=1, the input is simply passed through to the output, and
retains the same dimension. Sample-based full-dimension matrix
inputs are not accepted.
Frame-Based Operation
In frame-based operation, the Triggered Delay Line block rebuffers a
sequence of frame-based Mi-by-N matrix inputs into an sequence of
overlapping frame-based Mo-by-N matrix outputs, where Mo is the
output frame size specified by the Delay line size parameter (that is,
the number of consecutive samples from the input frame to rebuffer into
the output frame). Mo can be greater or less than the input frame size,
Mi. Each of the N input channels is rebuffered independently.
Initial Conditions
The Triggered Delay Line blocks buffer is initialized to the value
specified by the Initial condition parameter. The block always
outputs this buffer at the first simulation step (t=0). When the blocks
output is a vector, the Initial condition can be a vector of the same
size or a scalar value to be repeated across all elements of the initial
output. When the blocks output is a matrix, the Initial condition
can be a matrix of the same size or a scalar to be repeated across all
elements of the initial output.
1-1684
Dialog
Box
Trigger type
The type of event that triggers the blocks execution.
Delay line size
The length of the output frame (number of rows in output matrix),
M o.
Initial condition
The value of the blocks initial output, a scalar, vector, or matrix.
1-1685
Supported
Data
Types
Port
Input
Trigger
Output
See Also
1-1686
Buffer
Delay Line
Unbuffer
Purpose
Library
Signal Operations
dspsigops
Description
Trigger Event
You specify the triggering event at the input port in the Trigger type
pop-up menu:
Rising edge triggers execution of the block when the trigger input
rises from a negative value to zero or a positive value, or from zero
to a positive value.
Falling edge triggers execution of the block when the trigger input
falls from a positive value to zero or a negative value, or from zero
to a negative value.
1-1687
1-1688
Dialog
Box
Signal
The name of the MATLAB workspace variable from which to
import the signal, or a valid MATLAB expression specifying the
signal.
Trigger type
The type of event that triggers the blocks execution.
Initial output
The value to output until the first trigger event is received.
Samples per frame
The number of samples, Mo, to buffer into each output frame.
This value must be 1 when you specify a 3-D array in the Signal
parameter.
1-1689
Supported
Data
Types
See Also
1-1690
Signal To Workspace
Triggered To Workspace
Triggered To Workspace
Purpose
Library
Sinks
dspsnks4
Description
1-1691
Triggered To Workspace
Falling edge triggers execution of the block when the trigger input
falls from a positive value to zero or a negative value, or from zero
to a negative value.
Either edge triggers execution of the block when either a rising or
falling edge (as described above) occurs.
To save a record of the sample time corresponding to each sample value,
open the Configuration Parameters dialog box. In the Select pane,
click Data Import/Export. In the Save to workspace section, select
the Time check box.
The nontriggered version of this block is the Signal To Workspace block.
1-1692
Triggered To Workspace
Dialog
Box
Trigger type
The type of event that triggers the blocks execution.
Variable name
The name of the workspace variable in which to store the data.
1-1693
Triggered To Workspace
1-1694
Triggered To Workspace
Supported
Data
Types
See Also
Port
Input
Trigger
Signal To Workspace
To Workspace
Simulink
1-1695
Purpose
Library
Description
1-1696
H ( z ) = B ( z ) = b1 + b2 z1 + + bm z(m1)
Each filter should be a half-band filter that passes the frequency band
that the other filter stops. You can use the Two-Channel Synthesis
Subband Filter block to reconstruct the input to this block. To do so,
you must design perfect reconstruction filters to use in the synthesis
subband filter.
The best way to design perfect reconstruction filters is to use the
Wavelet Toolbox wfilters function in to design both the filters both in
this block and in the Two-Channel Synthesis Subband Filter block. You
can also use other DSP System Toolbox and Signal Processing Toolbox
functions. To learn how to design your own perfect reconstruction
filters, see References on page 1-1709.
The Two-Channel Analysis Subband Filter block initializes all filter
states to zero.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block accepts an M-by-N matrix. The
block treats each column of the input as the high- or low-frequency
subbands of the corresponding output channel. You can use the Rate
options parameter to specify how the block resamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input to the block can be an M-by-N matrix, where
M is a multiple of two. The block treats each column of the input as
1-1697
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats an M-by-N matrix input
as M N independent channels. The block decomposes each channel
over time and outputs two M-by-N matrices whose sample rates are
half the input sample rate. Each element in the output matrix is the
high- or low-frequency subband output of the corresponding element
of the input matrix.
Depending on the setting of your Simulink configuration parameters,
the output may have one sample of latency, as described in the
Latency on page 1-1698 section.
Latency
When you set the Input processing parameter to Columns as
channels (frame based) and the Rate options parameter to Enforce
single-rate processing, the Two-Channel Analysis Subband Filter
block always has zero-tasking latency. Zero-tasking latency means that
the block propagates the first input sample (received at time t=0) as the
first output sample.
1-1698
Latency
Elements as
channels
(sample based)
SingleTasking
None.
MultiTasking or
Auto
Columns as
channels (frame
based)
SingleTasking,
MultiTasking or
Auto
Input processing
1-1699
there is latency. Though the output values differ, both sets of values are
valid; the difference arises from changes in latency. See the Latency
on page 1-1698 section for more information about when latency can
occur in the Two-Channel Analysis Subband Filter block.
In some cases, rather than connecting several Two-Channel Analysis
Subband Filter blocks, you can use the Dyadic Analysis Filter Bank
block, which is faster and requires less memory. In particular, the
Dyadic Analysis Filter Bank block is more efficient under the following
conditions:
The frame size of the signal you are decomposing is a multiple of 2n.
You are decomposing the signal into n+1 or 2n subbands.
In all other cases, use Two-Channel Analysis Subband Filter blocks to
implement your filter banks.
1-1700
The Dyadic Analysis Filter Bank block allows you to specify the filter
bank filters by providing vectors of filter coefficients, just as this block
does. The Dyadic Analysis Filter Bank block provides an additional
option of using wavelet-based filters that the block designs by using a
wavelet you specify.
For fixed-point signals, you can set the coefficient, product output,
accumulator, and output data types of the FIR Decimation blocks as
discussed in Dialog Box on page 1-1701. For a diagram showing the
usage of these data types, see the FIR Decimation block reference page.
Dialog
Box
1-1701
1-1702
1-1703
Rate options
Specify the rate processing rule for the block. You can set this
parameter to one of the following options:
Enforce single-rate processing When you select
this option, the block treats each column of the input as an
independent channel and decomposes each channel over time.
The output has the same sample rate as the input, but the
output frame size is half that of the input frame size. To select
this option, you must set the Input processing parameter to
Columns as channels (frame based).
Allow multirate processing When you select this option,
the input and output of the block are the same size, but the
sample rate of the output is half that of the input.
Some settings of this parameter cause the block to have nonzero
latency. See Latency on page 1-1698 for more information.
The Data Types pane of the Two-Channel Analysis Subband Filter
block dialog appears as follows.
1-1704
Rounding mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they are always rounded
to Nearest.
1-1705
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
Same
1-1706
1-1707
Same
as accumulator
1-1708
References
Supported
Data
Types
See Also
DWT
FIR Decimation
IDWT
fir1
fir2
firls
wfilters
Wavelet Toolbox
1-1709
1-1710
Purpose
Library
Description
1-1711
H ( z ) = B ( z ) = b1 + b2 z1 + + bm z(m1)
Each filter should be a half-band filter that passes the frequency band
that the other filter stops. You can use this block to reconstruct the
output of a Two-Channel Analysis Subband Filter block. To do so, you
must design the filters in this block such that they perfectly reconstruct
the outputs of the analysis filters.
The best way to design perfect reconstruction filters is to use the
Wavelet Toolbox wfilters function for the filters in both this block
and in the corresponding Two-Channel Analysis Subband Filter block.
You can also use DSP System Toolbox and Signal Processing Toolbox
functions. To learn how to design your own perfect reconstruction
filters, see References on page 1-1725.
The Two-Channel Synthesis Subband Filter block initializes all filter
states to zero.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block accepts any two M-by-N matrices
with the same frame rates. The block treats each column of the input
as the high- or low-frequency subbands of the corresponding output
1-1712
channel. You can use the Rate options parameter to specify how the
block resamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input to the block can be any two M-by-N matrices
with the same frame rate. The block treats each input column as
the high- or low-frequency subbands of the corresponding output
channel. The input to the topmost input port should contain the
high-frequency subbands. The block outputs one matrix, where each
column is reconstructed from the corresponding columns of each
input matrix. The input and output frame rates are the same, but the
frame size of the output is twice that of the input.
When you set the Rate options parameter to Allow multirate
processing, the block treats each column of the input as the high- or
low-frequency subbands of the corresponding output channel. The
input to the topmost input port should contain the high-frequency
subbands. The block outputs one matrix, where each column is
reconstructed from the corresponding columns of the input matrices.
The input and output frame sizes are the same, but the frame rate of
the output is twice that of the input. Thus, the overall sample rate of
the output is twice that of the input sample rate.
In this mode, the block has one frame of latency, as described in the
Latency on page 1-1714 section.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block accepts any two M-by-N matrices
with the same sample rates. The block treats each M-by-N matrix as M
N independent subbands. Each element of the input matrices is the
high- or low-frequency subband of the corresponding channel in the
output matrix. The input to the topmost input port should contain the
high-frequency subbands. The block outputs one matrix with the same
dimensions as the input matrices, but a sample rate that is twice that of
the input. The block reconstructs each element of the output from the
corresponding elements in the input matrices.
1-1713
Latency
When you set the Input processing parameter to Columns as
channels (frame based) and the Rate options parameter to Enforce
single-rate processing, the Two-Channel Synthesis Subband Filter
block always has zero-tasking latency. Zero-tasking latency means that
the block propagates the first input sample (received at time t= 0) as the
first output sample.
When you set the Rate options parameter to Allow multirate
processing, the Two-Channel Synthesis Subband Filter block may
exhibit latency. The amount of latency depends on the setting of
the Input processing parameter of this block and the setting of the
Simulink Tasking mode for periodic sample times configuration
parameter. The following table summarizes the conditions that produce
latency when the block is performing multirate processing.
Tasking mode for
periodic sample
times
Latency
Elements as
channels
(sample based)
SingleTasking
None.
MultiTasking or
Auto
Columns as
channels (frame
based)
SingleTasking,
MultiTasking or
Auto
Input processing
1-1714
1-1715
The Dyadic Synthesis Filter Bank block allows you to specify the filter
bank filters by providing vectors of filter coefficients, just as this block
does. The Dyadic Synthesis Filter Bank block provides an additional
option of using wavelet-based filters that the block designs by using a
wavelet you specify.
1-1716
For fixed-point signals, you can set the coefficient, product output,
accumulator, and output data types used in the FIR Interpolation
blocks as discussed in Dialog Box on page 1-1717. For a diagram
showing the usage of these data types within the FIR blocks, see the
FIR Interpolation block reference page.
In addition, the inputs to the Sum block shown in the previous diagram
are accumulated using the accumulator data type. The output of the
Sum block is then cast from the accumulator data type to the output
data type. Therefore the output of the Two-Channel Synthesis Subband
Filter block is in the output data type. You also set these data types in
the block dialog box as discussed in the Dialog Box on page 1-1717
section.
Dialog
Box
1-1717
1-1718
Subband Filter block, you must design the filters in this block to
perfectly reconstruct the outputs of the analysis filters. For more
information, see Specifying the FIR Filters on page 1-1712.
Highpass FIR filter coefficients
A vector of highpass FIR filter coefficients, in descending
powers of z. The highpass filter should be a half-band filter
that passes the frequency band stopped by the filter specified
in the Lowpass FIR filter coefficients parameter. To use
this block to reconstruct the output of a Two-Channel Analysis
Subband Filter block, you must design the filters in this block to
perfectly reconstruct the outputs of the analysis filters. For more
information, see Specifying the FIR Filters on page 1-1712.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed - see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
Rate options
Specify the rate processing rule for the block. You can set this
parameter to one of the following options:
Enforce single-rate processing When you select
this option, the block treats each column of the input as an
1-1719
1-1720
Round mode
Select the rounding mode for fixed-point operations. The filter
coefficients do not obey this parameter; they always round to
Nearest.
1-1721
Inherit via
internal rule
Inherit via
internal rule
Same as accumulator
Same
1-1722
1-1723
Same
as accumulator
1-1724
References
Supported
Data
Types
See Also
DWT
FIR Interpolation
IDWT
fir1
fir2
firls
wfilters
Wavelet Toolbox
1-1725
1-1726
UDP Receive
Purpose
Library
Sources
dspsrcs4
Description
The UDP Receive block receives UDP packets from an IP network port
and saves them to its buffer. With each sample, the block output, emits
the contents of a single UDP packet as a data vector.
The generated code for this block relies on prebuilt .dll files. You can
run this code outside the MATLAB environment, or redeploy it, but be
sure to account for these extra .dll files when doing so. The packNGo
function creates a single zip file containing all of the pieces required to
run or rebuild this code. See packNGo for more information.
1-1727
UDP Receive
Dialog
Local IP port
Specify the IP port number upon which to receive UDP packets.
This value defaults to 25000. The value can range 165535.
1-1728
UDP Receive
1-1729
UDP Receive
1-1730
UDP Receive
See Also
1-1731
UDP Send
Purpose
Library
Sinks
dspsnks4
Description
The UDP Send block transmits an input vector as a UDP message over
an IP network port.
Note Some Simulink blocks and .exe files built from models that
contain those blocks require shared libraries, such as .dll files on
Windows. The UDP Send block requires networkdevice.dll. To meet
this requirement, open the packNGo topic, and follow the example
to package the code files for your model. The resulting compressed
folder contains the .dll files that the model requires, including
networkdevice.dll. To run this type of .exe file outside a MATLAB
environment, place the required .dll files in the same folder as the
.exe file, or place them in a folder on the Windows system path.
1-1732
UDP Send
Dialog
Box
1-1733
UDP Send
See Also
1-1734
Unbuffer
Purpose
Library
Description
The block adjusts the output rate so that the sample period is the same
at both the input and output, Tso=Tsi. Therefore, the output sample
period for an input of frame size Mi and frame period Tfi is Tfi/Mi, which
represents a rate Mi times higher than the input frame rate. In the
example above, the block receives inputs only once every three sample
periods, but produces an output once every sample period. To rebuffer
inputs to a larger or smaller frame size, use the Buffer block.
In the model below, the block unbuffers a four-channel input with a
frame size of three. The Initial conditions parameter is set to zero
and the tasking mode is set to multitasking, so the first three outputs
are zero vectors.
1-1735
Unbuffer
Zero Latency
The Unbuffer block has zero-tasking latency in Simulink single-tasking
mode. Zero-tasking latency means that the first input sample (received
at t=0) appears as the first output sample.
Nonzero Latency
For multitasking operation, the Unbuffer blocks buffer is initialized
with the value specified by the Initial conditions parameter, and
the block begins unbuffering this frame at the start of the simulation.
Inputs to the block are therefore delayed by one buffer length, or Mi
samples.
1-1736
Unbuffer
Dialog
Box
Initial conditions
The value of the blocks initial output for cases of nonzero latency.
You can specify a scalar, vector, or matrix.
1-1737
Unbuffer
Sample-based processing
Specify how the block processes sample-based inputs. You can
select one of the following options:
Same as frame based When you select this option, the
block performs frame-based processing on sample-based inputs.
The block unbuffers Mi-by-N matrix inputs into a 1-by-N
output. Each row of the input matrix becomes an independent
time-sample in the output.
Pass through (this choice will be removed
see
release notes) When you select this option and the input
to the block is sample based, the block does not unbuffer the
input. The output of the block is the same as the input.
Note This parameter will be removed in a future release.
Supported
Data
Types
Port
Input
Output
1-1738
Unbuffer
See Also
Buffer
1-1739
Uniform Decoder
Purpose
Library
Quantizers
dspquant2
Description
1-1740
Uniform Decoder
u = mod(u,2^B)
Signed input values, u, greater than 2B-1-1 or less than -2B-1 are wrapped
back into that range using mod-2B arithmetic.
u = (mod(u+2^B/2,2^B)-(2^B/2))
Examples
is
is
is
is
is
is
is
is
mapped
mapped
mapped
mapped
mapped
mapped
mapped
mapped
to
to
to
to
to
to
to
to
-2.0
-1.5
-1.0
-0.5
0.0
0.5
1.0
1.5
1-1741
Uniform Decoder
Dialog
Box
Peak
Specify the largest amplitude represented in the encoded input.
To correctly decode values encoded with the Uniform Encoder
block, set the Peak parameters in both blocks to the same value.
Bits
Specify the number of input bits, B, used to encode the data.
(This can be less than the total number of bits supplied by the
input data type.) To correctly decode values encoded with the
Uniform Encoder block, set the Bits parameters in both blocks
to the same value.
Overflow mode
Specify the blocks behavior when the integer input is outside the
range representable by B bits. Out-of-range inputs can either
saturate at the extreme value, or wrap back into range.
Output type
Specify the precision of the floating-point output, single or
double.
1-1742
Uniform Decoder
References
Supported
Data
Types
Port
Input
Output
See Also
Simulink
Quantizer
Simulink
Uniform Encoder
udecode
uencode
1-1743
Uniform Encoder
Purpose
Library
Quantizers
dspquant2
Description
1-1744
Uniform Encoder
Unsigned Integer
Signed Integer
2 to 8
uint8
int8
9 to 16
uint16
int16
17 to 32
uint32
int32
Examples
1-1745
Uniform Encoder
is
is
is
is
is
is
is
is
mapped
mapped
mapped
mapped
mapped
mapped
mapped
mapped
to
to
to
to
to
to
to
to
0
1
2
3
4
5
6
7
1-1746
Input
Quantized
Input
Output
1.6
1.5+0.0i
7+4i
-0.4
-0.5+0.0i
3+4i
-3.2
-2.0+0.0i
4i
Notes
Saturation
(real)
Uniform Encoder
Input
Quantized
Input
Output
0.4-1.2i
0.0-1.5i
4+i
0.4-6.0i
0.0-2.0i
Saturation
(imaginary)
-4.2+3.5i
-2.0+2.0i
7i
Saturation
(real and
imaginary)
Notes
The output data type is automatically set to uint8, the most efficient
format for this input range.
Dialog
Box
Peak
The largest input amplitude to be encoded, V. Real or imaginary
input values greater than (1-21-B)V or less than -V saturate
(independently for complex inputs) at those limits.
1-1747
Uniform Encoder
Bits
Specify the number of bits, B, needed to represent the integer
output. The number of levels at which the block quantizes the
floating-point input is 2B.
Output type
The data type of the blocks output, Unsigned integer or Signed
integer. Unsigned outputs are uint8, uint16, or uint32, while
signed outputs are int8, int16, or int32.
References
Supported
Data
Types
Port
Input
Output
See Also
1-1748
Simulink
Quantizer
Simulink
Uniform Decoder
udecode
uencode
Unwrap
Purpose
Library
Signal Operations
dspsigops
Description
Unwrap Method
The Unwrap block unwraps each channel of its input matrix or input
vector by adding 2k to each successive channel element, and updating
k at each phase jump. A phase jump occurs when the difference between
two adjacent phase value entries exceeds the value of the Tolerance
parameter.
The following code illustrates how the block unwraps the data in a
given input channel u.
k=0;
% initialize k to 0
i=1;
% initialize the counter to 1
alpha=pi;
% set alpha to the desired Tolerance. In this case, pi
for i = 1:(size(u)-1)
yout(i,:)=u(i)+(2*pi*k); % add 2*pi*k to ui
if((abs(u(i+1)-u(i)))>(abs(alpha))) %if diff is greater than alph
if u(i+1)<u(i)
k=k+1;
else
k=k-1;
1-1749
Unwrap
end
end
end
yout((i+1),:)=u(i+1)+(2*pi*k); % add 2*pi*k to the last element of the in
Frame-Based Processing
When you configure the block to perform frame-based processing, the
block supports two different unwrap modes. In both modes, the block
adds 2k to each input channels elements, and updates k at each phase
discontinuity. The difference between the two modes is how often
the block resets the initial phase value (k) to zero. You can choose to
unwrap data across frame boundaries (default), or to unwrap only
within input frames, by resetting the initial phase value each time a
new input frame is received.
Unwrapping Across Frame Boundaries
In the default mode, the block ignores boundaries between input frames,
and continues to unwrap the data in each channel without resetting
the initial phase value to zero. To specify this mode, clear the Do not
unwrap phase discontinuities between successive frames check
box. The following figure illustrates how the block unwraps data in
this mode.
1-1750
Unwrap
1-1751
Unwrap
Sample-Based Processing
When you configure the block to perform sample-based processing,
the block treats each element of the input as an individual channel.
The block unwraps the data in each channel of the input, and does
not reset the initial phase to zero each time a new input is received.
The following figure illustrates how the block unwraps data when
performing sample-based processing.
1-1752
Unwrap
1-1753
Unwrap
1-1754
Unwrap
Dialog
Box
Tolerance
The jump size that the block recognizes as a true phase
discontinuity. The default is set to (rather than a smaller value)
to avoid altering legitimate signal features. To increase the blocks
sensitivity, set the Tolerance to a value slightly less than .
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-1755
Unwrap
Supported
Data
Types
See Also
1-1756
unwrap
MATLAB
Upsample
Purpose
Library
Signal Operations
dspsigops
Description
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block upsamples each column of the
input over time. In this mode, the block can perform either single-rate
or multirate processing. You can use the Rate options parameter to
specify how the block upsamples the input:
When you set the Rate options parameter to Enforce single-rate
processing, the input and output of the block have the same sample
rate. In this mode, the block outputs a signal with a proportionally
larger frame size than the input. For upsampling by a factor of L, the
output frame size is L times larger than the input frame size (Mo =
Mi*L), but the input and output frame rates are equal.
For an example of single-rate upsampling, see Example: Single-Rate
Processing on page 1-1759.
When you set the Rate options parameter to Allow multirate
processing, the block treats an Mi-by-N matrix input as N
independent channels. The block upsamples each column of the input
1-1757
Upsample
over time by keeping the frame size constant (Mi=Mo), and making
the output frame period (Tfo) L times shorter than the input frame
period (Tfo = Tfi/L).
See Example: Multirate, Frame-Based Processing on page 1-1759 for
an example that uses the Upsample block in this mode.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats an M-by-N matrix input as
M*N independent channels, and upsamples each channel over time. In
this mode, the block always performs multirate processing. The output
sample rate is L times higher than the input sample rate (Tso = Tsi/L),
and the input and output sizes are identical.
Zero Latency
The Upsample block has zero-tasking latency for all single-rate
operations. The block is in a single-rate mode if you set the Upsample
factor parameter to 1 or if you set the Input processing parameter
to Columns as channels (frame based) and the Rate options
parameter to Enforce single-rate processing.
The Upsample block also has zero-tasking latency for multirate
operations if you run your model in Simulink single-tasking mode.
Zero-tasking latency means that the block propagates the first input
(received at t=0) immediately following the D consecutive zeros specified
by the Sample offset parameter. This output (D+1) is followed in turn
by the L-1 inserted zeros and the next input sample.
Nonzero Latency
The Upsample block has tasking latency for multirate, multitasking
operation:
In multirate, sample-based processing mode, the initial condition for
each channel appears as output sample D+1, and is followed by L-1
inserted zeros. The channels first input appears as output sample
D+L+1. The Initial conditions parameter can be an Mi-by-N matrix
1-1758
Upsample
Examples
1-1759
Upsample
Dialog
Box
1-1760
Upsample factor
The integer factor, L, by which to increase the input sample rate.
Upsample
Sample offset
The sample offset, D, which must be an integer in the range
[0,L-1].
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select this
option, the block treats each column of the input as a separate
channel. In this mode, the block can perform single-rate or
multirate processing.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel. In this mode, the block always performs
multirate processing.
Note The option Inherit from input (this choice will be
removed - see release notes) will be removed in a future
release. See Frame-Based Processing in the DSP System
Toolbox Release Notes for more information.
Rate options
Specify the method by which the block upsamples the input. You
can select one of the following options:
Enforce single-rate processing When you select this
option, the block maintains the input sample rate by increasing
the output frame size by a factor of L. To select this option,
you must set the Input processing parameter to Columns
as channels (frame based).
Allow multirate processing When you select this option,
the block resamples the signal such that the output sample rate
is L times faster than the input sample rate.
1-1761
Upsample
Initial conditions
The value with which the block is initialized for cases of nonzero
latency, a scalar or matrix. This value appears in the output as
sample D+1. This parameter appears only when you configure the
block to perform multirate processing.
Supported
Data
Types
Port
Input
Output
See Also
1-1762
Downsample
FIR Interpolation
Repeat
Purpose
Library
Signal Operations
dspsigops
Description
N
In Farrow interpolation mode, the block stores the Dmax+ 2 +1 most
recent samples received at the In port for each channel, where N is
the value you specify for the Farrow filter length (N) parameter.
The Variable Fractional Delay block assumes that the input values
at the Delay port are between Dmin and Dmax, where Dmin appears in
the Valid delay range section on the Main pane of the block mask,
and Dmax is the value of the Maximum delay (Dmax) in samples
parameter. The block clips delay values less than Dmin to Dmin and delay
values greater than Dmax to Dmax.
1-1763
You must consider additional factors when selecting valid Delay values
for the FIR and Farrow interpolation modes. For more information
about these considerations, refer to FIR Interpolation Mode on page
1766 or Farrow Interpolation Mode on page 1768, respectively.
The Variable Fractional Delay block is similar to the Variable Integer
Delay block, in that they both store a minimum of Dmax+1 past samples
in memory. The Variable Fractional Delay block differs only in the
way that these stored samples are accessed; a fractional delay requires
the computation of a value by interpolation from the nearby samples
in memory.
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the block treats each element of the N-D
input array, u, as an independent channel. The input to the Delay port,
v, must either be an N-D array of the same size and dimension as the
input u, or be a scalar value, such that Dmin v Dmax.
For example, consider an M-by-N input matrix. The block treats each
of the M*N matrix elements as independent channels. The input to
the Delay port can be an M-by-N matrix of floating-point values in the
range Dmin v Dmax that specifies the number of sample intervals
to delay each channel of the input, or it can be a scalar floating-point
value, Dmin v Dmax, by which to equally delay all channels.
In sample-based processing mode, the block treats an unoriented
vector input as an M-by-1 matrix. In this mode, the output is also an
unoriented vector.
The Initial conditions parameter specifies the values in the blocks
memory at the start of the simulation in the same manner as the
Variable Integer Delay block. See the Variable Integer Delay block
reference page for more information.
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the block treats each of the N input columns
as an independent channel containing Mi sequential time samples.
1-1764
Interpolation Modes
The delay value specified at the Delay port serves as an index into the
blocks memory, U, which stores, at a minimum, the Dmax+1 most recent
samples received at the In port for each channel. For example, an
integer delay of 5 on a scalar input sequence retrieves and outputs the
fifth most recent input sample from the blocks memory, U(6). The block
computes fractional delays by interpolating between stored samples;
the three available interpolation modes are Linear, FIR and Farrow.
Linear Interpolation Mode
1-1765
vi = floor(v)
% vi = integer delay
vf = v-vi
% vf = fractional delay
y = (1-vf)*U(vi+1) + vf*U(vi)
v+
i
,
L
v P 1, i = 0, 1, ..., L 1
1-1766
output computed for each sample corresponds to the output of the arm
with a delay value nearest to the desired input delay. Thus, only a
discrete set of delays is actually possible. The number of coefficients in
each of the L filter arms of the polyphase structure is 2P. In most cases,
using values of P between 4 and 6 will provide you with reasonably
accurate interpolation values.
In this mode, the Signal Processing Toolbox intfilt function computes
an FIR filter for interpolation.
For example, when you set the parameters on the block mask to the
following values:
Interpolation filter half-length (P): 4
Interpolation points per input sample: 10
Normalized input bandwidth: 1
The filter coefficients are given by:
b = intfilt(10,4,1);
1-1767
interpolate values.
To increase the minimum possible delay value, select the Disable
direct feedthrough by increasing minimum possible delay
by one check box. Checking this box prevents algebraic loops from
occurring when you use the block inside a feedback loop.
To specify the blocks behavior when the input delay value is too small
N
to center the kernel (less than 2 -1), set the For small input delay
values parameter:
If you select Clip to the minimum value necessary for
centered kernel, the block clips small input delay values to the
smallest value necessary to keep the kernel centered. This increases
Dmin but yields more accurate interpolation values.
To determine the minimum delay value, select Clip to the minimum
value necessary for centered kernel, and click Apply on the
block mask. All input delay values less than the value displayed
for Dmin will be clipped to Dmin.
If you select Use off-centered kernel, the block computes
fractional delays using a Farrow filter with an off-centered kernel.
This mode does not increase Dmin, but if there are input delay values
1-1768
N
less than 2 -1, the results are less accurate than the results achieved
by keeping the kernel centered.
Word Length
Fraction Length
vf data type
HoldInteger data
type
0 bits
32 bits
0 bits
Note When the block input is fixed point, all internal data types are
signed fixed point.
To compute the integer (vi) and fractional (vf) parts of the input delay
value (v), the Variable Fractional Delay block uses the following
equations:
1-1769
vi = floor (v)
Dmin < v < Dmax
vf = v - vi
vi = Dmin
v Dmin
vf = 0
vi = Dmax
v Dmax
vf = 0
Linear Interpolation Mode
The following diagram shows the fixed-point data types used by the
Linear interpolation mode of the Variable Fractional Delay block.
Input
data type
-vi
-1
Input
data type
Input
data type
SUBTRACTOR
Input
data type
MULTIPLIER
Product output
data type
vf
data type
vf
Cast
Accumulator
data type
Output
data type
Accumulator
data type
ADDER
Cast
Input
data type
Cast
vf
HoldInteger
data type
MULTIPLIER
Product output
data type
Round
Integer
data type
REMAINDER
Phase number
vf
data type
See the Fixed-Point Data Types on page 1-650 section of the FIR
Interpolation reference page for a diagram showing the fixed-point data
types used by the Variable Fractional Delay block in FIR interpolation
mode.
1-1770
The following diagram shows the fixed-point data types used by the
Farrow interpolation mode of the Variable Fractional Delay block where:
Farrow filter length (N) = 4
For small input delay values = Clip to the minimum value
necessary to for centered kernel
Digital Filter
(FIR direct form)
Out 4
Out 3
Out 2
Out 1
vf
data type
Accumulator
data type
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Cast
Cast
Cast
Cast
Cast
Cast
vf
Multiplicand
polyval
data type
Product output
polyval
data type
MULTIPLIER
Multiplicand
polyval
data type
Product output
polyval
data type
MULTIPLIER
Multiplicand
polyval
data type
Product output
polyval
data type
MULTIPLIER
Cast
Output
data type
1
Output
1-1771
The following diagram shows the fixed-point data types used by the
Farrow interpolation mode of the Variable Fractional Delay block where:
Farrow filter length (N) = 4
For small input delay values = Use off-centered kernel
Integer
data type
Input delay
data type
Diff
Cast
-
Input delay
data type
Digital Filter
(FIR direct form)
Out 4
Out 3
Out 2
Out 1
Accumulator
data type
Cast
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Accumulator
polyval
data type
+
+
Accumulator
polyval
data type
Cast
Cast
Cast
Cast
Cast
Multiplicand
polyval
data type
Product output
polyval
data type
Input delay
data type
Cast
vf
data type
vf
MULTIPLIER
Multiplicand
polyval
data type
Product output
polyval
data type
MULTIPLIER
Multiplicand
polyval
data type
Product output
polyval
data type
MULTIPLIER
Cast
Output
data type
1
Output
Diff is computed from the integer part of the delay value (vi) and the
1-1772
N 1
Diff = vi
2
Diff 0 Diff = 0
Diff < 0 Diff = Diff
The following diagram shows the fixed-point data types used by the
Digital Filter blocks FIR direct form filter.
1
Input
Input
data type
z-1
b0
Cast
Accumulator
data type
Accumulator
data type
+
+
Cast
Output
data type
Numerator
coefficient
data type
b1
z-1
Product output
data type
Product output
data type
Cast
1
Output
Accumulator
data type
Numerator
coefficient
data type
bN
Product output
data type
Cast
Accumulator
data type
Numerator
coefficient
data type
Examples
1-1773
Flanging subsystem opens, and you can see the parameters of the
Variable Fractional Delay block.
Dialog
Box
1-1774
The Main pane of the Variable Fractional Delay block dialog appears
as follows.
1-1775
Interpolation mode
The method by which to interpolate between adjacent stored
samples to obtain a value for the sample indexed by the input
at the Delay port.
Interpolation filter half-length (P)
Half the number of input samples to use in the FIR interpolation
filter. This parameter is only visible when the Interpolation
mode is set to FIR.
Farrow filter length (N)
The number of input samples to use in the Farrow interpolation
filter. This parameter is only visible when the Interpolation
mode is set to Farrow.
Interpolation points per input sample
The number of points per input sample, L, at which a unique FIR
interpolation filter is computed. This parameter is only visible
when the Interpolation mode is set to FIR.
Normalized input bandwidth (0 to 1)
The bandwidth to which the interpolated output samples should
be constrained. The value must be a real scalar between 0 and 1.
A value of 1 specifies half the sample frequency. This parameter
is only visible when the Interpolation mode is set to FIR.
Maximum delay (Dmax) in samples
The maximum delay that the block can produce, Dmax. Input delay
values exceeding this maximum are clipped to Dmax.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
1-1776
1-1777
1-1778
1-1779
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
Coefficients
Choose how you specify the word length and fraction length of the
filter coefficients.
When you select Same word length as input, the word
length of the filter coefficients match that of the input to the
block. In this mode, the fraction length of the coefficients is
automatically set to the binary-point only scaling that provides
you with the best precision possible given the value and word
length of the coefficients.
When you select Specify word length, you can enter the word
length of the coefficients, in bits. In this mode, the fraction
length of the coefficients is automatically set to the binary-point
only scaling that provides you with the best precision possible
given the value and word length of the coefficients.
Product output
Use this parameter to specify how you would like to designate
the product output word and fraction lengths. See Fixed-Point
Data Types on page 1-1769 and Multiplication Data Types for
illustrations depicting the use of the product output data type
in this block.
When you select Same as first input, these characteristics
match those of the first input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the product output, in
bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output. This
block requires power-of-two slope and a bias of zero.
1-1780
Accumulator
Use this parameter to specify how you would like to designate
the accumulator word and fraction lengths. See Fixed-Point
Data Types on page 1-1769 and Multiplication Data Types for
illustrations depicting the use of the accumulator data type in
this block:
When you select Same as product output, these
characteristics match those of the product output.
When you select Same as first input, these characteristics
match those of the first input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the accumulator. This
block requires power-of-two slope and a bias of zero.
Product output polyval
Choose how you specify the word length and fraction length of the
product output polyval data type. This parameter is only visible
when the Interpolation mode is set to Farrow.
When you select Same as first input, these characteristics
match those of the first input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the product output
polyval in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output polyval.
This block requires power-of-two slope and a bias of zero.
Accumulator polyval
Choose how you specify the word length and fraction length of the
accumulator polyval data type. This parameter is only visible
when the Interpolation mode is set to Farrow.
1-1781
1-1782
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the output. This block
requires power-of-two slope and a bias of zero.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Delay
Output
1-1783
See Also
1-1784
Delay
Unit Delay
Simulink
Purpose
Library
Signal Operations
dspsigops
Description
The Variable Integer Delay block delays the discrete-time input at the
In port by the integer number of sample intervals specified by the
input to the Delay port. The sample rate of the input signal at the
Delay port must be the same as the sample rate of the input signal at
the In port. When these sample rates are not the same, you need to
insert a Zero-Order Hold or Rate Transition block in order to make the
sample rates identical. When you set the Input processing parameter
to Elements as channels (sample based), the delay for an N-D
input can be a scalar value to uniformly delay every sample in every
channel, or a matrix containing one delay value for each channel of the
input. When you set the Input processing parameter to Columns as
channels (frame based), the delay can be a scalar value to uniformly
delay every sample in every channel, a vector containing one delay
value for each sample in the input frame, or a vector containing one
delay value for each channel in the input frame.
The delay values should be in the range of 0 to D, where D is the
Maximum delay. Delay values greater than D or less than 0 are
clipped to those respective values and noninteger delays are rounded to
the nearest integer value.
The Variable Integer Delay block differs from the Delay block in the
following ways.
1-1785
Delay Block
Sample-Based Processing
When you set the Input processing parameter to Elements as
channels (sample based), the Variable Integer Delay block supports
N-D input arrays. When the input is an M-by-N-by-P array, the block
treats each of the M*N*P elements as independent channels, and
applies the delay at the Delay port to each channel.
The Variable Integer Delay block stores the D+1 most recent samples
received at the In port for each channel. At each sample time the block
outputs the stored sample(s) indexed by the input to the Delay port.
1-1786
For example, when the input to the In port, u, is a scalar signal, the
block stores a vector, U, of the D+1 most recent signal samples. When
the current input sample is U(1), the previous input sample is U(2),
and so on, then the blocks output is
y = U(v+1);
where v is the input to the Delay port. A delay value of 0 (v=0) causes
the block to pass through the sample at the In port in the same
simulation step that it is received. The blocks memory is initialized to
the Initial conditions value at the start of the simulation (see below).
The next figure shows the block output for a scalar ramp sequence at
the In port, a Maximum delay of 5, an Initial conditions of 0, and a
variety of different delays at the Delay port.
1-1787
1-1788
1 1 1
U(2) =
, U(3) =
1 1 1
2 2 2
2 2 2 , U(4) =
3 3 3
3 3 3 , U(5) =
4 4 4
4 4 4
Frame-Based Processing
When you set the Input processing parameter to Columns as
channels (frame based), the input can be an M-by-N matrix. The
block treats each of the N input columns as independent channels
containing M sequential time samples.
1-1789
In this mode, the input at the Delay port can be a scalar value to
uniformly delay every sample in every channel. It can also be a
length-M column vector containing one delay value for each sample
in the input frame(s). The set of delays contained in the vector is
applied identically to every channel of a multichannel input. The Delay
port entry can also be a length-N row vector, containing one delay for
each channel. Finally, the Delay port entry can be an M-by-N matrix,
containing a different delay for each corresponding element of the input.
Vector v does not specify when the samples in the current input frame
will appear in the output. Rather, v indicates which previous input
samples (stored in memory) should be included in the current output
frame. The first sample in the current output frame is the input sample
v(1) intervals earlier in the sequence, the second sample in the current
output frame is the input sample v(2) intervals earlier in the sequence,
and so on.
The illustration below shows how this works for an input with a sample
period of 1 and frame size of 4. The Maximum delay (Dmax) is 5,
and the Initial conditions parameter is set to -1. The delay input
changes from [1 3 0 5] to [2 0 0 2] after the second input frame.
The samples in each output frame are the values in memory indexed
by the elements of v:
y(1)
y(2)
y(3)
y(4)
1-1790
=
=
=
=
U(v(1)+1)
U(v(2)+1)
U(v(3)+1)
U(v(4)+1)
1-1791
1
2
1
2
,
3
5 5 4
1 1 5
,
2 2 6
3 3 7
4
5
,
6
1-1792
1
2
11
22
,
33
44
5 55
1
1
,
2
2
3
3
4
5
4
5
,
6
Examples
See Basic Algorithmic Delay in the DSP System Toolbox Users Guide.
1-1793
Dialog
Box
Maximum delay
The maximum delay that the block can produce for any sample.
Delay input values exceeding this maximum are clipped at the
maximum.
Initial conditions
The values with which the blocks memory is initialized.
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
1-1794
Supported
Data
Types
Port
In
1-1795
Port
Delay
Out
See Also
1-1796
Delay
Variable Selector
Purpose
Library
Description
where idx is the length-L indexing vector. The row selection output size
is L-by-N and the column selection output size is M-by-L. Input rows or
columns can appear any number of times in the output, or not at all.
1-1797
Variable Selector
1-1798
Variable Selector
Dialog
1-1799
Variable Selector
Box
Number of input signals
Specify the number of input signals. An input port is created on
the block for each input signal.
Select
Specify the dimension of the input to select, Rows or Columns.
Selector mode
Specify the type of indexing operation to perform, Variable or
Fixed. Variable indexing uses the input at the Idx port to select
rows or columns from the input at the In port. Fixed indexing
uses the Elements parameter value to select rows from the input
at the In port, and disables the Idx port.
Elements
Specify a vector containing the indices of the input rows or
columns that will appear in the output matrix. This parameter
appears only when you set the Selector mode to Fixed.
Index mode
When set to One-based, an index value of 1 refers to the first row
or column of the input. When set to Zero-based, an index value of
0 refers to the first row or column of the input.
Invalid index
Specify how the block handles an invalid index value. You can
select one of the following options:
Clip index Clip the index to the nearest valid value, and do
not issue an alert.
For example, if the block receives a 64-by-4 input and the
Select parameter is set to Rows, the block clips an index of 72
to 64. For the same input, if the Select parameter is set to
Columns, the block clips an index of 72 to 4. In both cases, the
block clips an index of -2 to 1.
Clip and warn Clip the index to the nearest valid value and
display a warning message at the MATLAB command line.
1-1800
Variable Selector
Supported
Data
Types
Port
In
Idx
1-1801
Variable Selector
Port
Out
See Also
1-1802
Multiport Selector
Permute Matrix
Selector
Simulink
Submatrix
Variance
Purpose
Library
Statistics
dspstat3
Description
Basic Operation
When you do not select the Running variance check box, the block
computes the variance of each row or column of the input, along vectors
of a specified dimension of the input, or of the entire input at each
individual sample time, and outputs the array y. Each element in y is
the variance of the corresponding column, row, vector, or entire input.
The output y depends on the setting of the Find the variance value
over parameter. For example, consider a 3-dimensional input signal
of size M-by-N-by-P:
Entire input The output at each sample time is a scalar that
contains the variance of the entire input.
y = var(u(:))
1-1803
Variance
vector over the first dimension of the input. For an input that is an
M-by-N matrix, the output at each sample time is a 1-by-N row vector.
y = var(u,0,1)
M N
y = 2 =
1-1804
uij
i=1 j =1
uij
i=1 j =1
M*N
M * N 1
Variance
2 = Re2 + Im 2
Running Operation
When you select the Running variance check box, the block tracks the
variance of successive inputs to the block. In this mode, you must also
specify a value for the Input processing parameter:
When you select Elements as channels (sample based), the block
outputs an M-by-N array. Each element yij of the output contains the
variance of the element uij over all inputs since the last reset.
When you select Columns as channels (frame based), the block
outputs an M-by-N matrix. Each element yij of the output contains
the variance of the jth column over all inputs since the last reset, up
to and including element uij of the current input.
Running Operation for Variable-Size Inputs
When your inputs are of variable size, and you select the Running
variance check box, there are two options:
If you set the Input processing parameter to Elements as
channels (sample based), the state is reset.
If you set the Input processing parameter to Columns as channels
(frame based), then there are two cases:
1-1805
Variance
Rising edge
Rising edge
Rising edge
Rising edge
Falling edge Triggers a reset operation when the Rst input does
one of the following:
1-1806
Variance
Falling edge
Falling edge
Falling edge
Falling edge
ROI Processing
To calculate the statistical value within a particular region of interest
(ROI) of the input, select the Enable ROI processing check box. This
option is only available when the Find the variance value over
parameter is set to Entire input and the Running variance check
box is not selected. ROI processing is only supported for 2-D inputs.
1-1807
Variance
1-1808
Variance
If, for the ROI type parameter, you select Rectangles or Lines, the
Output flag indicating if ROI is within image bounds check box
appears in the dialog box. If you select this check box, the Flag port
appears on the block. The following tables describe the Flag port output
based on the block parameters.
Output = Individual Statistics for Each ROI
Flag
Port
Output
Description
Description
If the ROI is partially outside the image, the block only computes the
statistical values for the portion of the ROI that is within the image.
If, for the ROI type parameter, you select Label matrix, the Output
flag indicating if input label numbers are valid check box appears
in the dialog box. If you select this check box, the Flag port appears on
the block. The following tables describe the Flag port output based
on the block parameters.
1-1809
Variance
Description
Description
1-1810
Variance
uij
uij
Input
data type
Accumulator or
Input-squared
product
data type
uij
uij
uij
Input
data type
MAGNITUDE
SQUARED
ADDER
Accumulator
data type MAGNITUDE
SQUARED
uij
ADDER
Accumulator
data type
Accumulator or
Input-sum-squared
product
data type
DIVIDER
Accumulator
data type
M*N
uij
SUBTRACTOR
uij
M*N
Accumulator
data type
yi
DIVIDER
Output
data type
Accumulator
data type
uij
M*N
M * N 1
Examples
1-1811
Variance
1-1812
Variance
Dialog
Box
Running variance
Enables running operation when selected.
1-1813
Variance
Input processing
Specify how the block should process the input when computing
the running variance. You can set this parameter to one of the
following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
This parameter appears only when you select the Running
variance check box.
Note The option Inherit from input (this choice will be
removed - see release notes) will be removed in a future
release. See Frame-Based Processing in the DSP System
Toolbox Release Notes for more information.
Reset port
Specify the reset event that causes the block to reset the running
variance. The sample time of the input to the Rst port must
be a positive integer multiple of the input sample time. This
parameter appears only when you select the Running variance
check box. For more information, see Resetting the Running
Variance on page 1-1806
Find the variance value over
Specify whether to find the variance along rows, columns, entire
input, or the dimension specified in the Dimension parameter.
For more information, see Basic Operation on page 1-1803.
1-1814
Variance
1-1815
Variance
1-1816
Variance
Rounding mode
Select the rounding mode for fixed-point operations.
Overflow mode
Select the overflow mode for fixed-point operations.
1-1817
Variance
1-1818
Variance
1-1819
Variance
Supported
Data
Types
Port
Input
Reset
ROI
Label
Label
8-, 16-, and 32-bit unsigned integers
Numbers
1-1820
Variance
Port
Output
Flag
See Also
Boolean
Mean
RMS
Standard Deviation
var
MATLAB
1-1821
Purpose
Library
Quantizers
dspquant2
Description
The Vector Quantizer Decoder block associates each input index value
with a codeword, a column vector of quantized output values defined
in the Codebook values parameter. When you input multiple index
values into this block, the block outputs a matrix of quantized output
vectors. This matrix is created by horizontally concatenating the
codeword vectors that correspond to each index value.
You can select how you want to enter the codebook values using the
Source of codebook parameter. When you select Specify via
dialog, you can type the codebook values into the block parameters
dialog box. Select Input port and port C appears on the block. The
block uses the input to port C as the Codebook values parameter.
The Codebook values parameter is a k-by-N matrix of values, where
k 1 and N 1. Each column of this matrix is a codeword vector, and
each codeword vector corresponds to an index value. The index values
are zero based; therefore, the first codeword vector corresponds to an
index value of 0, the second codeword vector corresponds to an index
value of 1, and so on.
The input to this block is a vector of index values, where 0 index < N
and N is the number of columns of the codebook matrix. Use the Action
for out of range index value parameter to determine how the block
behaves when an input index value is out of this range. When you want
any index values less than 0 to be set to 0 and any index values greater
than or equal to N to be set to N-1, select Clip. When you want to be
warned when any index values less than 0 are set to 0 and any index
values greater than or equal to N are set to N-1, select Clip and warn.
When you want the simulation to stop and display an error when the
index values are out of range, select Error.
1-1822
1-1823
Dialog
Box
The Main pane of the Vector Quantizer Decoder block dialog appears
as follows.
1-1824
Codebook values
Enter a k-by-N matrix of quantized output values, where 1 k
and 1 N . Each column of your matrix corresponds to an index
value. This parameter is visible if, from the Source of codebook
list, you select Specify via dialog.
The Data Types pane of the Vector Quantizer Decoder block dialog
appears as follows.
Same
1-1825
References
Supported
Data
Types
Port
Q(U)
1-1826
See Also
Quantizer
Simulink
Scalar Quantizer
Decoder
Scalar Quantizer
Design
Uniform Encoder
Uniform Decoder
Vector Quantizer
Encoder
1-1827
Purpose
Library
Quantizers
dspquant2
Description
1-1828
the distortion. You can specify one of the two possible methods for
calculating distortion using the Distortion measure parameter.
When you select Squared error for the Distortion measure
parameter, the block finds the nearest codeword by calculating
the squared error (unweighted). Consider the codebook
D=
( a ji u jp )
j =1
D=
w jp ( a ji u jp )
j =1
Once the block has associated all the training vectors with their nearest
codeword vectors, the block calculates the mean squared error for the
1-1829
codebook and checks to see if the stopping criteria for the process has
been satisfied.
The two possible options for the Stopping criteria parameter are
Relative threshold and Maximum iteration. When you want the
design process to stop when the fractional drop in the squared error
is below a certain value, select Relative threshold. Then, type the
maximum acceptable fractional drop in the Relative threshold field.
The fraction drop in the squared error is defined as
1-1830
1
10
11
TS1 = , TS3 = , and TS7 = .
12
12
2
CWnew
The new codeword vector is calculated as
1 + 10 + 11
3
=
2 + 12 + 12
0 .1
you choose Centroid and you specify the weighting factors W1 = ,
0 .2
1
0 .3
W3 = , and W7 = , the new codeword vector is calculated as
0
.
6
0 .4
CWnew
0 .1 + 1 + 0 .3
=
( 0.2 )( 2 ) + ( 0.6 )(12 ) + ( 0.4 )(12 )
0 .2 + 0 .6 + 0 .4
Click Design and Plot to design the quantizer with the parameter
values specified on the left side of the GUI. The performance curve and
the entropy of the quantizer are updated and displayed in the figures on
the right side of the GUI.
1-1831
Note You must click Design and Plot to apply any changes you make
to the parameter values in the VQDTool dialog box.
The following is an example of how the block calculates the entropy of
the quantizer at each iteration. Suppose you have a codebook with four
codewords and a training set with 200 training vectors. Also suppose
that, at the i-th iteration, 40 training vectors are associated with the
first codeword, 60 training vectors are associated with the second
codeword, 20 training vectors are associated with the third codeword,
and 80 training vectors are associated with the fourth codeword. The
probability that a training vector is associated with the first codeword
40
. The probabilities that training vectors are associated with
200
60
20
80
the second, third, and fourth codewords are 200 , 200 , and 200 ,
respectively. The GUI uses these probabilities to calculate the entropy
according to the equation
is
H = pi log 2 pi
i=1
40
60
60
20
20
80
80
40
H =
log 2
+
log 2
+
log 2
+
log 2
200 200
200 200
200 200
200
200
H = 1.8464
VQDTool can export parameter values that correspond to the figures
displayed in the GUI. Click the Export Outputs button, or press
Ctrl+E, to export the Final Codebook, Mean Square Error, and
Entropy values to the workspace, a text file, or a MAT-file.
1-1832
In the Model section of the GUI, specify the destination of the block
that will contain the parameters of your quantizer. For Destination,
select Current model to create a block with your parameters in the
model you most recently selected. Type gcs in the MATLAB Command
Window to display the name of your current model. Select New model to
create a block in a new model file.
From the Block type list, select Encoder to design a Vector Quantizer
Encoder block. Select Decoder to design a Vector Quantizer Decoder
block. Select Both to design a Vector Quantizer Encoder block and a
Vector Quantizer Decoder block.
In the Encoder block name field, enter a name for the Vector
Quantizer Encoder block. In the Decoder block name field, enter a
name for the Vector Quantizer Decoder block. When you have a Vector
Quantizer Encoder and/or Decoder block in your destination model
with the same name, select the Overwrite target block check box to
replace the blocks parameters with the current parameters. When you
do not select this check box, a new Vector Quantizer Encoder and/or
Decoder block is created in your destination model.
Click Generate Model. VQDTool uses the parameters that correspond
to the current plots to set the parameters of the Vector Quantizer
Encoder and/or Decoder blocks.
1-1833
Dialog
Box
1-1834
Training Set
Enter the samples of the signal you would like to quantize. This
data set can be a MATLAB function or a variable defined in the
MATLAB workspace. The typical length of this data vector is 1e5.
Source of initial codebook
Select Auto-generate to have the block choose the initial
codebook values. Choose User defined to enter your own initial
codebook values.
Number of levels
Enter the number of codeword vectors, N, in your codebook
matrix, where N 2.
Initial codebook
Enter your initial codebook values. From the Source of initial
codebook list, select User defined in order to activate this
parameter. The codebook must have the same number of rows as
the training set. You must provide at least two codeword vectors.
Distortion measure
When you select Squared error, the block finds the nearest
codeword by calculating the squared error (unweighted). When
you select Weighted squared error, the block finds the nearest
codeword by calculating the weighted squared error.
Weighting factor
Enter a vector or matrix. The block uses these values to compute
the weighted squared error. When the weighting factor is a vector,
its length must be equal to the number of rows in the training
set. This weighting factor is used for each training vector. When
the weighting factor is a matrix, it must be the same size as the
training set matrix. The individual weighting factors cannot be
negative. The weighting factor vector or matrix cannot contain
all zeros.
Stopping criteria
Choose Relative threshold to enter the maximum acceptable
fractional drop in the squared quantization error. Choose Maximum
iteration to specify the number of iterations at which to stop.
1-1835
Choose Whichever comes first and the block stops the iteration
process as soon as the relative threshold or maximum iteration
value is attained.
Relative threshold
This parameter is available when you choose Relative
threshold or Whichever comes first for the Stopping
criteria parameter. Enter the value that is the maximum
acceptable fractional drop in the squared quantization error.
Maximum iteration
This parameter is available when you choose Maximum iteration
or Whichever comes first for the Stopping criteria
parameter. Enter the maximum number of iterations you want
the block to perform.
Tie-breaking rules
When a training vector has the same distortion for two different
codeword vectors, select Lower indexed codeword to associate
the training vector with the lower indexed codeword. Select
Higher indexed codeword to associate the training vector with
the lower indexed codeword.
Codebook update method
When you choose Mean, the new codeword vector is calculated
by taking the average of all the training vector values that were
associated with the original codeword vector. When you choose
Centroid, the block calculates the new codeword vector by taking
the weighted average of all the training vector values that were
associated with the original codeword vector Note that if, for the
Distortion measure parameter, you choose Squared error, the
Codebook update method parameter is set to Mean.
Destination
Choose Current model to create a Vector Quantizer block in
the model you most recently selected. Type gcs in the MATLAB
Command Window to display the name of your current model.
Choose New model to create a block in a new model file.
1-1836
Block type
Select Encoder to design a Vector Quantizer Encoder block.
Select Decoder to design a Vector Quantizer Decoder block. Select
Both to design a Vector Quantizer Encoder block and a Vector
Quantizer Decoder block.
Encoder block name
Enter a name for the Vector Quantizer Encoder block.
Decoder block name
Enter a name for the Vector Quantizer Decoder block.
Overwrite target block
When you do not select this check box and a Vector Quantizer
Encoder and/or Decoder block with the same block name exists
in the destination model, a new Vector Quantizer Encoder and/or
Decoder block is created in the destination model. When you
select this check box and a Vector Quantizer Encoder and/or
Decoder block with the same block name exists in the destination
model, the parameters of these blocks are overwritten by new
parameters.
Generate Model
Click this button and VQDTool uses the parameters that
correspond to the current plots to set the parameters of the Vector
Quantizer Encoder and/or Decoder blocks.
Design and Plot
Click this button to design a quantizer using the parameters on
the left side of the GUI and to update the performance curve and
entropy plots on the right side of the GUI.
You must click Design and Plot to apply any changes you make
to the parameter values in the VQDTool GUI.
Export Outputs
Click this button, or press Ctrl+E, to export the Final Codebook,
Mean Squared Error, and Entropy values to the workspace, a
text file, or a MAT-file.
1-1837
References
Supported
Data
Types
See Also
1-1838
Quantizer
Simulink
Uniform Encoder
Uniform Decoder
Purpose
Library
Quantizers
dspquant2
Description
The Vector Quantizer Encoder block compares each input column vector
to the codeword vectors in the codebook matrix. Each column of this
codebook matrix is a codeword. The block finds the codeword vector
nearest to the input column vector and returns its zero-based index.
This block supports real floating-point and fixed-point signals on all
input ports.
The block finds the nearest codeword by calculating the distortion. The
block uses two methods for calculating distortion: Euclidean squared
error (unweighted) and weighted Euclidean squared error. Consider
the codebook, CB = [CW1 CW2 ... CWN ] . This codebook has N
codewords; each codeword has k elements. The i-th codeword is defined
as a column vector, CWi = [ a1i
D=
( a ji u jp )
j =1
D=
w j ( a ji u jp )
j =1
1-1839
1-1840
D=
w j ( a ji u jp )
j =1
1-1841
You can set the product output, accumulator, and index output data
types in the block dialog as discussed below.
1-1842
Dialog
Box
The Main pane of the Vector Quantizer Encoder block dialog appears
as follows.
1-1843
Source of codebook
Choose Specify via dialog to type the codebook values into the
block parameters dialog box. Select Input port to specify the
codebook values using the blocks input port, C.
Codebook
Enter a k-by-N matrix of values, where 1 k and 1 N, to which
your input column vector or matrix is compared. This parameter
is visible if, from the Source of codebook list, you select
Specify via dialog.
Distortion measure
Select Squared error when you want the block to calculate the
distortion by evaluating the Euclidean distance between the
input column vector and each codeword in the codebook. Select
Weighted squared error when you want the block to calculate
the distortion by evaluating a weighted Euclidean distance using
a weighting factor to emphasize or deemphasize certain input
values.
Source of weighting factor
Select Specify via dialog to enter a value for the weighting
factor in the dialog box. Choose Input port and specify the
weighting factor using port W on the block. This parameter is
visible if, for the Distortion measure parameter, you select
Weighted squared error.
Weighting factor
Enter a vector of values. This vector must have length equal to
the number of rows of the input, U. This parameter is visible
if, for the Source of weighting factor parameter, you select
Specify via dialog.
Tie-breaking rule
Set this parameter to determine the behavior of the block when an
input column vector is equidistant from two codewords. When you
want the input column vector to be represented by the lower index
valued codeword, select Choose the lower index. To represent
1-1844
1-1845
Rounding mode
Select the rounding mode for fixed-point operations.
1-1846
Overflow mode
Select the overflow mode to be used when block inputs are fixed
point.
Product output
1-1847
References
Supported
Data
Types
Port
1-1848
Port
Q(U)
See Also
Quantizer
Simulink
Scalar Quantizer
Decoder
Scalar Quantizer
Design
Uniform Encoder
Uniform Decoder
Vector Quantizer
Decoder
1-1849
Vector Scope
Purpose
Library
Sinks
dspsnks4
Description
1-1850
Vector Scope
If you select Frequency for the Input domain parameter, for M-by-N
inputs containing frequency-domain data, the block treats each of
the N input frames (columns) as a vector of spectral magnitude data
corresponding to M consecutive ascending frequency indices. That is,
when the input is a single column vector, u, each value in the input
frame, u(i), is assumed to correspond to a unique frequency value,
f(i), where f(i+1)>f(i).
If you select User-defined for the Input domain parameter, the
block does not assume that the input frame data is time-domain or
frequency-domain data. You can plot the data in the appropriate
manner. Also, the Horizontal display span (number of frames)
parameter appears on the pane. Enter a scalar value greater than or
equal to one that corresponds to the number of frames to be displayed
across the width of the scope window.
1-1851
Vector Scope
The Show grid parameter toggles the background grid on and off.
If you select the Persistence check box, the window maintains
successive displays. That is, the scope does not erase the display after
each frame (or collection of frames), but overlays successive input
frames in the scope display.
If you select the Frame number check box, the block displays the
number of the current frame in the input sequence on the scope window,
and the block increments the count as each new input is received.
Counting starts at 1 with the first input frame, and continues until
the simulation stops.
If you select the Channel legend check box, a legend indicating the
line color, style, and marker of each channels data is added. When
the input signal is labeled, that label appears in the channel legend.
When the input signal is not labeled, but comes from a Concatenate
block or a Mux block with labeled inputs, those labels appear in the
channel legend. Otherwise, each channel in the legend is labeled with
the channel number (CH 1, CH 2, etc.). Click and drag the legend to
reposition it in the scope window; double-click on the line label to edit
the text. If you rerun the simulation, the labels revert to the defaults.
If you select the Compact display check box, the scope completely fills
the figure window. The scope does not display menus and axis titles,
but it does show the numerical axis labels within the axes. If you clear
the Compact display check box, the scope displays the axis labels and
titles in a gray border surrounding the scope axes, and the windows
menus and toolbar become visible.
If you select the Open scope at start of simulation check box, the
scope opens at the start of the simulation. If you clear this parameter,
the scope does not open automatically during the simulation. You can
use this feature when you have several scope blocks in a model, and you
do not want to view all the associated scopes during the simulation.
1-1852
Vector Scope
specifying the position of the scope window on the screen, where (0,0) is
the lower-left corner of the display. See the MATLAB figure function
for more information.
1-1853
Vector Scope
1-1854
Vector Scope
1-1855
Vector Scope
1-1856
Vector Scope
The input sample period (1/64 in the above example) is equal to the
period with which the physical signal was originally sampled.
In cases where not all of these conditions hold, use the X display offset
(samples) and Increment per sample in input parameters.
The X-axis title is the text displayed below the x-axis.
When X display limits is set to Auto, the block scales the horizontal
axis of user-defined domain signals automatically. To do this, the Vector
Scope block needs to know the spacing of the input data. Specify this
spacing using the Increment per sample in input parameter, Is. This
parameter represents the numerical interval between adjacent x-axis
points corresponding to the input data. The range of the horizontal axis
is [0, M I s S ] , where M is the number of samples in each consecutive
input frame, and S is the Horizontal display span (number of
frames) parameter that you specify in the Scope Properties pane.
When X display limits is set to User-defined, the Minimum X-limit
(samples) and Maximum X-limit (samples) parameters set the range
of the horizontal axis.
Minimum Y-limit and Maximum Y-limit parameters set the range of
the vertical axis. Setting these parameters is analogous to setting the
ymin and ymax values of the MATLAB axis function.
The Y-axis label is the text displayed to the left of the y-axis.
1-1857
Vector Scope
Note that the first (leftmost) list item corresponds to the first signal
channel (leftmost column of the input matrix).
The Line styles parameter specifies the line style with which each
channels data is displayed on the scope. The syntax specifies the
channel line styles in list form, with each list entry specifying a style
for the corresponding channels data. The list entries are separated by
the pipe symbol, |.
For example, a five-channel signal would ordinarily generate all five
plots with a solid line style. To plot each line with a different style, enter
These settings plot the signal channels with the following styles.
1-1858
Line Style
Command to
Type in Line Style
Parameter
Solid
Dashed
--
Dotted
Dash-dot
-.
No line
none
Appearance
No line appears
Vector Scope
Note that the first (leftmost) list item, '-', corresponds to the first
signal channel (leftmost column of the input matrix). See the LineStyle
property of the MATLAB line function for more information about
the style syntax.
The Line markers parameter specifies the marker style with which
each channels samples are represented on the scope. The syntax
specifies the channels marker styles in list form, with each list entry
specifying a marker for the corresponding channels data. The list
entries are separated by the pipe symbol, |.
For example, a five-channel signal would ordinarily generate all five
plots with no marker symbol (that is, the individual sample points are
not marked on the scope). To instead plot each line with a different
marker style, you could enter
These settings plot the signal channels with the following styles.
Marker Style
Command
to Type in
Marker Style
Parameter
Asterisk
Point
Cross
Appearance
1-1859
Vector Scope
Marker Style
Command
to Type in
Marker Style
Parameter
Square
Diamond
Appearance
Note that the leftmost list item, '*', corresponds to the first signal
channel or leftmost column of the input matrix. See the LineSpec
property of the MATLAB line function for more information about the
available markers.
To produce a stem plot for the data in a particular channel, type the
word stem instead of one of the basic marker shapes.
The Line colors parameter specifies the color in which each channels
data is displayed on the scope. The syntax specifies the channel colors in
list form, with each list entry specifying a color (in one of the MATLAB
ColorSpec formats) for the corresponding channels data. The list
entries are separated by the pipe symbol, |.
For example, a five-channel signal would ordinarily generate all five
plots in the color black. To instead plot the lines with the color order
below, enter
or
These settings plot the signal channels in the following colors (8-bit
RGB equivalents shown in the center column).
1-1860
Vector Scope
Color
RGB Equivalent
Black
(0,0,0)
Blue
(0,0,255)
Red
(255,0,0)
Green
(0,255,0)
Dark
purple
(192,0,192)
Appearance
Note that the leftmost list item, 'k', corresponds to the first signal
channel or leftmost column of the input matrix. See the MATLAB
function ColorSpec for more information about the color syntax.
1-1861
Vector Scope
button (
) on the scope window. You can then zoom in on the
x-axis with a single click inside the scope window or by clicking and
dragging the cursor along the x-axis over your area of interest.
To zoom in on the y-axis of the scope window, you must first select
View > Zoom Y or click the corresponding Zoom Y-Axis toolbar
button (
). You can then zoom in on the y-axis with a single click
inside the scope window or by clicking and dragging the cursor along
the y-axis over your area of interest.
To return to the original view of the scope window, you have the
following options:
) on the
1-1862
Vector Scope
1-1863
Vector Scope
Note When you select Compact Display from the Axes menu, the
scope window menus are no longer visible. Right-click in the Vector
Scope window and click Compact Display in order to make the menus
reappear.
Dialog
Box
Input domain
Select the domain of the input. Your choices are Time, Frequency,
or User-defined. Tunable.
1-1864
Vector Scope
Show grid
Toggle the scope grid on and off.Tunable.
Persistence
Select this check box to maintain successive displays. That is, the
scope does not erase the display after each frame (or collection
1-1865
Vector Scope
1-1866
Vector Scope
1-1867
Vector Scope
1-1868
Vector Scope
Frequency units
Choose the frequency units for the x-axis, Hertz or rad/sec.
Tunable.
1-1869
Vector Scope
Frequency range
Specify the frequency range over which to plot the data. Tunable.
Inherit sample time from input
If you select this check box, the block computes the time-domain
sample period from the frame period and frame size of the
frequency-domain input. Use this parameter only when the
length of the each frame of frequency-domain data is the same as
the length of the frame of time-domain data from which it was
generated. Tunable.
Sample time of original time series
Enter the sample period, Ts, of the original time-domain signal.
This parameter is only visible when the Inherit sample time
from input check box is not selected. Tunable.
Increment per sample in input
Enter the numerical interval between adjacent x-axis points
corresponding to the user-defined input data. This parameter is
only visible when the Inherit sample increment from input
check box is not selected. Tunable.
Frequency display limits
Select Auto to have the limits of the x-axis set for you
automatically, or User-defined to set the limits yourself in the
Minimum frequency and Maximum frequency parameters.
Minimum frequency
Specify the minimum frequency value of the x-axis in Hertz or
rad/sec. This parameter is only visible if the Frequency display
limits parameter is set to User-defined. Tunable.
Maximum frequency
Specify the maximum frequency value of the x-axis in Hertz or
rad/sec. This parameter is only visible if the Frequency display
limits parameter is set to User-defined. Tunable.
Y-axis scaling
Choose either dB (decibel) or Magnitude scaling for the y-axis.
Tunable.
1-1870
Vector Scope
Minimum Y-limit
Specify the minimum value of the y-axis. Setting this parameter
is analogous to setting the ymin value of the MATLAB axis
function. Tunable.
Maximum Y-limit
Specify the maximum value of the y-axis. Setting this parameter
is analogous to setting the ymax value of the MATLAB axis
function. Tunable.
Y-axis label
Specify text to be displayed to the left of the y-axis. Tunable.
When User-defined is selected for the Input domain parameter, the
following parameters are available on the Axis Properties pane:
1-1871
Vector Scope
1-1872
Vector Scope
1-1873
Vector Scope
Maximum Y-limit
Specify the maximum value of the y-axis. Setting this parameter
is analogous to setting the ymax value of the MATLAB axis
function. Tunable.
Y-axis label
Specify text to be displayed to the left of the y-axis. Tunable.
Line visibilities
Enter on or off to specify the visibility of the various channels
scope traces. Separate your choices for each channel with by a
pipe (|) symbol. Tunable.
1-1874
Vector Scope
Line styles
Enter the line styles of the various channels scope traces.
Separate your choices for each channel with by a pipe (|) symbol.
Tunable.
Line markers
Enter the line markers of the various channels scope traces.
Separate your choices for each channel with by a pipe (|)
symbol.Tunable.
Line colors
Enter the colors of the various channels scope traces using the
ColorSpec formats. Separate your choices for each channel with
by a pipe (|) symbol.Tunable.
Supported
Data
Types
Port
Input
See Also
Matrix Viewer
Spectrum Analyzer
1-1875
Waterfall
Purpose
Library
Sinks
dspsnks4
Description
The Waterfall block displays multiple vectors of data at one time. These
vectors represent the input data at consecutive sample times. The input
to the block can be real or complex-valued data vectors of any data type
including fixed-point data types. However, the input is converted to
double-precision before the block processes the data. The Waterfall
block displays only real-valued, double-precision vectors of data.
The data is displayed in a three-dimensional axis in the Waterfall
window. By default, the x-axis represents amplitude, the y-axis
represents samples, and the z-axis represents time. You can adjust
the number of sample vectors that the block displays, move and resize
the Waterfall window, and modify block parameter values during the
simulation. The Waterfall window has toolbar buttons that enable you
to zoom in on displayed data, suspend data capture, freeze the scopes
display, save the scope position, and export data to the workspace. The
toolbar buttons are labeled in the following figure, which shows the
Waterfall window as it appears when you double-click a Waterfall block.
1-1876
Waterfall
1-1877
Waterfall
Waterfall Parameters
You can control the display and behavior of the Waterfall window using
the Parameters dialog box.
Note You can alter the Waterfall parameters while the simulation is
running. However, when you make changes to values in text boxes, you
must click Enter or click outside the text box before the block accepts
your changes.
1 To open the Parameters dialog box, click the Scope parameters
button.
1-1878
Waterfall
1-1879
Waterfall
Display Parameters
The following parameters control the Waterfall windows display.
1-1880
Waterfall
Display traces
Enter the number of vectors of data to be displayed in the
Waterfall window.
Update interval
Enter the number of vectors the block should store before it
displays them to the window.
Colormap
Choose a colormap for the displayed data.
Transparency
Specify the transparency of the newest and oldest data vectors.
Placing the slider in the left-most position tells the block to make
the data vector transparent. Placing the slider in the right-most
position tells the block to make the data vector opaque. The
intermediate data vectors transition between the two chosen
transparency values.
Axes Parameters
The following parameters control the axes in the Waterfall window.
1-1881
Waterfall
Y Min
Enter the minimum value of the y-axis.
Y Max
Enter the maximum value of the y-axis.
Axis color
Enter a background color for the axes. Specify the color using a
character string. For example, to specify black, enter 'k'.
X Axis
Enter the x-axis label.
Y Axis
Enter the y-axis label.
Z Axis
Enter the z-axis label.
1-1882
Waterfall
History traces
Enter the number of vectors (traces) that you want the block to
store.
When the buffer is full
Use this parameter to control the behavior of the block when the
buffer is filled:
Overwrite The old data is replaced with the new data.
Suspend The block stops storing data in the buffer; however,
the simulation continues to run.
Extend The block extends the buffer so that it can continue
to store all the input data.
1-1883
Waterfall
Data logging
Use this parameter to control which data is exported from the
block:
Selected The selected data vector is exported.
All visible All of the data vectors displayed in the
Waterfall window are exported.
All history All of the data vectors stored in the blocks
history buffer are exported.
Export variable
Enter the name of the variable that represents your data in the
MATLAB workspace or SPTool. The default variable name is
ExportData.
Export at end of simulation
Select this check box to automatically export the data to the
MATLAB workspace when the simulation stops.
Triggering Parameters
The following parameters control when the Waterfall block starts and
stops capturing data.
1-1884
Waterfall
Begin recording
This parameter controls when the Waterfall block starts capturing
data:
Immediately The Waterfall window captures the input data
as soon as the simulation starts.
After T seconds The Time, T parameter appears in the
dialog box. Enter the number of seconds the block should wait
before it begins capturing data.
After N inputs The Count, N parameter appears in the
dialog box. Enter the number of inputs the block should receive
before it begins capturing data.
User-defined The Function name parameter appears in
the dialog box. Enter the name of a MATLAB function that
defines when the block should begin capturing data. For more
information about how you define this function, see Scope
Trigger Function on page 1-1888.
1-1885
Waterfall
Stop recording
This parameter controls when the Waterfall block stops capturing
data:
Never The block captures the input data as long as the
simulation is running.
After T seconds The Time, T parameter appears in the
dialog box. Enter the number of seconds the block should wait
before it stops capturing data.
After N inputs The Count, N parameter appears in the
dialog box. Enter the number of inputs the block should receive
before it stops capturing data.
User-defined The Function name parameter appears in
the dialog box. Enter the name of a MATLAB function that
defines when the block should stop capturing data. For more
information about how you define this function, see Scope
Trigger Function on page 1-1888.
Re-arm trigger
This parameter controls when the Waterfall block begins waiting
to capture data. It is available only when you select After
T seconds, After N inputs, or User-defined for the Stop
recording parameter:
Never The Waterfall Scope block starts and stops capturing
data as defined by the Begin recording and Stop recording
parameters.
After T seconds The Time, T parameter appears in the
dialog box. Enter the number of seconds the block should wait
before it begins waiting to capture data.
After N inputs The Count, N parameter appears in the
dialog box. Enter the number of inputs the block should receive
before it begins waiting to capture data.
User-defined The Function name parameter appears in
the dialog box. Enter the name of a MATLAB function that
1-1886
Waterfall
1-1887
Waterfall
where functionname refers to the name you give your scope trigger
function. The variable blk is the Simulink block handle. When the
scope trigger function is called by the block, Simulink automatically
populates this variable with the handle of the Waterfall block. The
variable t is the current simulation time, represented by a real,
double-precision, scalar value. The variable u is the vector input to the
block. The output of the scope trigger function, y, is interpreted as a
logical signal. It is either true or false:
1-1888
Waterfall
When the output is false, the block remains in its current state.
When the output of this scope trigger function is true, the block
stops capturing data.
When the output is false, the block remains in its current state.
When the output of this scope trigger function is true, the block
waits for a begin recording event.
When the output is false, the block remains in its current state.
Note The Waterfall block passes its input data directly to the
scope trigger functions. These functions do not use the transformed
data defined by the Transform parameters.
1-1889
Waterfall
function y = count3(blk, t, u)
persistent state;
if isempty(state); state = 0; end
if mean(u)>0; state = state+1; end
y = (state>=3);
if y; state = 0; end
Transform Parameters
The following parameters transform the input data to the Waterfall
block. The result of the transform is displayed in the Waterfall window.
1-1890
Waterfall
Note The block assumes that the input to the block corresponds to
the Transform parameter you select. For example, when you choose
Complex-> Angle, the block assumes that the input is complex.
The block does not produce an error when the input is not complex.
Therefore, you must verify the format of your input data to guarantee
that a meaningful result is displayed in the Waterfall window.
Transform
Choose a transform that you would like to apply to the input of
the Waterfall block:
None The input is displayed as it is received by the block.
Amplitude-> dB The block converts the input amplitude
into decibels.
Complex-> Mag Lin The block converts the complex input
into linear magnitude.
Complex-> Mag dB The block converts the complex input
into magnitude in decibels.
Complex-> Angle The block converts the complex input into
phase.
FFT-> Mag Lin Fs/2 The block takes the linear magnitude
of the FFT input and plots it from 0 to the Nyquist frequency.
FFT-> Mag dB Fs/2 The block takes the magnitude of the
FFT input, converts it to decibels, and plots it from 0 to the
Nyquist frequency.
FFT-> Angle Fs/2 The block converts the FFT input into
phase and plots it from 0 to the Nyquist frequency.
Power-> dB The block converts the input power into decibels.
1-1891
Waterfall
Function
This parameter is only available when you select User-defined
fcn for the Transform parameter. Enter a function that you
would like to apply to the input of the Waterfall block. For
more information about how you define this function, see Scope
Transform Function on page 1-1892.
Expression
This parameter is only available when you select User-defined
expr for the Transform parameter. Enter an expression that
you would like to apply to the input of the Waterfall block. The
result of this expression must be real-valued. When you write
the expression, be sure to include only one unknown variable.
The block assumes this unknown variable represents the input
to the block. When the block believes your expression is invalid,
the following window appears.
1-1892
Waterfall
where functionname refers to the name you give your function. The
variable u is the real or complex vector input to the block. The output of
the scope transform function, y, must be a double-precision, real-valued
vector. When it is not, the simulation stops and Simulink displays an
error. Note that the output vector does not need to be the same size
as the input vector.
Examples
Exporting Data
You can use the Waterfall block to export data to the MATLAB
workspace or to SPTool:
1 Open and run the dspanc example.
2 While the simulation is running, click the Export to Workspace
button.
1-1893
Waterfall
Capturing Data
You can use the Waterfall block to interact with your data while it is
being captured:
1 Open and run the dspanc example.
2 While the simulation is running, click the Suspend data capture
button.
The Waterfall block no longer captures or displays the data coming
from the Downsample block.
3 To continue capturing data, click the Resume data capture button.
4 To freeze the data display while continuing to capture data, click
1-1894
Waterfall
5 To view the Waterfall block that the data is coming from, click the
Linking Scopes
You can link several Waterfall blocks together in order to capture the
effect of a model event in all of the Waterfall windows in the model:
1 Open the dspanc example.
2 Drag a second Waterfall block into the example model.
3 Connect this block to the Output port of the LMS Filter block as
1-1895
Waterfall
4 Run the model and view the model behavior in both Waterfall
windows.
5 In the dspanc/Waterfall window, click the Link scopes button.
6 In the same window, click the Suspend data capture button.
In both scope windows, the data display freezes while the block
continues to capture data.
9 To continue displaying the captured data, click the Resume display
button.
Selecting Data
The following figure shows the Waterfall window displaying the output
of the dspanc example:
1-1896
Waterfall
vector of data.
The Waterfall block highlights the selected trace.
1-1897
Waterfall
1-1898
Waterfall
Zooming
You can use the Waterfall window to zoom in on data:
1 Click the Zoom camera button.
2 In the Waterfall window, click and hold down the left mouse button.
3 Move the mouse up and down and side-to-side to move closer and
button.
The y-axis changes so that its minimum value is zero. The maximum
value is scaled to fit the data displayed.
1-1899
Waterfall
Alternatively, you can scale the y-axis using the Y Min and Y Max
parameters in the Axes pane of the Parameters dialog box. This is
helpful when you want to undo the effects of rescaling the amplitude.
For more information, see Axes Parameters on page 1-1881.
Supported
Data
Types
Port
Input
The Waterfall block accepts any of these data types as input. However,
the input is converted to double-precision before the block processes the
data. The Waterfall block displays only real-valued, double-precision
vectors of data.
See Also
1-1900
Scope
Simulink
Time Scope
Waterfall
Vector Scope
Spectrum Analyzer
Matrix Viewer
Signal To Workspace
Triggered To
Workspace
1-1901
Purpose
Library
dspobslib
Description
Note The Wavelet Analysis block will be removed from the product in
a future release. We strongly recommend replacing this block with
the DWT block.
The Wavelet Analysis block uses the Wavelet Toolbox wfilters
function to construct a dyadic analysis filter bank that decomposes a
broadband signal into a collection of successively more bandlimited
components. An n-level filter bank structure is shown below, where n is
specified by the Number of levels parameter.
1-1902
Filter Coefficients
The filter coefficients for the highpass and lowpass filters are computed
by the Wavelet Toolbox function wfilters, based on the wavelet
specified in the Wavelet name parameter. The table below lists the
available options.
Wavelet Name
Haar
wfilters('haar')
Daubechies
wfilters('db4')
Symlets
wfilters('sym3')
Coiflets
wfilters('coif1')
Biorthogonal
wfilters('bior3.1')
Reverse Biorthogonal
wfilters('rbio3.1')
Discrete Meyer
wfilters('dmey')
1-1903
See the Wavelet Toolbox documentation for more information about the
wfilters function. If you want to explicitly specify the FIR coefficients
for the analysis filter bank, use the Dyadic Analysis Filter Bank block.
Tree Structure
The wavelet tree structure has n+1 outputs, where n is the number of
levels. The sample rate and bandwidth of the top output are half the
input sample rate and bandwidth. The sample rate and bandwidth of
each additional output (except the last) are half that of the output from
the previous level. In general, for an input with sample period Tsi = Ts,
and bandwidth BW, output yk has sample period Tso,k and bandwidth
BWk.
Tso,k
( )
( )
2k T
s
=
2n Ts
BW
k
2
BWk =
BW
2n
(1 k n )
( k = n + 1)
(1 k n )
( k = n + 1)
Mo,k
Mi
k
2
=
M
i
2n
(1 k n )
( k = n + 1)
The bottom two outputs (yn and yn+1) share the same sample period,
bandwidth, and frame size because they originate at the same tree level.
1-1904
Sample-Based Operation
An M-by-N sample-based matrix input is treated as M*N independent
channels, and the block filters each channel independently over time.
The output at each port is the same size as the input, one output
channel for each input channel. As described earlier, each output port
has a different sample period.
The figure below shows the input and output sample periods for a
64-channel sample-based input to a three-level filter bank. The input
has a period of 1, so the fastest output has a period of 2.
Frame-Based Operation
An Mi-by-N frame-based matrix input is treated as N independent
channels, and the block filters each channel independently over time.
The input frame size Mi must be a multiple of 2n, and n is the number of
filter bank levels. For example, a frame size of 8 would be appropriate
for a three-level tree (23=8). The number of columns in each output is
the same as the number of columns in the input.
Each output port has the same frame period as the input. The reduction
in the output sample rates results from the smaller output frame sizes,
as shown in the example below for a four-channel input to a three-level
filter bank.
1-1905
Zero Latency
The Wavelet Analysis block has no tasking latency for frame-based
operation, which is always single-rate. The block therefore analyzes the
first input sample (received at t=0) to produce the first output sample
at each port.
Nonzero Latency
For sample-based operation, the Wavelet Analysis block is multirate
and has 2n-1 samples of latency in both Simulink tasking modes. As a
result, the block repeats a zero initial condition in each channel for the
first 2n-1 output samples, before propagating the first analyzed input
sample (computed from the input received at t=0).
Note For more information on latency and the Simulink tasking
modes, see Excess Algorithmic Delay (Tasking Latency) and the
topic on models with multiple sample rates in the Simulink Coder
documentation.
1-1906
Dialog
Box
The parameters displayed in the dialog box vary for different wavelet
types. Only some of the parameters listed below are visible in the dialog
box at any one time.
Wavelet name
The wavelet used in the analysis.
Wavelet order
The order for the Daubechies, Symlets, and Coiflets wavelets.
This parameter is available only when one of these wavelets is
selected in the Wavelet name menu.
Filter order [synthesis / analysis]
The filter orders for the synthesis and analysis stages of the
Biorthogonal and Reverse Biorthogonal wavelets. For
example, [2 / 6] selects a second-order synthesis stage and
a sixth-order analysis stage. The Filter order parameter is
available only when one of the above wavelets is selected in the
Wavelet name menu.
Number of levels
The number of filter bank levels. An n-level structure has n+1
outputs.
1-1907
References
Supported
Data
Types
See Also
1-1908
Dyadic Analysis
Filter Bank
Wavelet Synthesis
(Obsolete)
wfilters
Wavelet Toolbox
Purpose
Library
dspobslib
Description
Note The Wavelet Synthesis block will be removed from the product
in a future release. We strongly recommend replacing this block with
the IDWT block.
The Wavelet Synthesis block uses the Wavelet Toolbox wfilters
function to reconstruct a signal that was decomposed by the Wavelet
Analysis (Obsolete) block. The reconstruction or synthesis process is
the inverse of the analysis process, and restores the original signal by
upsampling, filtering, and summing the bandlimited inputs in stages
corresponding to the analysis process. An n-level synthesis filter bank
structure is shown below, where n is specified by the Number of levels
parameter.
1-1909
a factor of 2 to match the sample rate of the input to the next stage.
They are then filtered by a highpass (HP) and lowpass (LP) filter pair
with coefficients calculated to cancel (in the subsequent summation)
the aliasing introduced in the corresponding analysis filter stage. The
output from each (upsample-filter-sum) level has twice the bandwidth
and twice the sample rate of the input to that level.
For perfect reconstruction, the Wavelet Synthesis and Wavelet Analysis
blocks must have the same parameter settings.
Filter Coefficients
The filter coefficients for the highpass and lowpass filters are computed
by the Wavelet Toolbox function wfilters, based on the wavelet
specified in the Wavelet name parameter. The table below lists the
available options.
Wavelet Name
Haar
wfilters('haar')
Daubechies
wfilters('db4')
Symlets
wfilters('sym3')
Coiflets
wfilters('coif1')
Biorthogonal
wfilters('bior3.1')
Reverse Biorthogonal
wfilters('rbio3.1')
Discrete Meyer
wfilters('dmey')
1-1910
you to independently specify the wavelet order for the analysis and
synthesis filter stages. For example, if you specify a Biorthogonal
wavelet with Filter order [synthesis / analysis] equal to [2 / 6],
the Wavelet Synthesis block calls the wfilters function with input
argument 'bior2.6'.
See the Wavelet Toolbox documentation for more information about the
wfilters function. If you want to explicitly specify the FIR coefficients
for the synthesis filter bank, use the Dyadic Synthesis Filter Bank block.
Tree Structure
The wavelet tree structure has n+1 inputs, where n is the number of
levels. The sample rate and bandwidth of the output are twice the
sample rate and bandwidth of the top input. The sample rate and
bandwidth of each additional input (except the last) are half that of the
input to the previous level.
BWk
2
1k<n
The bottom two inputs (un and un+1) should have the same sample rate
and bandwidth since they are processed by the same level.
Tsi,n+1 = Tsi,n
BWn+1 = BWn
Note that in frame-based mode, the sample period of input uk is
reflected by its frame sizeMi,k, rather than by its frame rate.
1-1911
Mi,k+1 =
Mi,k
2
1k<n
Mi,n+1 = Mi,n
Sample-Based Operation
An M-by-N sample-based matrix input is treated as M*N independent
channels, and the block filters each channel independently over time.
The output is the same size as the input at each port, one output
channel for each input channel. As described earlier, each input port
has a different sample period.
The figure below shows the input and output sample periods for the four
64-channel sample-based inputs to a three-level filter bank. The fastest
input has a period of 2, so the output period is 1.
Frame-Based Operation
An Mi-by-N frame-based matrix input is treated as N independent
channels, and the block filters each channel independently over time.
The number of columns in the output is the same as the number of
columns in the input.
All inputs must have the same frame period, which is also the output
frame period. The different input sample rates should be represented
by the input frame sizes: If the input to the top port has frame size
Mi, the input to the second-from-top port should have frame size Mi/2,
the input to the third-from-top port should have frame size Mi/4, and
so on. The input to the bottom port should have the same frame size
1-1912
Zero Latency
The Wavelet Synthesis block has no tasking latency for frame-based
operation, which is always single-rate. The block therefore uses the first
input samples (received at t=0) to synthesize the first output sample.
Nonzero Latency
For sample-based operation, the Wavelet Synthesis block is multirate
and has the following tasking latencies:
2n-2 samples in Simulinks single-tasking mode
2n samples in Simulinks multitasking mode
In the above cases, the block repeats a zero initial condition in each
channel for the first D output samples, where D is the latency shown
above. For example, in single-tasking mode the block generates 2n-2
zero-valued output samples in each channel before propagating the first
synthesized output sample (computed from the inputs received at t=0).
1-1913
Dialog
Box
The parameters displayed in the dialog box vary for different wavelet
types. Only some of the parameters listed below are visible in the dialog
box at any one time.
Wavelet name
The wavelet used in the synthesis.
Wavelet order
The order for the Daubechies, Symlets, and Coiflets wavelets.
This parameter is available only when one of these wavelets is
selected in the Wavelet name menu.
Filter order [synthesis / analysis]
The filter orders for the synthesis and analysis stages of the
Biorthogonal and Reverse Biorthogonal wavelets. For
example, [2 / 6] selects a second-order synthesis stage and
a sixth-order analysis stage. The Filter order parameter is
available only when one of the above wavelets is selected in the
Wavelet name menu.
1-1914
Number of levels
The number of filter bank levels. An n-level structure has n+1
outputs.
References
Supported
Data
Types
See Also
Dyadic Synthesis
Filter Bank
Wavelet Analysis
(Obsolete)
wfilters
Wavelet Toolbox
1-1915
Window Function
Purpose
Library
Signal Operations
dspsigops
Description
Operation Modes
The Window Function block has three modes of operation that you can
select via the Operation parameter. In each mode, the block first
creates a window vector w by sampling the window specified in the
Window type parameter at M discrete points. The operation modes
are:
Apply window to input
In this mode, the block computes an M-by-1 window vector w and
applies it to the input. The output y always has the same dimension
as the input.
When the input is an M-by-N matrix u, the window is multiplied
element-wise with each of the N channels in the input matrix u. This
is equivalent to the following MATLAB code:
y = repmat(w,1,N) .* u
1-1916
Window Function
At the Out port, the block produces the result of the multiplication
y, which has the same dimension as the input.
At the Win port, the block produces the M-by-1 window vector w.
Window Type
The following table lists the available window types. For complete
information about the window functions, consult the Signal Processing
Toolbox documentation.
1-1917
Window Function
Window Type
Description
Bartlett
Blackman
Boxcar
Chebyshev
Hamming
Hann
Hanning
Kaiser
1-1918
Window Function
Window Type
Description
Taylor
Triang
User Defined
Window Sampling
For the generalized-cosine windows (Blackman, Hamming, Hann, and
Hanning), the Sampling parameter determines whether the window
samples are computed in a periodic or a symmetric manner. For
example, when Sampling is set to Symmetric, a Hamming window of
length M is computed as
w = hamming(M)
1-1919
Window Function
1-1920
Window Function
You can set the window, product output, and output data types in the
block dialog box. For more information see the Dialog Box on page
1-1923 section.
1-1921
Window Function
Examples
The following model uses the Window Function block to generate and
apply a Hamming window to a 3-dimensional input array.
In this example, set the Operation mode of the Window Function block
to Generate and apply window, so the block provides two outputs: the
window vector w at the Win port, and the result of the multiplication y
at the Out port.
Open the model by typing ex_windowfunction_ref at the MATLAB
command line, and run it.
The length of the first dimension of the input array is 10, so the
Window Function block generates and outputs a Hamming window
vector of length 10. To see the window vector generated by the
Window Function block, type w at the MATLAB command line.
To see the result of the multiplication, type y at the MATLAB
command line.
1-1922
Window Function
Dialog
Box
The Main pane of the Window Function block dialog appears as follows.
1-1923
Window Function
Operation
Specify the blocks operation, as discussed in Operation Modes
on page 1-1916. The port configuration of the block is updated to
match the setting of this parameter.
Window type
Specify the window type to apply, as listed in Window Type on
page 1-1917. Tunable in simulation only.
Sampling
Specify the window sampling for generalized-cosine windows.
This parameter is only visible when you select Blackman, Hamming,
Hann, or Hanning for the Window type parameter. Tunable in
simulation only.
Sample Mode
Specify the sample mode for the block, Continuous or Discrete,
when it is in Generate Window mode. In the Apply window
to output and Generate and apply window modes, the block
inherits the sample time from its driving block. Therefore, this
parameter is only visible when you select Generate window for
the Operation parameter.
Sample time
Specify the sample time for the block when it is in Generate
window and Discrete modes. In Apply window to output and
Generate and apply window modes, the block inherits the
sample time from its driving block. This parameter is only visible
when you select Discrete for the Sample Mode parameter.
Window length
Specify the length of the window to apply. This parameter is only
visible when you select Generate window for the Operation
parameter. Otherwise, the window vector length is computed to
match the length of the first dimension of the input.
Stopband attenuation in dB
Specify the level of stopband attenuation, Rs, in decibels. This
parameter is only visible when you select Chebyshev for the
Window type parameter. Tunable in simulation only.
1-1924
Window Function
Beta
Specify the Kaiser window parameter. Increasing widens the
mainlobe and decreases the amplitude of the window sidelobes
in the windows frequency magnitude response. This parameter
is only visible when you select Kaiser for the Window type
parameter. Tunable in simulation only.
Number of sidelobes
Specify the number of sidelobes as a scalar integer value greater
than zero. This parameter is only visible when you select Taylor
for the Window type parameter.
Maximum sidelobe level relative to mainlobe (dB)
Specify, in decibels, the maximum sidelobe level relative to the
mainlobe. This parameter must be a scalar less than or equal to
zero. The default value of 30 produces sidelobes with peaks 30
dB down from the mainlobe peak. This parameter is only visible
when you select Taylor for the Window type parameter.
Window function name
Specify the name of the user-defined window function to be
calculated by the block. This parameter is only visible when you
select User defined for the Window type parameter.
Specify additional arguments to the hamming function
Select to enable the Cell array of additional arguments
parameter, when the user-defined window requires parameters
other than the window length. This parameter is only visible
when you select User defined for the Window type parameter.
Cell array of additional arguments
Specify the extra parameters required by the user-defined window
function, besides the window length. This parameter is only
available when you select the Specify additional arguments
to the hamming function parameter. The entry must be a cell
array.
The Data Types pane of the Window Function block dialog is discussed
in the following sections:
1-1925
Window Function
1-1926
Window Function
1-1927
Window Function
Fraction length
Specify the fraction length, in bits, of the fixed-point window data
type. This parameter is only visible when you select Fixed-point
or User-defined for the Window data type parameter and
User-defined for the Set fraction length in output to
parameter.
1-1928
Window Function
Rounding mode
Select the rounding mode for fixed-point operations.
1-1929
Window Function
1-1930
Window Function
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the window vector elements.
This block requires power-of-two slope and a bias of zero.
The window vector does not obey the Rounding mode and
Overflow mode parameters; it is always saturated and rounded
to Nearest.
Product output
Use this parameter to specify how you want to designate the
product output word and fraction lengths. See Fixed-Point Data
Types on page 1-1810 for illustrations depicting the use of the
product output data type in this block:
When you select Inherit via internal rule, the product
output word length and fraction length are calculated
automatically. For information about how the product output
word and fraction lengths are calculated when an internal rule
is used, see Inherit via Internal Rule.
When you select Same as input, these characteristics match
those of the input to the block.
When you select Binary point scaling, you can enter the
word length and the fraction length of the product output, in
bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the product output. This
block requires power-of-two slope and a bias of zero.
Output
Choose how you specify the word length and fraction length of
the output of the block:
When you select Same as product output, these
characteristics match those of the product output.
When you select Same as input, these characteristics match
those of the input to the block.
1-1931
Window Function
When you select Binary point scaling, you can enter the
word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the
word length, in bits, and the slope of the output. This block
requires power-of-two slope and a bias of zero.
Lock data type settings against changes by the fixed-point tools
Select this parameter to prevent the fixed-point tools from
overriding the data types you specify on the block mask.
Supported
Data
Types
Port
Input
Output
Win
See Also
1-1932
FFT
bartlett
blackman
rectwin
Window Function
chebwin
hamming
hann
kaiser
taylorwin
triang
1-1933
Yule-Walker AR Estimator
Purpose
Library
Description
H ( z) =
G
G
=
1
A ( z ) 1 + a(2) z + + a ( p + 1) z p
1-1934
Yule-Walker AR Estimator
Dialog
Box
Output(s)
The type of AR model coefficients output by the block. The block
can output polynomial coefficients (A), reflection coefficients (K),
or both (A and K).
Inherit estimation order from input dimensions
When selected, sets the estimation order p to one less than the
length of each input channel.
1-1935
Yule-Walker AR Estimator
Estimation order
The order of the AR model, p. This parameter is enabled when
you do not select Inherit estimation order from input
dimensions.
References
Supported
Data
Types
Port
Input
See Also
1-1936
Burg AR Estimator
Covariance AR
Estimator
Modified Covariance
AR Estimator
Yule-Walker Method
aryule
Purpose
Library
dspobslib
Description
Note The Yule-Walker IIR Filter Design block is still supported but
is likely to be obsoleted in a future release. We strongly recommend
replacing this block with the Digital Filter block.
The Yule-Walker IIR Filter Design block designs a recursive (ARMA)
digital filter with arbitrary multiband magnitude response, and
applies it to a discrete-time input using the Direct-Form II Transpose
Filter block. The filter design, which uses the Signal Processing
Toolbox yulewalk function, performs a least-squares fit to the specified
frequency response.
An M-by-N sample-based matrix input is treated as M*N independent
channels, and an M-by-N frame-based matrix input is treated as N
independent channels. In both cases, the block filters each channel
independently over time, and the output has the same size and frame
status as the input.
The Band-edge frequency vector parameter is a vector of frequency
points in the range 0 to 1, where 1 corresponds to half the sample
frequency. The first element of this vector must be 0 and the last
element 1, and intermediate points must appear in ascending order.
The Magnitudes at these frequencies parameter is a vector
containing the desired magnitude response at the points specified in the
Band-edge frequency vector.
Note that, unlike the Remez FIR Filter Design block, each
frequency-magnitude pair specifies the junction of two adjacent
frequency bands, so there are no dont care regions.
1-1937
1-1938
Dialog
Box
Filter order
The order of the filter.
Band-edge frequency vector
A vector of frequency points. The value 1 corresponds to half the
sample frequency. The first element of this vector must be 0 and
the last element 1. Tunable.
Magnitudes at these frequencies
A vector of frequency response magnitudes corresponding to the
points in the Band-edge frequency vector. This vector must be
the same length as the Band-edge frequency vector. Tunable.
References
1-1939
Yule-Walker Method
Purpose
Library
Description
1-1940
Yule-Walker Method
The input to the block is the original signal, with no samples added
or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time from
input check box. You can then specify a sample time using the Sample
time of original time series parameter.
See the Burg Method block reference for a comparison of the Burg
Method, Covariance Method, Modified Covariance Method, and
Yule-Walker AR Estimator blocks. The Yule-Walker AR Estimator and
Burg Method blocks return similar results for large buffer lengths.
1-1941
Yule-Walker Method
Dialog
Box
1-1942
Yule-Walker Method
FFT length
Enter the number of data points on which to perform the FFT,
Nfft. When Nfft is larger than the input frame size, the block
zero-pads each frame as needed. When Nfft is smaller than the
input frame size, the block wraps each frame as needed. This
parameter becomes visible only when you clear the Inherit FFT
length from input dimensions check box.
Inherit sample time from input
When you select the Inherit sample time from input check box,
the block computes the frequency data from the sample period
of the input signal. For the block to produce valid output, the
following conditions must hold:
The input to the block is the original signal, with no samples
added or deleted (by insertion of zeros, for example).
The sample period of the time-domain signal in the simulation
equals the sample period of the original time series.
If these conditions do not hold, clear the Inherit sample time
from input check box. You can then specify a sample time using
the Sample time of original time series parameter.
Sample time of original time series
Specify the sample time of the original time-domain signal. This
parameter becomes visible only when you clear the Inherit
sample time from input check box.
References
1-1943
Yule-Walker Method
Supported
Data
Types
Port
Input
Output
The output data type is the same as the input data type.
See Also
Burg Method
Covariance Method
Levinson-Durbin
Autocorrelation LPC
Short-Time FFT
Yule-Walker AR
Estimator
1-1944
Zero Crossing
Purpose
Library
Signal Operations
dspsigops
Description
The Zero Crossing block concludes that a signal in a given channel has
passed through zero if it meets any of the following criteria, where xi is
the current signal value, xi-1 is the previous signal value, and so on:
xi < 0 and xi-1 > 0
xi > 0 and xi-1 < 0
For some positive integer L, xi < 0, xi-l = 0, and xi-L-1 > 0, where
0l L.
For some positive integer L, xi > 0, xi-l = 0, and xi-L-1 < 0, where
0l L.
For the first input value, xi-1 and xi-2 are zero. The block outputs the
number of times the signal crosses zero in a single time step at the
Cnt port.
The input to this block must be a real-valued fixed-point or floating-point
signal. If you set the Input processing parameter to Elements as
channels (sample based), the block treats each element of the input
as a time-varying channel. If you set the Input processing parameter
to Columns as channels (frame based), the block treats each column
of the input as an independent channel.
Examples
1-1945
Zero Crossing
Because the signal passes through zero once during the first time step,
the Zero Crossing block finds one zero crossing. The number of detected
zero crossings in the first time step is shown in the Display block in
the following figure.
To run the model for two time steps, change the simulation Stop
time to 1. To do so, open the Configuration Parameters dialog box by
selecting Model Configuration Parameters from the Simulation
menu. In the Solver pane, set Stop time to 1.
3
1-1946
Zero Crossing
Dialog
Box
Input processing
Specify how the block should process the input. You can set this
parameter to one of the following options:
Columns as channels (frame based) When you select
this option, the block treats each column of the input as a
separate channel.
Elements as channels (sample based) When you select
this option, the block treats each element of the input as a
separate channel.
Note The Inherited (this choice will be removed - see
release notes) option will be removed in a future release. See
Frame-Based Processing in the DSP System Toolbox Release
Notes for more information.
1-1947
Zero Crossing
Supported
Data
Types
Port
Input
Double-precision floating-point
Single-precision floating-point
Fixed point (signed and unsigned)
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
Cnt
See Also
1-1948
Hit Crossing
Simulink
2
Analysis Methods for Filter
System Objects
Description
info
Filter information
freqz
Frequency response of a
discrete-time filter
phasez
zerophase
Zero-phase response of a
discrete-time filter
grpdelay
phasedelay
impz
stepz
zplane
Pole/Zero plot
cost
Cost estimate
measure
order
Filter order
firtype
coeffs
Multirate Analysis
2-2
polyphase
Polyphase decomposition of
multirate filters
gain
Method
Description
Second-order Sections
scale
scalecheck
scaleopts
cumsec
reorder
sos
Code Generation
realizemdl
noisepsdopts
freqrespest
freqrespopts
Other
isallpass
islinphase
ismaxphase
isminphase
isreal
isstable
2-3
2-4
Method
Description
isfir
issos
specifyall
3
Alphabetical List
dsp.AdaptiveLatticeFilter
Purpose
Description
on page 3-2.
2 Call step to implement the filter according to the properties of
Construction
filtered output and the filter error for a given input and desired signal.
H = dsp.AdaptiveLatticeFilter('PropertyName',
PropertyValue,...) returns an AdaptiveLatticeFilter System
object, H, with each specified property set to the specified value.
H =
dsp.AdaptiveLatticeFilter(LEN,'PropertyName',PropertyValue,...)
returns an AdaptiveLatticeFilter System object, H, with the
Length property set to LEN and other specified properties set to
Properties
Method
3-2
dsp.AdaptiveLatticeFilter
3-3
dsp.AdaptiveLatticeFilter
3-4
dsp.AdaptiveLatticeFilter
Methods
Examples
clone
isLocked
msesim
release
reset
step
16;
exp(1i*pi/4)*[-0.7 1];
[1 -0.7];
= 1000;
sign(randn(1,ntr+D)) + 1i*sign(randn(1,ntr+D));
0.1*(randn(1,ntr+D) + 1i*randn(1,ntr+D));
filter(b,a,s) + n;
r(1+D:ntr+D);
s(1:ntr);
Use the Adaptive Lattice Filter to compute the filtered output and the
filter error for the input and desired signal:
3-5
dsp.AdaptiveLatticeFilter
lam = 0.995;
del = 1;
h = dsp.AdaptiveLatticeFilter('Length', 32, ...
'ForgettingFactor', lam, 'InitialPredictionErrorPower', del);
[y,e] = step(h,x,d);
References
[1] Griffiths, Lloyd J. A Continuously Adaptive Filter Implemented
as a Lattice Structure. Proceedings of IEEE Int. Conf. on Acoustics,
Speech, and Signal Processing, Hartford, CT, pp. 683686, 1977 .
[2] Haykin, S. Adaptive Filter Theory, 4th Ed. Upper Saddle River, NJ:
Prentice Hall, 1996.
3-6
dsp.AdaptiveLatticeFilter
See Also
3-7
dsp.AdaptiveLatticeFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-8
dsp.AdaptiveLatticeFilter.msesim
l = 32;
mu = 0.008;
m = 5;
% Filter length
% Adaptive Lattice filter Step siz
% Decimation factor for analysis
% and simulation results
ha = dsp.AdaptiveLatticeFilter(l,'StepSize',mu);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('Iteration'); ylabel('MSE (dB)');
title('Learning curve for Adaptive Lattice filter used in system ident
3-9
dsp.AdaptiveLatticeFilter.clone
3-10
Purpose
Syntax
C = clone(H)
Description
the same property values. The clone method creates a new unlocked
object with uninitialized states.
dsp.AdaptiveLatticeFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-11
dsp.AdaptiveLatticeFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-12
dsp.AdaptiveLatticeFilter.reset
Purpose
Syntax
reset(H)
Description
3-13
dsp.AdaptiveLatticeFilter.step
Purpose
Syntax
Description
outputs.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-14
dsp.AffineProjectionFilter
Purpose
Description
Construction
Properties
Method
3-15
dsp.AffineProjectionFilter
3-16
dsp.AffineProjectionFilter
3-17
dsp.AffineProjectionFilter
Methods
Examples
clone
isLocked
msesim
release
reset
step
D = 16;
% Number of samples of delay
% Numerator coefficients of channel
b = exp(j*pi/4)*[-0.7 1];
% Denominator coefficients of channel
a = [1 -0.7];
% Number of iterations
ntr = 1000;
s = sign(randn(1,ntr+D)) + j*sign(randn(1,ntr+D)); % Baseband sign
% Noise signal
n = 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D));
% Received signal
r = filter(b,a,s)+n;
% Input signal (received signal)
x = r(1+D:ntr+D);
% Desired signal (delayed QPSK signal
d = s(1:ntr);
% Step size
mu = 0.1;
% Projection order
po = 4;
% Offset for covariance matrix
offset = 0.05;
h = dsp.AffineProjectionFilter('Length', 32, ...
'StepSize', mu, 'ProjectionOrder', po, ...
'InitialOffsetCovariance',offset);
[y,e] = step(h,x,d);
3-18
dsp.AffineProjectionFilter
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('time index'); ylabel('signal value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('time index'); ylabel('signal value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
Algorithms
3-19
dsp.AffineProjectionFilter
u ( n)
Uap (n)
u (n N )
u (n L)
u(n) u(n 1)
u (n L N )
y ( n)
y (n L)
d ( n)
dap (n)
d (n L)
e( n )
e( n L )
H
w (n) w (n 1) Uap (n)(Uap (n)Uap (n) C) 1 eap
where C is either I if the initial offset covariance is a scalar , or R if
the initial offset covariance is a matrix R. The variables are as follows:
3-20
Variable
Description
u(n)
u(n L)
dsp.AffineProjectionFilter
Variable
Description
Uap(n)
w(n)
y(n)
d(n)
e(n)
References
[1] K. Ozeki, T. Umeda, An adaptive Filtering Algorithm Using an
Orthogonal Projection to an Affine Subspace and its Properties,
Electron. Commun. Jpn. 67-A(5), May 1984, pp. 1927.
[2] Paulo S. R. Diniz, Adaptive Filtering: Algorithms and Practical
Implementation, Second Edition. Boston: Kluwer Academic Publishers,
2002
See Also
3-21
dsp.AffineProjectionFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-22
dsp.AffineProjectionFilter.msesim
l = 32;
mu = 0.008;
m = 5;
% Filter length
% Affine Projection filter Step si
% Decimation factor for analysis
% and simulation results
ha = dsp.AffineProjectionFilter(l,'StepSize',mu);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('Iteration'); ylabel('MSE (dB)');
title('Learning curve for Affine Projection filter used in system iden
3-23
dsp.AffineProjectionFilter.clone
Purpose
Syntax
C = clone(OBJ)
Description
See Also
3-24
dsp.AffineProjectionFilter.step |
dsp.AffineProjectionFilter.isLocked |
dsp.AffineProjectionFilter.reset
dsp.AffineProjectionFilter.isLocked
Purpose
Syntax
L = isLocked(OBJ)
Description
See Also
input attributes and nontunable properties are locked for the System
object, OBJ. The object performs an internal initialization the first
time the step method is executed. This initialization locks nontunable
properties and input specifications, such as dimensions, complexity,
and data type of the input data. Once this occurs, the isLocked method
returns a true value.
dsp.AffineProjectionFilter.step |
dsp.AffineProjectionFilter.release
3-25
dsp.AffineProjectionFilter.release
Purpose
Syntax
release(OBJ)
Description
See Also
3-26
dsp.AffineProjectionFilter.isLocked |
dsp.AffineProjectionFilter.step
dsp.AffineProjectionFilter.reset
Purpose
Syntax
reset(OBJ)
Description
3-27
dsp.AffineProjectionFilter.step
Purpose
Syntax
Y = step(OBJ,x)
[Y1,...,YN] = step(OBJ,x)
Description
N outputs.
Every System object has a step method. The step method processes
the input data according to the object algorithm. The number of the
input and the output arguments depends on the algorithm, and may
depend also on one or more property settings. The step method for some
objects accepts fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
3-28
dsp.AllpassFilter
Purpose
Description
Construction
Properties
Structure
3-29
dsp.AllpassFilter
3-30
dsp.AllpassFilter
scalar, numeric 1-D or 2-D array, and cell array with as many cells
as filter sections. The numeric scalar is used for all filter states,
and the numeric 1-D or 2-D array is single-section only. The inner
dimensions must match exactly those of the internal filter states.
Methods
clone
isLocked
release
reset
step
Examples
3-31
dsp.AllpassFilter
Algorithms
H ( z)
Minimum multiplier
This structure realizes the allpass filter with the minimum number of
required multipliers, equal to the order n. It also uses 2n delay units
and 2n adders. The coefficients used by the multipliers are the same
as AllpassCoefficients, which are equal to the polynomial vector c
in the allpass transfer function. The following code shows an example
of a second-order section as a Simulink diagram using basic building
blocks. You need a Simulink license to generate the actual diagram
using realizemdl.
hap = dsp.AllpassFilter('AllpassCoefficients', [0.1, -0.7]);
realizemdl(hap)
3-32
dsp.AllpassFilter
3-33
dsp.AllpassFilter
c = [0.1, -0.7];
w = dsp.AllpassFilter.poly2wdf(c);
hap = dsp.AllpassFilter('Structure', 'Wave Digital Filter', 'WDFCoefficie
realizemdl(hap)
Lattice
This lattice structure uses 2n multipliers, n delay units, and 2n
adders. To use this structure, you must specify the coefficients
as LatticeCoefficients in Lattice form. Obtain these from the
conventional polynomial form of the allpass coefficients by using an
3-34
dsp.AllpassFilter
c = [0.1 -0.7];
k = tf2latc([1 c]);
hap = dsp.AllpassFilter('Structure', 'Lattice', 'LatticeCoefficients',
realizemdl(hap)
3-35
dsp.AllpassFilter
References
[1] Regalia, Philip A. and Mitra Sanjit K. and Vaidyanathan, P. P.
(1988) The Digital All-Pass Filter: AVersatile Signal Processing
Building Block. Proceedings of the IEEE, Vol. 76, No. 1, 1988, pp.
1937
[2] M. Lutovac, D. Tosic, B. Evans, Filter Design for Signal Processing
Using MATLAB and Mathematica. Prentice Hall, 2001
See Also
3-36
dsp.BiquadFilter | dsp.IIRFilter
dsp.AllpassFilter.clone
Purpose
Syntax
C = clone(OBJ)
Description
3-37
dsp.AllpassFilter.isLocked
3-38
Purpose
Syntax
L = isLocked(OBJ)
Description
input attributes and nontunable properties are locked for the System
object, OBJ. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. Once this occurs, the isLocked method returns a true value.
dsp.AllpassFilter.release
Purpose
Syntax
release(OBJ)
Description
3-39
dsp.AllpassFilter.reset
Purpose
Syntax
reset(OBJ)
Description
3-40
dsp.AllpassFilter.step
Purpose
Syntax
Y = step(OBJ,x)
[Y1,...,YN]= step(OBJ,x)
Description
N outputs.
Every System object has a step method. The step method processes
the input data according to the object algorithm. The number of the
input and the output arguments depends on the algorithm, and may
depend also on one or more property settings. The step method for some
objects accepts fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
3-41
dsp.AllpoleFilter
Purpose
Description
Construction
Properties
Structure
Filter structure
Specify the filter structure.
You can specify the filter structure as one of | Direct form |
Direct form transposed | Lattice AR. The default is Direct
form. Analysis methods are not supported for fixed-point
processing if the structure is Direct form or Direct form
transposed. This property is nontunable.
Denominator
3-42
dsp.AllpoleFilter
3-43
dsp.AllpoleFilter
3-44
dsp.AllpoleFilter
3-45
dsp.AllpoleFilter
Methods
3-46
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
dsp.AllpoleFilter
release
reset
step
Examples
3-47
dsp.AllpoleFilter
while ~isDone(hSR)
input = step(hSR);
filteredOutput = step(hallpole,input);
step(hLog,filteredOutput);
step(h,filteredOutput)
end
filteredResult = hLog.Buffer;
fvtool(hallpole,'Fs',8000)
3-48
dsp.AllpoleFilter
3-49
dsp.AllpoleFilter
Algorithms
3-50
dsp.AllpoleFilter
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
uses the FrameBasedProcessing property. The block uses the Input
processing parameter. See Set the FrameBasedProcessing Property
of a System object for more information.
See Also
3-51
dsp.AllpoleFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-52
dsp.AllpoleFilter.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-53
dsp.AllpoleFilter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-54
dsp.AllpoleFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-55
dsp.AllpoleFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-56
dsp.AllpoleFilter.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-57
dsp.AllpoleFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-58
dsp.AllpoleFilter.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-59
dsp.AllpoleFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-60
dsp.AllpoleFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the Allpole filter object, H, to their
initial values of 0. The initial filter state values correspond to the initial
conditions for the difference equation defining the filter. After the step
method applies the Allpole filter object to nonzero input data, the states
may be nonzero. Invoking the step method again without first invoking
the reset method may produce different outputs for an identical input.
For example:
n = 0:100;
x = cos(0.2*pi*n)+sin(0.8*pi*n);
H = dsp.AllpoleFilter;
a = lpc(x,20);
H.Denominator = a;
y = step(H,x);
% Filter states are nonzero
% Invoke step method again without resetting states
y1 = step(H,x);
isequal(y,y1) % returns 0
% Now reset filter states to 0
reset(H)
% Invoke step method
y2 = step(H,x);
isequal(y,y2) % returns a 1
3-61
dsp.AllpoleFilter.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-62
dsp.AnalyticSignal
Purpose
Description
on page 3-63.
2 Call step to compute the analytic signal according to the properties
Construction
Properties
FilterOrder
3-63
dsp.AnalyticSignal
FrameBasedProcessing
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Analytic signal
3-64
dsp.AnalyticSignal
Algorithms
See Also
dsp.FFT | dsp.IFFT
3-65
dsp.AnalyticSignal.clone
Purpose
Syntax
C = clone(H)
Description
3-66
dsp.AnalyticSignal.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-67
dsp.AnalyticSignal.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-68
dsp.AnalyticSignal.isLocked
Purpose
Syntax
isLocked(H)
Description
3-69
dsp.AnalyticSignal.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-70
dsp.AnalyticSignal.reset
Purpose
Syntax
reset(H)
Description
3-71
dsp.AnalyticSignal.step
Purpose
Analytic signal
Syntax
Y = step(H,X)
Description
Y = X + jH{ X }
where j is the imaginary unit and H{ X } denotes the Hilbert transform.
When you set the FrameBasedProcessing property to false, each of the
M-by-N matrix elements is an independent channel. Thus, the method
computes the analytic signal for each element of X. When you set the
FrameBasedProcessing property to true, each of the N columns in X
contains M sequential time samples from an independent channel. The
method computes the analytic signal for each channel.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-72
dsp.ArrayPlot
Purpose
Description
3-73
dsp.ArrayPlot
See the following sections for more information on the Array Plot
Graphical User Interface:
Signal Display on page 3-83
3-74
dsp.ArrayPlot
Construction
Properties
MaximizeAxes
3-75
dsp.ArrayPlot
3-76
dsp.ArrayPlot
When you set this property to 'Stem' , the scope displays the
input signal as circles with vertical lines extending down to the
x-axis at each of the sampled values . This approach is similar
to the functionality of the MATLAB stem function.
When you set this property to 'Line' , the scope displays the
input signal as lines connecting each of the sampled values.
This approach is similar to the functionality of the MATLAB
line or plot function.
When you set this property to 'Stairs', the scope displays the
input signal as a stairstep graph. A stairstep graph is made up
of only horizontal lines and vertical lines. Each horizontal line
represents the signal value for a discrete sample period and is
connected to two vertical lines. Each vertical line represents
a change in values occurring at a sample. This approach is
equivalent to the MATLAB stairs function. Stairstep graphs
are useful for drawing time history graphs of digitally sampled
data.
This property is Tunable.
Default: 'Stem'
Position
3-77
dsp.ArrayPlot
Source of legend
When you set this property to true, the scope displays a legend
with automatic string labels for each input channel. When you set
this property to false, the scope does not display a legend. This
property applies only when you set the SpectrumType property to
'Power' or 'Power density'. This property is Tunable.
Default: false
SampleIncrement
3-78
dsp.ArrayPlot
Display title
Specify the display title as a string. Enter %<SignalLabel> to use
the signal labels in the Simulink Model as the axes titles. This
property is Tunable.
Default: ''
XLabel
3-79
dsp.ArrayPlot
YLimits
Methods
Examples
clone
getNumInputs
getNumOutputs
hide
isLocked
release
reset
show
step
The following examples illustrate how to use the Array Plot object to
view a variety of input signals.
3-80
dsp.ArrayPlot
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(h);
Create and configure an audio file reader System object to read the
input signal from the specified audio file.
hsigsource = dsp.AudioFileReader('dspafxf_8000.wav',
'SamplesPerFrame', 40, ...
'PlayCount', Inf,...
...
3-81
dsp.ArrayPlot
'OutputDataType', 'double');
Plot the LMS filter weights as they adapt to a desired signal. Read from
the audio file, produce random data, and filter the random data. Call
the step method to update the filter weights and plot the filter weights
after each step.
numplays = 0;
while numplays < 3
[y, eof]
= step(hsigsource);
noise
= rand(40,1);
noisefilt
= step(hfilt, noise);
desired
= y + noisefilt;
[~, ~, wts] = step(hlms, noise, desired);
step(harrayplot, wts);
numplays = numplays + eof;
end
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(harrayplot);
3-82
dsp.ArrayPlot
Signal
Display
3-83
dsp.ArrayPlot
Indicators
Minimum x-axis limit Array Plot sets the minimum x-axis limit
using the value of the X-offset parameter on the Main tab of the
VisualsArray Plot Properties dialog box.
Maximum x-axis limit Array Plot sets the maximum x-axis limit
by summing the value of X-offset parameter with the span of x-axis
3-84
dsp.ArrayPlot
Processing Occurs after you run the step method and before
you run the release method.
Stopped Occurs after you construct the scope object and before
you first run the step method. This status also occurs after you
run the release method.
By default, if the input signal has multiple channels, the scope uses an
index number to identify each channel of that signal. For example,
a 2-channel signal would have the following default names in the
channel legend: Channel 1, Channel 2. To show the legend, select
View > Configuration Properties, click the Display tab, and select
the Show Legend check box. If there are a total of 7 input channels,
the following legend appears in the display.
By default, the scope has a black axes background and chooses line
colors for each channel in a manner similar to the Simulink Scope block.
3-85
dsp.ArrayPlot
Toolbar
ShortcutDescription
Keys
Ctrl+P Print the current scope window.
To print the current scope window to
a figure rather than sending it to your
printer, select File > Print to figure.
3-86
dsp.ArrayPlot
ShortcutDescription
Keys
Tools >
Zoom In
N/A
Tools >
Zoom X
N/A
Tools >
Zoom Y
N/A
3-87
dsp.ArrayPlot
ButtonMenu
Location
ShortcutDescription
Keys
Tools >
Pan
N/A
Tools >
Scale
Y-Axes
Limits
3-88
dsp.ArrayPlot
ButtonMenu
Location
Tools >
Scale X-Axis
Limits
ShortcutDescription
Keys
N/A
Tools >
Scale X
and Y Axes
Limits
N/A
3-89
dsp.ArrayPlot
ButtonMenu
Location
ShortcutDescription
Keys
one of the following options from the
Tools menu:
Automatically Scale Axes
Limits When you select this
option, the scope scales the axes as
needed during simulation.
Scale Axes Limits after 10
Updates When you select this
option, the scope scales the axes
after 10 updates. The scope does
not scale the axes again during the
simulation.
Scale Axes Limits at Stop
When you select this option, the
scope scales the axes each time the
simulation is stopped.
Measurements Buttons
3-90
Tools >
N/A
Measurements >
Cursor
Measurements
Tools >
N/A
Measurements >
Signal
Statistics
dsp.ArrayPlot
Note The zoom buttons do not change the settings related to span for
the scope. These buttons are purely graphical.
You can control whether this toolbar appears in the Array Plot window.
From the menu, select View > Toolbar.
Measurements The Measurements panels are the panels that appear to the right side
of the Array Plot figure. These panels are labeled Trace selection,
Panels
Cursor Measurements, Signal Statistics, and Peak Finder.
3-91
dsp.ArrayPlot
Button Description
Move the current panel to the top. When you are displaying
more than one panel, this action moves the current panel
above all the other panels.
3-92
dsp.ArrayPlot
You can choose to hide or display the Trace Selection panel. In the
Scope menu, select Tools > Measurements > Trace Selection.
3-93
dsp.ArrayPlot
3-94
dsp.ArrayPlot
Lock Cursor Spacing Locks the time difference between the two
cursors.
Measurements Pane
The Measurements pane shows the time and value measurements.
1 | Shows or enables you to modify the time or value at cursor
number one, or both.
2 : Shows or enables you to modify the time or value at cursor
number two, or both.
X Shows the absolute value of the difference in thex-axis values
between cursor number one and cursor number two.
V Shows the absolute value of the difference in the y-axis values,
or signal amplitudes, between cursor number one and cursor number
two.
1/X Shows the rate, the reciprocal of the absolute value of the
difference in the x-axis values between cursor number one and cursor
number two.
V/X Shows the slope, the ratio of the absolute value of the
difference in the y-axis values between cursors to the absolute value
of the difference in the x-axis values between cursors.
button.
3-95
dsp.ArrayPlot
3-96
dsp.ArrayPlot
Name
Multiplier
atto
10^-18
femto
10^-15
pico
10^12
nano
10^-9
micro
10^-6
milli
10^-3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
3-97
dsp.ArrayPlot
Abbreviation
Name
Multiplier
peta
10^15
exa
10^18
button.
The Peak finder panel is separated into two panes, labeled Settings
and Peaks. You can expand each pane to see the available options.
Settings Pane
The Settings pane enables you to modify the parameters used to
calculate the peak values within the displayed portion of the input
signal. For more information on the algorithms this pane uses, see the
Signal Processing Toolbox findpeaks function reference.
3-98
dsp.ArrayPlot
Peak Threshold The level above which peaks are detected. This
setting is equivalent to the MINPEAKHEIGHT parameter, which you can
set when you run the findpeaks function.
Max Num of Peaks The maximum number of peaks to show. The
value you enter must be a scalar integer between 1 and 99. This
setting is equivalent to the NPEAKS parameter, which you can set
when you run the findpeaks function.
Min Peaks Distance The minimum number of samples between
adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE
parameter, which you can set when you run the findpeaks function.
Peak Excursion The minimum height difference between a peak
and its neighboring samples. Peak excursion is illustrated alongside
peak threshold in the following figure.
3-99
dsp.ArrayPlot
Peaks Pane
The Peaks pane displays all of the largest calculated peak values.
It also shows the coordinates at which the peaks occur, using the
parameters you define in the Settings pane. You set the Max Num of
Peaks parameter to specify the number of peaks shown in the list.
3-100
dsp.ArrayPlot
similar to the locs output argument returned when you run the
findpeaks function.
The Peak Finder displays the peak values in the Peaks pane. By
default, the Peak Finder panel displays the largest calculated peak
values in the Peaks pane in decreasing order of peak height. Use the
sort descending button (
) to rearrange the category and order by
which Peak Finder displays peak values. Click this button again to
sort the peaks in ascending order instead. When you do so, the arrow
). A filled
changes direction to become the sort ascending button (
sort button indicates that the peak values are currently sorted in the
direction of the button arrow. If the sort button is not filled (
),
then the peak values are sorted in the opposite direction of the button
arrow. The Max Num of Peaks parameter still controls the number
of peaks listed.
Use the check boxes to control which peak values are shown on the
display. By default, all check boxes are cleared and the Peak Finder
panel hides all the peak values. To show all the peak values on the
display, select the check box in the top-left corner of the Peaks pane.
To hide all the peak values on the display, clear this check box. To
show an individual peak, select the check box directly to the left of its
Value listing. To hide an individual peak, clear the check box directly
to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the
value associated with each measurement indicates the abbreviation for
the appropriate International System of Units (SI) prefix, such as m for
milli-. For example, if the input signal is measured in volts, an m next
to a measurement value indicates that this value is in units of millivolts.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
3-101
dsp.ArrayPlot
Abbreviation
Name
Multiplier
nano
10^9
micro
10^6
milli
10^3
10^0
Visuals
Array Plot
Properties
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
Main Pane
The Main pane of the VisualsArray Plot Properties dialog box
appears as follows.
3-102
dsp.ArrayPlot
X-offset
3-103
dsp.ArrayPlot
Display Pane
The Display pane of the VisualsArray Plot Properties dialog box
appears as follows.
Title
Select this check box to show the legend in the display. The channel
legend displays a name for each channel of each input signal. When
the legend appears, you can place it anywhere inside of the scope
window. To turn the legend off, clear the Show legend check box.
This parameter applies only when the Spectrum Type is Power or
Power density. Tunable
You can edit the name of any channel in the legend. To do so,
double-click the current name, and enter a new channel name. By
default, if the signal has multiple channels, the scope uses an index
3-104
dsp.ArrayPlot
When you select this check box, a grid appears in the display of the
scope figure. To hide the grid, clear this check box. Tunable
Plot signals as magnitude and phase
When you select this check box, the scope splits the display into a
magnitude plot and a phase plot. By default, this check box is cleared.
If the input signal is complex valued, the scope plots the real and
imaginary portions on the same axes. These real and imaginary
portions appear as different-colored lines on the same axes, as shown in
the following figure.
Selecting this check box and clicking the Apply or OK button changes
the display. The magnitude of the input signal appears on the top
axes and its phase, in degrees, appears on the bottom axes. See the
following figure.
3-105
dsp.ArrayPlot
Specify as a string the text for the scope to display below the x-axis.
This property is Tunable.
Y-label
Specify as a string the text for the scope to display to the left of the
y-axis. Tunable
Y-limits (Minimum)
Style
Dialog
Box
3-106
In the Style dialog box, you can customize the style of displays. You
are able to change the color of the figure containing the displays, the
background and foreground colors of display axes, and properties of
lines in a display. From the scope menu, select View > Style to open
this dialog box.
dsp.ArrayPlot
Properties
The Style dialog box allows you to modify the following properties of
the scope figure:
Figure color
Specify the color that you want to apply to the background of the scope
figure. By default, the figure color is gray.
Plot type
Specify the type of plot to use for all the input signals displayed in the
scope window.
When you set this property to 'Stem' , the scope displays the input
signal as circles with vertical lines extending down to the x-axis
at each of the sampled values . This approach is similar to the
functionality of the MATLAB stem function.
When you set this property to 'Line' , the scope displays the input
signal as lines connecting each of the sampled values. This approach
is similar to the functionality of the MATLAB line or plot function.
3-107
dsp.ArrayPlot
When you set this property to 'Stairs', the scope displays the input
signal as a stairstep graph. A stairstep graph is made up of only
horizontal lines and vertical lines. Each horizontal line represents
the signal value for a discrete sample period and is connected to
two vertical lines. Each vertical line represents a change in values
occurring at a sample. This approach is equivalent to the MATLAB
stairs function. Stairstep graphs are useful for drawing time history
graphs of digitally sampled data.
This property is Tunable.
The default setting is Stem.
Axes colors
Specify the color that you want to apply to the background of the axes.
Properties for line
Specify the channel for which you want to modify the visibility, line
properties, and marker properties.
Visible
Specify the line style, line width, and line color for the selected channel.
Marker
Specify marks for the selected channel to show at its data points. This
parameter is similar to the Marker property for the MATLAB Handle
Graphics plot objects. You can choose any of the marker symbols from
the following table.
3-108
dsp.ArrayPlot
Specifier
Marker Type
none
No marker (default)
Circle
Square
Cross
Point
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)
3-109
dsp.ArrayPlot
Tools
Plot
Navigation
Properties
Properties
The ToolsPlot Navigation Properties dialog box appears as follows.
Axes Scaling
Specify when the scope should automatically scale the axes. You can
select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes. You can manually scale the axes in
any of the following ways:
3-110
dsp.ArrayPlot
Auto When you select this option, the scope scales the axes as
needed, both during and after simulation. Selecting this option shows
the Do not allow Y-axis limits to shrink check box.
After N Updates Selecting this option causes the scope to scale
the axes after a specified number of updates. Selecting this option
shows the Number of updates edit box.
By default, this property is set to Auto. This property is Tunable.
By default, this parameter is set to Manual.
Do not allow Y-axis limits to shrink
When you select this property, the y-axis is allowed only to grow during
axes scaling operations. If you clear this check box, the y-axis or color
limits may shrink during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
property. When you set the Axes scaling property to Manual or After
N Updates, the y-axis or color limits are allowed to shrink. Tunable.
Number of updates
Select this check box to scale the axes when the simulation stops. The
y-axis is always scaled. The x-axis limits are only scaled if you also
select the Scale X-axis limits check box.
Y-axis Data range (%)
Set the percentage of the y-axis that the scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the y-axis
limits such that your data uses the entire y-axis range. If you then set
this property to 30, the scope increases the y-axis range such that your
data uses only 30% of the y-axis range. Tunable.
3-111
dsp.ArrayPlot
Y-axis Align
Specify where the scope should align your data with respect to the y-axis
when it scales the axes. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
See Also
3-112
dsp.ArrayPlot.clone
Purpose
Syntax
C = clone(H)
Description
states.
3-113
dsp.ArrayPlot.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-114
dsp.ArrayPlot.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-115
dsp.ArrayPlot.hide
Purpose
Syntax
hide(H)
Description
See Also
dsp.ArrayPlot.show
3-116
dsp.ArrayPlot.isLocked
Purpose
Syntax
isLocked(H)
Description
3-117
dsp.ArrayPlot.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
You should call the release method after calling the step method when
there is no new data for the simulation. When you call the release
method, the axes will automatically scale in the scope figure window.
After calling the release method, any non-tunable properties can be
set once again.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
Algorithms
See Also
dsp.ArrayPlot.reset
3-118
dsp.ArrayPlot.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the internal states of the scope object H to their initial
values.
You should call the reset method after calling the step method when
you want to clear the scope figure displays, prior to releasing system
resources. This action enables you to start a simulation from the
beginning. When you call the reset method, the displays will become
blank again. In this sense, its functionality is similar to that of the
MATLAB clf function. Do not call the reset method after calling the
release method.
Algorithms
See Also
dsp.ArrayPlot | dsp.ArrayPlot.release
3-119
dsp.ArrayPlot.show
Purpose
Syntax
show(H)
Description
See Also
3-120
visible.
dsp.ArrayPlot.hide
dsp.ArrayPlot.step
Purpose
Syntax
step(H,X)
step(H,X1,X2,...,XN)
Description
3-121
dsp.ArrayVectorAdder
Purpose
Description
Construction
Properties
Dimension
Source of vector
Specify the source of the vector values as |Input port | Property
|. The default is Input port.
Vector
Vector values
3-122
dsp.ArrayVectorAdder
Specify the vector values. This property applies only when you
set the VectorSource property to Property. The default is [0.5
0.25]. This property is tunable.
Fixed-Point Properties
FullPrecisionOverride
3-123
dsp.ArrayVectorAdder
3-124
dsp.ArrayVectorAdder
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Add 2-by-1 vector to 2-by-2 matrix along the first dimension of the array.
hava = dsp.ArrayVectorAdder;
a = ones(2);
x = [1 2]';
y = step(hava, a, x);
Algorithms
See Also
dsp.ArrayVectorMultiplier | dsp.ArrayVectorDivider |
dsp.ArrayVectorSubtractor
3-125
dsp.ArrayVectorAdder.clone
Purpose
Syntax
C = clone(H)
Description
3-126
dsp.ArrayVectorAdder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-127
dsp.ArrayVectorAdder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-128
dsp.ArrayVectorAdder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-129
dsp.ArrayVectorAdder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-130
dsp.ArrayVectorAdder.step
Purpose
Syntax
Y = step(H,A)
Y = step(H,A,V)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-131
dsp.ArrayVectorDivider
Purpose
Description
Construction
Properties
Dimension
Source of vector
Specify the source of the vector values as | Input port |
Property |. The default is Input port.
Vector
Vector values
3-132
dsp.ArrayVectorDivider
Specify the vector values. This property applies when you set the
VectorSource property to Property. The default is [0.5 0.25].
This property is tunable.
Fixed-Point Properties
RoundingMethod
3-133
dsp.ArrayVectorDivider
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
3-134
dsp.ArrayVectorDivider
See Also
dsp.ArrayVectorMultiplier | dsp.ArrayVectorAdder |
dsp.ArrayVectorSubtractor
3-135
dsp.ArrayVectorDivider.clone
Purpose
Syntax
C = clone(H)
Description
3-136
dsp.ArrayVectorDivider.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-137
dsp.ArrayVectorDivider.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-138
dsp.ArrayVectorDivider.isLocked
Purpose
Syntax
isLocked(H)
Description
3-139
dsp.ArrayVectorDivider.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-140
dsp.ArrayVectorDivider.step
Purpose
Syntax
Y = step(H,A,V)
Y = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-141
dsp.ArrayVectorMultiplier
Purpose
Description
Construction
Properties
Dimension
Source of vector
Specify the source of the vector values as one of Input port or
Property. The default is Input port.
Vector
3-142
dsp.ArrayVectorMultiplier
3-143
dsp.ArrayVectorMultiplier
3-144
dsp.ArrayVectorMultiplier
Methods
Examples
clone
Create array-vector
multiplication object with
same property values
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
See Also
dsp.ArrayVectorAdder | dsp.ArrayVectorDivider |
dsp.ArrayVectorSubtractor
3-145
dsp.ArrayVectorMultiplier.clone
Purpose
Syntax
C = clone(H)
Description
object.
3-146
dsp.ArrayVectorMultiplier.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-147
dsp.ArrayVectorMultiplier.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-148
dsp.ArrayVectorMultiplier.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-149
dsp.ArrayVectorMultiplier.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-150
dsp.ArrayVectorMultiplier.step
Purpose
Syntax
Y = step(H,A,V)
Y = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-151
dsp.ArrayVectorSubtractor
Purpose
Description
Construction
Properties
Dimension
Source of vector
Specify the source of the vector values as one of Input port or
Property. The default is Input port.
Vector
Vector values
3-152
dsp.ArrayVectorSubtractor
Specify the vector values. This property applies when you set the
VectorSource property to Property. The default is [0.5 0.25].
This property is tunable.
Fixed-Point Properties
FullPrecisionOverride
3-153
dsp.ArrayVectorSubtractor
3-154
dsp.ArrayVectorSubtractor
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
See Also
dsp.ArrayVectorMultiplier | dsp.ArrayVectorDivider |
dsp.ArrayVectorAdder
3-155
dsp.ArrayVectorSubtractor.clone
Purpose
Syntax
C = clone(H)
Description
object.
3-156
dsp.ArrayVectorSubtractor.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-157
dsp.ArrayVectorSubtractor.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-158
dsp.ArrayVectorSubtractor.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-159
dsp.ArrayVectorSubtractor.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-160
dsp.ArrayVectorSubtractor.step
Purpose
Syntax
Y = step(H,A,V)
Y = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-161
dsp.AudioFileReader
Purpose
Description
on page 3-162.
2 Call step to read audio samples according to the properties of
in the toolbox.
Construction
Properties
Filename
3-162
dsp.AudioFileReader
Specify the name of an audio file as a string. Specify the full path
for the file only if the file is not on the MATLAB path. The default
is speech_dft.mp3.
PlayCount
Methods
clone
getNumInputs
getNumOutputs
info
3-163
dsp.AudioFileReader
Examples
isDone
isLocked
release
reset
step
Read and play back an audio file using the standard audio output device.
hmfr = dsp.AudioFileReader('speech_dft.mp3');
hap = dsp.AudioPlayer('SampleRate', hmfr.SampleRate);
while ~isDone(hmfr)
audio = step(hmfr);
step(hap, audio);
end
release(hmfr); % release the input file
release(hap); % release the audio output device
3-164
dsp.AudioFileReader
Algorithms
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
3-165
dsp.AudioFileReader
The object has no corresponding property for the Image signal block
parameter.
The object has no corresponding property for the Output color
format parameter.
The object has no corresponding property for the Video output data
type parameter.
See Also
3-166
dsp.AudioFileWriter
dsp.AudioFileReader.clone
Purpose
Syntax
C = clone(H)
Description
3-167
dsp.AudioFileReader.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
method.
The getNumInputs method returns a positive integer that is the number
of expected inputs (not counting the object itself) to the step method.
This value will change if you alter any properties that turn inputs on or
off. You must call the step method with the number of input arguments
equal to the result of getNumInputs(H).
3-168
dsp.AudioFileReader.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-169
dsp.AudioFileReader.info
Purpose
Syntax
S = info(H)
Description
Field
Value
SampleRate
NumBits
3-170
dsp.AudioFileReader.isDone
Purpose
Syntax
STATUS = isDone(H)
Description
3-171
dsp.AudioFileReader.isLocked
Purpose
Syntax
y = isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-172
dsp.AudioFileReader.reset
Purpose
Reset internal states of audio file reader to read from beginning of file
Syntax
reset(H)
Description
of the file.
3-173
dsp.AudioFileReader.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-174
dsp.AudioFileReader.step
Purpose
Syntax
AUDIO = step(H)
[AUDIO,EOF] = step(H)
Description
property. After playing the file for the number of times you specify,
AUDIO contains silence.
[AUDIO,EOF] = step(H) returns an end-of-file indicator, EOF. EOF is
true each time the output AUDIO contains the last audio sample in the
file.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-175
dsp.AudioFileWriter
Purpose
Description
on page 3-176.
2 Call step to write audio samples according to the properties of
in the toolbox.
Construction
Mac OS X
3-176
dsp.AudioFileWriter
Windows 7
Mac OS X
Properties
Filename
3-177
dsp.AudioFileWriter
MPEG4: MPEG-4 AAC File You can use both .m4a and .mp4
extensions
The default is WAV.
SampleRate
Methods
3-178
clone
getNumInputs
dsp.AudioFileWriter
Examples
getNumOutputs
isLocked
release
step
3-179
dsp.AudioFileWriter
Algorithms
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%
set PATH =
$MATLABROOT\bin\win64;%PATH%
3-180
dsp.AudioFileWriter
The object has no corresponding property for the File color format
parameter.
The object has no corresponding property for the Image signal
parameter.
See Also
dsp.AudioFileReader
3-181
dsp.AudioFileWriter.clone
Purpose
Syntax
C = clone(H)
Description
object.
3-182
dsp.AudioFileWriter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-183
dsp.AudioFileWriter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-184
dsp.AudioFileWriter.isLocked
Purpose
Syntax
isLocked(H)
Description
object H.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-185
dsp.AudioFileWriter.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-186
dsp.AudioFileWriter.step
Purpose
Syntax
step(H,AUDIO)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-187
dsp.AudioPlayer
Purpose
Description
The AudioPlayer object plays audio data using the computers audio
device.
To play audio data using the computers audio device:
1 Define and set up your audio player object. See Construction on
page 3-188.
2 Call step to play audio data according to the properties of
in the toolbox.
This System object buffers the data from the audio device using the
process illustrated by the following figure.
Data from
MATLAB
2xBufferSize
Construction
value.
H =
dsp.AudioPlayer(SAMPLERATE,'PropertyName',PropertyValue,
3-188
dsp.AudioPlayer
Properties
DeviceName
3-189
dsp.AudioPlayer
Buffer size
Specify the size of the buffer that the audio player object uses to
communicate with the audio device as an integer. BufferSize is
half the size of the sound card buffer. A frame of data cannot be
passed to the queue until the device empties the buffer, which
introduces latency. Latency is the time it takes the device to
empty the queue and the buffer. BufferSize has to be smaller
than the effective queue duration. This property is tunable.
Tuning this property involves a balance between device latency
and the possibility of dropping data (buffer underrun). This
property applies when you set the BufferSizeSource property to
Property. The default is 4096. To set the BufferSize to a value
other than the default, first change the BufferSizeSource to
'Property'. You can select BufferSize in the list of properties.
QueueDuration
3-190
dsp.AudioPlayer
Methods
clone
getNumInputs
getNumOutputs
3-191
dsp.AudioPlayer
Examples
isLocked
release
step
Read in an AVI audio file, and play the file back using the standard
audio output device:
hafr = dsp.AudioFileReader;
hap = dsp.AudioPlayer('SampleRate',22050);
while ~isDone(hafr)
audio = step(hafr);
step(hap,audio);
end
pause(hap.QueueDuration);
3-192
dsp.AudioPlayer
Platform
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%set
PATH =
$MATLABROOT\bin\win64;%PATH%
Algorithms
See Also
dsp.AudioFileReader | dsp.AudioRecorder
How To
3-193
dsp.AudioPlayer.clone
Purpose
Syntax
C = clone(H)
Description
3-194
dsp.AudioPlayer.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-195
dsp.AudioPlayer.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-196
dsp.AudioPlayer.isLocked
Purpose
Syntax
isLocked(H)
Description
3-197
dsp.AudioPlayer.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-198
dsp.AudioPlayer.step
Purpose
Syntax
Y = step(H,AUDIO)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-199
dsp.AudioRecorder
Purpose
Description
on page 3-200.
2 Call step to record audio data according to the properties of
in the toolbox.
This System object buffers the data from a frame of data using the
process illustrated by the following figure.
Data to
MATLAB
2xBufferSize
Construction
specified value.
3-200
dsp.AudioRecorder
Properties
DeviceName
Buffer size
3-201
dsp.AudioRecorder
3-202
dsp.AudioRecorder
3-203
dsp.AudioRecorder
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Record ten seconds of speech from a microphone, and send the output to
a .wav file:
har = dsp.AudioRecorder;
hmfw = dsp.AudioFileWriter('myspeech.wav','FileFormat','WAV');
disp('Speak into microphone now');
tic;
while toc < 10,
step(hmfw, step(har));
end
release(har);
3-204
dsp.AudioRecorder
release(hmfw);
disp('Recording complete');
Command
Mac
setenv DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(csh/tcsh)export
DYLD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/maci64
(Bash)
Linux
setenv LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(csh/tcsh)export
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:
$MATLABROOT/bin/glnxa64
(Bash)
Windows
set PATH =
$MATLABROOT\bin\win32;%PATH%set
PATH =
$MATLABROOT\bin\win64;%PATH%
Algorithms
See Also
dsp.AudioFileReader | dsp.AudioPlayer
3-205
dsp.AudioRecorder
How To
3-206
dsp.AudioRecorder.clone
Purpose
Syntax
clone(H)
Description
3-207
dsp.AudioRecorder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-208
dsp.AudioRecorder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-209
dsp.AudioRecorder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-210
dsp.AudioRecorder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-211
dsp.AudioRecorder.step
Purpose
Syntax
AUDIO = step(H)
Description
AUDIO = step(H) reads one frame of audio samples from the selected
audio input device.
3-212
dsp.Autocorrelator
Purpose
Autocorrelation sequence
Description
3-213.
2 Call step to compute the autocorrelation sequence according to the
Construction
value.
Properties
MaximumLagSource
3-213
dsp.Autocorrelator
3-214
dsp.Autocorrelator
3-215
dsp.Autocorrelator
3-216
dsp.Autocorrelator
Methods
Definitions
clone
getNumInputs
getNumOutputs
isLocked
release
step
Autocorrelation sequence
3-217
dsp.Autocorrelator
rx (h) =
N h1
x* (n) x(n + h)
h = 0, 1,, N 1
n =0
where h is the lag and * denotes the complex conjugate. If the input is
a length N realization of a WSS stationary random process, rx(h) is an
estimate of the theoretical autocorrelation:
x (h) =
Examples
1
N
N h1
x* (n) x(n + h)
k =0
3-218
dsp.Autocorrelator
MaxLag = 20;
H = dsp.Autocorrelator('MaximumLagSource',...
'Property','MaximumLag',MaxLag,'Scaling','Unity at zero-lag');
SigAutocorr = step(H,x);
stem(SigAutocorr,'b','markerfacecolor',[0 0 1]);
line(1:MaxLag+1,1.96/sqrt(100)*ones(MaxLag+1,1),...
'linestyle','-.','linewidth',2);
line(1:MaxLag+1,-1.96/sqrt(100)*ones(MaxLag+1,1),...
'linestyle','-.','linewidth',2);
axis([1 20 -1 1]);
title('Sine Wave + Noise Autocorrelation'); xlabel('Lag');
3-219
dsp.Autocorrelator
3-220
dsp.Autocorrelator
Algorithms
See Also
dsp.Crosscorrelator
3-221
dsp.Autocorrelator.clone
Purpose
Syntax
C = clone(H)
Description
3-222
dsp.Autocorrelator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-223
dsp.Autocorrelator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-224
dsp.Autocorrelator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-225
dsp.Autocorrelator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-226
dsp.Autocorrelator.step
Purpose
Autocorrelation sequence
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-227
dsp.BiquadFilter
Purpose
Description
on page 3-228.
2 Call step to implement the IIR filter according to the properties of
in the toolbox.
Construction
specified value.
Properties
Structure
Filter structure
Specify the filter structure as one of | Direct form I | Direct
form I transposed | Direct form II | Direct form II
transposed |. The default is Direct form II transposed.
SOSMatrixSource
SOS matrix
3-228
dsp.BiquadFilter
bk zk
H ( z) =
k =0
2
1 al z l
l =1
The coefficients are ordered in the rows of the SOS matrix as (b0,
b1,b2,1, a1, a2). You can use coefficients of real or complex values.
This property applies only when you set the SOSMatrixSource
property to Property. The leading denominator coefficient of the
biquad filter, a0, equals 1 for each filter section, regardless of the
specified value.
ScaleValues
3-229
dsp.BiquadFilter
3-230
dsp.BiquadFilter
3-231
dsp.BiquadFilter
3-232
dsp.BiquadFilter
OverflowAction
3-233
dsp.BiquadFilter
3-234
dsp.BiquadFilter
3-235
dsp.BiquadFilter
CustomDenominatorCoefficientsDataType, and
CustomScaleValuesDataType properties must have the same
word lengths. The default is numerictype([],16,15).
NumeratorProductDataType
3-236
dsp.BiquadFilter
NumeratorAccumulatorDataType
3-237
dsp.BiquadFilter
3-238
dsp.BiquadFilter
Methods
clone
freqz
Frequency response
fvtool
3-239
dsp.BiquadFilter
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
3-240
dsp.BiquadFilter
'OverlapPercent', 80,'PowerUnits','dBW',...
'YLimits', [-160 -10]);
while ~isDone(hFromWS)
input = step(hFromWS);
filteredOutput = step(hBqF,input);
step(hLog,filteredOutput);
step(h,filteredOutput)
end
filteredResult = hLog.Buffer;
fvtool(hBqF,'Fs',8000)
3-241
dsp.BiquadFilter
3-242
dsp.BiquadFilter
Design and apply a lowpass biquad filter System object using design.
3-243
dsp.BiquadFilter
Hd = fdesign.lowpass('Fp,Fst,Ap,Ast',500,550,0.5,60,10000);
D = design(Hd,'butter','systemobject',true)
fvtool(D);
D =
System: dsp.BiquadFilter
Properties:
Structure:
SOSMatrixSource:
SOSMatrix:
ScaleValues:
InitialConditions:
OptimizeUnityScaleValues:
FrameBasedProcessing:
3-244
dsp.BiquadFilter
3-245
dsp.BiquadFilter
Algorithm
See Also
3-246
dsp.DigitalFilter
dsp.BiquadFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-247
dsp.BiquadFilter.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-248
dsp.BiquadFilter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-249
dsp.BiquadFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-250
dsp.BiquadFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-251
dsp.BiquadFilter.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-252
dsp.BiquadFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-253
dsp.BiquadFilter.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-254
dsp.BiquadFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-255
dsp.BiquadFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the biquad filter object,H, to the
specified initial conditions. After the step method applies the biquad
filter object to nonzero input data, the states may change. Invoking
the step method again without first invoking the reset method may
produce different outputs for an identical input.
Example of resetting filter states:
n =0:20;
x = cos(pi/4*n)+sin(pi/2*n);
H = dsp.BiquadFilter;
y = step(H,x');
% Apply step method without invoking reset
y1 = step(H,x');
isequal(y,y1) % Returns a 0
% Reset filter states to zero
reset(H)
% Now invoke step method
y2 = step(H,x');
isequal(y,y2) % Returns a 1
3-256
dsp.BiquadFilter.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,NUM,DEN)
Y = step(H,X,NUM,DEN,G)
Description
3-257
dsp.BlockLMSFilter
Purpose
Description
page 3-258.
2 Call step to compute the output, error, and weights according to the
Construction
the input signal and computes filter weights based on the Block Least
Mean Squares (LMS) algorithm.
H=dsp.BlockLMSFilter('PropertyName',PropertyValue,...)
returns an adaptive FIR filter, H, with each specified property set to
Properties
Length
3-258
dsp.BlockLMSFilter
StepSizeSource
3-259
dsp.BlockLMSFilter
WeightsResetInputPort
Methods
3-260
clone
getNumInputs
getNumOutputs
isLocked
dsp.BlockLMSFilter
Examples
msepred
msesim
release
reset
step
Algorithms
See Also
dsp.LMSFilter | dsp.DigitalFilter
3-261
dsp.BlockLMSFilter.msepred
Purpose
Syntax
[MMSE,EMSE] = msepred(H,X,D)
[MMSE,EMSE,MEANW,MSE,TRACEK] = msepred(H,X,D)
[MMSE,EMSE,MEANW,MSE,TRACEK] = msepred(H,X,D,M)
Description
3-262
dsp.BlockLMSFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-263
dsp.BlockLMSFilter.msesim
l = 32;
mu = 0.008;
m = 32;
% Filter length
% Block LMS Step size.
% Decimation factor for analysis
% and simulation results
ha = dsp.BlockLMSFilter(l,'StepSize',mu);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('Iteration'); ylabel('MSE (dB)');
title('Learning curve for Block LMS filter used in system identification'
3-264
dsp.BlockLMSFilter.clone
Purpose
Create adaptive block LMS filter object with same property values
Syntax
C = clone(H)
Description
3-265
dsp.BlockLMSFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-266
dsp.BlockLMSFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-267
dsp.BlockLMSFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-268
dsp.BlockLMSFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-269
dsp.BlockLMSFilter.reset
Purpose
Syntax
reset(H)
Description
3-270
dsp.BlockLMSFilter.step
Purpose
Syntax
[Y,ERR,WTS] = step(H,X,D)
[Y,ERR] = step(H,X,D)
[...] = step(H,X,D,MU)
[...] = step(H,X,D,A)
[...] = step(H,X,D,R)
[Y,ERR,WTS] = step(H,X,D,MU,A,R)
Description
3-271
dsp.BlockLMSFilter.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-272
dsp.Buffer
Purpose
Description
The Buffer object buffers an input signal. The number of samples per
channel in the input must equal the difference between the output
buffer size and buffer overlap (i.e., Length - OverlapLength). When
you set FrameBasedProcessing to true, the number of samples
per channel equals the number of rows in the input. If you set
FrameBasedProcessing to false, the number of samples per channel
equals 1.
To buffer an input signal:
1 Define and set up your buffer System object. See Construction on
page 3-273.
2 Call step to buffer the input according to the properties of
toolbox.
Construction
values.
Properties
Length
3-273
dsp.Buffer
OverlapLength
Initial output
Specify the value of the objects initial output for cases of nonzero
latency as a scalar, vector, or matrix. The default is 0.
FrameBasedProcessing
Methods
3-274
clone
getNumInputs
getNumOutputs
isLocked
release
dsp.Buffer
Examples
reset
step
Algorithms
See Also
dsp.DelayLine | dsp.Delay
3-275
dsp.Buffer.clone
Purpose
Syntax
C=clone(H)
Description
values as H.
The clone method creates a new unlocked object.
3-276
dsp.Buffer.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-277
dsp.Buffer.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-278
dsp.Buffer.isLocked
Purpose
Syntax
isLocked(H)
Description
3-279
dsp.Buffer.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-280
dsp.Buffer.reset
Purpose
Syntax
reset(H)
Description
For many System objects, this method is a no-op. Objects that have
internal states will describe in their help what the reset method does
for that object.
The reset method is always a no-op for unlocked System objects, as the
states may not be allocated when the object is not locked.
3-281
dsp.Buffer.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-282
dsp.BurgAREstimator
Purpose
Description
3-283.
2 Call step to compute the estimate according to the properties of
in the toolbox.
Construction
Properties
AOutputPort
3-283
dsp.BurgAREstimator
Order of AR model
Set the AR model estimation order to a real positive integer. This
property applies when you set the EstimationOrderSource to
Property. The default is 4.
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-284
dsp.BurgAREstimator
3-285
dsp.BurgAREstimator
Algorithms
See Also
3-286
dsp.LevinsonSolver
dsp.BurgAREstimator.clone
Purpose
Syntax
C = clone(H)
Description
3-287
dsp.BurgAREstimator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-288
dsp.BurgAREstimator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-289
dsp.BurgAREstimator.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-290
dsp.BurgAREstimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-291
dsp.BurgAREstimator.step
Purpose
Syntax
[A,G] = step(H,X)
[K,G] = step(H,X)
[A,K,G] = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-292
dsp.BurgSpectrumEstimator
Purpose
Description
3-293.
2 Call step to compute the estimate according to the properties of
Construction
the power spectral density (PSD) of the input frame using the Burg
method.
H =
dsp.BurgSpectrumEstimator('PropertyName',PropertyValue,...)
returns a spectrum estimator, H, with each specified property set to
Properties
EstimationOrderSource
Order of AR model
3-293
dsp.BurgSpectrumEstimator
Methods
3-294
clone
getNumInputs
getNumOutputs
isLocked
dsp.BurgSpectrumEstimator
Examples
release
step
=
=
=
=
randn(100,1);
dsp.BurgSpectrumEstimator('EstimationOrder', 4);
filter(1,[1 1/2 1/3 1/4 1/5],x); % Fourth order AR filter
step(h,y); % Uses default FFT length of 256
plot([0:255]/256, p);
title('Burg Method Spectral Density Estimate');
xlabel('Normalized frequency'); ylabel('Power/frequency');
Algorithms
See Also
dsp.BurgAREstimator | dsp.LevinsonSolver
3-295
dsp.BurgSpectrumEstimator.clone
Purpose
Syntax
C = clone(H)
Description
3-296
dsp.BurgSpectrumEstimator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-297
dsp.BurgSpectrumEstimator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-298
dsp.BurgSpectrumEstimator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-299
dsp.BurgSpectrumEstimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-300
dsp.BurgSpectrumEstimator.step
Purpose
Syntax
Y = step(H,X)
Description
Burg method.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-301
dsp.CepstralToLPC
Purpose
Description
3-302.
2 Call step to convert the coefficients according to the properties of
in the toolbox.
Construction
specified value.
Properties
PredictionErrorOutputPort
Methods
3-302
clone
getNumInputs
getNumOutputs
dsp.CepstralToLPC
Examples
isLocked
release
step
Algorithms
See Also
3-303
dsp.CepstralToLPC.clone
Purpose
Syntax
C=clone(H)
Description
3-304
dsp.CepstralToLPC.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-305
dsp.CepstralToLPC.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-306
dsp.CepstralToLPC.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-307
dsp.CepstralToLPC.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-308
dsp.CepstralToLPC.step
Purpose
Syntax
A=step(H,CC)
[A,P]=step(H,CC)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-309
dsp.Chirp
Purpose
Description
3-310.
2 Call step to generate the signal according to the properties of
toolbox.
Construction
Properties
Type
Sweep direction
Specify the sweep direction as either Unidirectional or
Bidirectional. The default value is Unidirectional.
InitialFrequency
3-310
dsp.Chirp
less than the actual initial frequency of the sweep. Also, when the
sweep is logarithmic, the initial frequency must be less than the
target frequency, specified by the TargetFrequency property.
This property is tunable. The default value is 1000.
TargetFrequency
Target time
When you set the Type property to Linear, Quadratic, or
Logarithmic, this property specifies the target time in seconds
at which the target frequency is reached. When you set the
Type property to Swept cosine, this property specifies the
time at which the sweep reaches 2ftgt finit Hz, where ftgt is the
TargetFrequency and finit is the InitialFrequency. The target
time should not be greater than the sweep time, specified by the
SweepTime property. This property is tunable. The default value
is 1.
SweepTime
Sweep time
When you set the SweepDirection property to Unidirectional,
the sweep time in seconds is the period of the output frequency
sweep. When you set the SweepDirection property to
Bidirectional, the sweep time is half the period of the output
3-311
dsp.Chirp
Initial phase
Specify initial phase of the output in radians at time t = 0. This
property is tunable. The default value is 0.
SampleRate
Sample rate
Specify the sampling rate of the output in hertz as a positive
numeric scalar. The default value is 8000.
SamplesPerFrame
Methods
3-312
clone
getNumInputs
getNumOutputs
isLocked
dsp.Chirp
Examples
release
reset
step
Algorithms
See Also
dsp.SineWave
3-313
dsp.Chirp.clone
Purpose
Syntax
C = clone(H)
Description
3-314
dsp.Chirp.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-315
dsp.Chirp.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-316
dsp.Chirp.isLocked
Purpose
Syntax
isLocked(H)
Description
3-317
dsp.Chirp.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-318
dsp.Chirp.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the internal states of the Chirp object H to their initial
values. After you reset H, the frequency sweep restarts from the
beginning.
3-319
dsp.Chirp.step
Purpose
Syntax
Y = step(H)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-320
dsp.CICDecimator
Purpose
Description
3-321.
2 Call step to decimate the input according to the properties of
in the toolbox.
Construction
Properties
DecimationFactor
3-321
dsp.CICDecimator
Specify a positive integer delay value for the object to use in each
comb section of the filter. The default is 1.
NumSections
3-322
dsp.CICDecimator
Methods
clone
freqz
Frequency response
3-323
dsp.CICDecimator
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
hcicdec = dsp.CICDecimator(4);
%
DecimationFactor = 4
%
default NumSections = 2 and DifferentialDelay = 1
hcicdec.FixedPointDataType = 'Minimum section word lengths';
hcicdec.OutputWordLength = 16;
% Create fixed-point sinusoidal input signal
Fs = 44.1e3;
% Original sampling frequency
n = (0:1023)';
% 1024 samples, 0.0232 sec signal
x = fi(sin(2*pi*1e3/Fs*n),true,16,15);
% Create SignalSource System object
3-324
dsp.CICDecimator
Algorithms
See Also
dsp.CICInterpolator | dsp.FIRDecimator
3-325
dsp.CICDecimator.clone
Purpose
Syntax
C = clone(H)
Description
3-326
dsp.CICDecimator.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-327
dsp.CICDecimator.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-328
dsp.CICDecimator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-329
dsp.CICDecimator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-330
dsp.CICDecimator.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-331
dsp.CICDecimator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-332
dsp.CICDecimator.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-333
dsp.CICDecimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-334
dsp.CICDecimator.reset
Purpose
Syntax
reset(H)
Description
to zero.
3-335
dsp.CICDecimator.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-336
dsp.CICInterpolator
Purpose
Description
3-337.
2 Call step to interpolate the input according to the properties of
in the toolbox.
Construction
Properties
InterpolationFactor
3-337
dsp.CICInterpolator
3-338
dsp.CICInterpolator
SectionWordLengths
3-339
dsp.CICInterpolator
Methods
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
3-340
dsp.CICInterpolator
Algorithms
3-341
dsp.CICInterpolator
The object does not have a property that allows you to specify the
source of the coefficients. The object cannot import coefficients from
an mfilt object.
See Also
3-342
dsp.CICDecimator | dsp.FIRInterpolator
dsp.CICInterpolator.clone
Purpose
Syntax
C = clone(H)
Description
3-343
dsp.CICInterpolator.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-344
dsp.CICInterpolator.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-345
dsp.CICInterpolator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-346
dsp.CICInterpolator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-347
dsp.CICInterpolator.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-348
dsp.CICInterpolator.isLocked
Purpose
Syntax
isLocked(H)
Description
object H.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-349
dsp.CICInterpolator.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-350
dsp.CICInterpolator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-351
dsp.CICInterpolator.reset
Purpose
Syntax
reset(H)
Description
3-352
dsp.CICInterpolator.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-353
dsp.ColoredNoise
Purpose
Description
The ColoredNoise object generates pink noise and other colored noise
signals. The form of the PSD is 1/|f| with the exponent, , a real
number in the interval [-2,2].
To generate a colored noise signal:
1 Define and set up your colored noise generator. See Construction
on page 3-354.
2 Call step to generate the colored noise signal according to the
Construction
Properties
InverseFrequencyPower
3-354
dsp.ColoredNoise
3-355
dsp.ColoredNoise
Initial seed
Specify the initial seed of the mt19937ar random number
generator as a nonnegative integer. This property only applies
when RandomStream is 'mt19937ar with seed'. The default
value of this property is 67.
OutputDataType
Methods
3-356
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
dsp.ColoredNoise
Definitions
S( f )
L( f )
| f |
ln S( f ) ln| f | ln L( f ).
It is often convenient to plot the PSD in dB as function of the log
frequency to base 2 in order to characterize the slope in dB/octave.
Rewriting the preceding equation, you obtain
10 log S( f ) 10
ln(2) log 2 ( f )
ln( L( f ))
10
ln(10)
ln(10)
10
ln(2) log 2 ( f )
ln(10)
3-357
dsp.ColoredNoise
Special examples of
1
processes include:
| f |
Examples
3-358
dsp.ColoredNoise
ans =
freqinterval
_____________
Pwr
_______
100
200
400
800
1600
3200
6400
0.19436
0.18472
0.20873
0.2177
0.21887
0.23617
0.23526
200
400
800
1600
3200
6400
12800
The pink noise has roughly equal power in octave bands. Repeat the
preceding example with 'InverseFrequencyPower' equal to 0, which
generates a white noise signal. A white noise signal has a flat power
3-359
dsp.ColoredNoise
spectral density, or equal power per unit frequency. Set the random
number generator to the default settings for reproducible results.
hwhite = dsp.ColoredNoise(0,44.1e3,1);
rng default;
x = step(hwhite);
ans =
3-360
freqinterval
_____________
Pwr
_________
100
200
400
800
1600
3200
6400
0.0031417
0.0073833
0.017421
0.035926
0.071139
0.15183
0.28611
200
400
800
1600
3200
6400
12800
dsp.ColoredNoise
hcn = dsp.ColoredNoise('InverseFrequencyPower',1,'SamplesPerFrame',204
x = step(hcn);
Fs = 1;
[Pxx,F] = pwelch(x,hamming(128),[],[],Fs,'psd');
Display the Welch PSD estimate of the noise along with the theoretical
PSD on a log-log plot. Plot the frequency axis as the logarithm to the
base 2 to clearly show the octaves. Plot the PSD estimate in dB,
.
plot(log2(F(2:end)),10*log10(Pxx(2:end)));
hold on;
plot(log2(F(2:end)),10*log10(PSDPink),'r','linewidth',2)
xlabel('log_2(Hz)'); ylabel('dB');
title('Pink Noise');
grid on;
legend('PSD Estimate','Theoretical Pink Noise PSD');
3-361
dsp.ColoredNoise
hcn = dsp.ColoredNoise('InverseFrequencyPower',2,'SamplesPerFrame',2048,.
'NumChannels',2);
rng default;
x = step(hcn);
3-362
dsp.ColoredNoise
subplot(2,1,1)
plot(x(:,1)); title('Channel 1'); axis tight;
subplot(2,1,2)
plot(x(:,2)); title('Channel 2'); axis tight;
3-363
dsp.ColoredNoise
[Pxx(:,nn),F] = pwelch(x(:,nn),hamming(128),[],[],Fs,'psd');
end
3-364
dsp.ColoredNoise
3-365
dsp.ColoredNoise
power
N = 1024;
hafr = dsp.AudioFileReader('Filename','speech_dft.mp3','SamplesPerFrame',
hap = dsp.AudioPlayer('SampleRate',hafr.SampleRate);
hcn = dsp.ColoredNoise('InverseFrequencyPower',1,'SamplesPerFrame',N);
hrms = dsp.RMS;
ans =
1
Stream the audio file in 1024 samples at a time. Measure the signal
RMS value for each frame, generate a frame of pink noise equal in
length, and scale the RMS value of the pink noise to match the signal.
Add the scaled noise to the signal and play the output.
while ~isDone(hafr)
audio = step(hafr);
speechRMS = step(hrms,audio);
noise = step(hcn);
noiseRMS = step(hrms,noise);
noise = noise*(speechRMS/noiseRMS);
sigPlusNoise = audio+noise;
step(hap,sigPlusNoise);
end
pause(hap.QueueDuration);
release(hafr);
3-366
dsp.ColoredNoise
release(hap);
3-367
dsp.ColoredNoise
Algorithms
AR Generation Method
dsp.ColoredNoise generates colored noise using a white noise input
in an autoregressive model (AR) of order 63.
3-368
dsp.ColoredNoise
63
a y(n k) w(n)
k
k0
ak (k 1 2 )
ak1
k
k 1, 2,
References
[1] Beran, J., Feng, Y., Ghosh, S., and Kulik, R. Long-Memory Processes:
Probabilistic Properties and Statistical Methods, Springer, 2013.
[2] Kasdin, N.J. Discrete Simulation of Colored Noise and Stochastic
Processes and 1/f Power Law Noise Generation, Proceedings of the
IEEE, Vol. 83, No. 5, 1995, pp. 802-827.
See Also
randn
3-369
dsp.ColoredNoise.clone
Purpose
Syntax
C = clone(H)
Description
3-370
dsp.ColoredNoise.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-371
dsp.ColoredNoise.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-372
dsp.ColoredNoise.isLocked
Purpose
Syntax
isLocked(H)
Description
3-373
dsp.ColoredNoise.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-374
dsp.ColoredNoise.reset
Purpose
Syntax
reset(H)
Description
3-375
dsp.ColoredNoise.step
Purpose
Syntax
x = step(H)
Description
Examples
3-376
dsp.ColoredNoise.step
3-377
dsp.Convolver
Purpose
Description
Construction
Properties
Method
3-378
dsp.Convolver
Fixed-Point Properties
FullPrecisionOverride
3-379
dsp.Convolver
3-380
dsp.Convolver
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Convolution of inputs
Algorithms
See Also
dsp.Autocorrelator | dsp.Crosscorrelator
3-381
dsp.Convolver.clone
Purpose
Syntax
C = clone(H)
Description
3-382
dsp.Convolver.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-383
dsp.Convolver.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-384
dsp.Convolver.isLocked
Purpose
Syntax
isLocked(H)
Description
3-385
dsp.Convolver.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-386
dsp.Convolver.step
Purpose
Convolution of inputs
Syntax
Y = step(H,A,B)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-387
dsp.DCBlocker
Purpose
Remove DC component
Description
page 3-388.
2 Call step to filter the DC component of a signal according to the
Construction
with each specified property set to the specified value. You can
specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN).
Properties
Algorithm
3-388
dsp.DCBlocker
Methods
clone
fvtool
isLocked
3-389
dsp.DCBlocker
Examples
release
reset
step
For each second of time, use the step method to apply the DC blockers
to the input signal. By implementing the DC blockers in 1-second
increments, you can see the convergence differences among the
techniques.
for idx = 1 : 100
range = (1:1000) + 1000*(idx-1);
y1 = step(hDC1, x(range));
y2 = step(hDC2, x(range));
y3 = step(hDC3, x(range));
end
3-390
% IIR estimate
% FIR estimate
% Subtract mean
dsp.DCBlocker
Plot the input and output data for the three DC blockers for the first
second of time and show the mean value for each signal. You can see
that the FIR and Subtract mean algorithms converge more quickly.
plot(t(1:1000),x(1:1000),...
t(1:1000),y1, ...
t(1:1000),y2, ...
t(1:1000),y3);
xlabel('Time (sec)')
ylabel('Amplitude')
legend(sprintf('Input DC:%.3f',
mean(x)), ...
sprintf('IIR DC:%.3f',
mean(y1)), ...
sprintf('FIR DC:%.3f',
mean(y2)), ...
sprintf('Subtract mean DC:%.3f', mean(y3)));
3-391
dsp.DCBlocker
3-392
dsp.DCBlocker
Use the step method to apply the DC blocker to the input signal, x,
to generate the output signal, y.
y = step(hDCBlock, x);
Use the step method of the hsa object to display the frequency
characteristics of the input signal. Note the tones at 15 Hz, 20 Hz, and
25 Hz as well as the DC component.
step(hsa, x)
3-393
dsp.DCBlocker
Use the step method of the hsb object to display the frequency
characteristics of the output signal. The DC component has been
removed.
3-394
dsp.DCBlocker
step(hsb, y)
Algorithms
3-395
dsp.DCBlocker
Selected
Bibliography
See Also
dsp.BiquadFilter | dsp.FIRFilter
3-396
dsp.DCBlocker.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-397
dsp.DCBlocker.fvtool
Purpose
Show the frequency response of the filter used by the DCBlocker System
object
Syntax
fvtool(H)
Description
3-398
dsp.DCBlocker.isLocked
Purpose
Syntax
TF = isLocked(H)
Description
System object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-399
dsp.DCBlocker.release
Purpose
Syntax
release(H)
Description
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-400
dsp.DCBlocker.reset
Purpose
Syntax
reset(H)
Description
3-401
dsp.DCBlocker.step
Purpose
Syntax
Y = step(H,X)
Description
3-402
dsp.Counter
Purpose
Description
toolbox.
Construction
specified value.
Properties
Direction
Count up or down
Specify the counter direction as Up or Down. The default is Up.
This property is tunable.
CountEventInputPort
3-403
dsp.Counter
Output count
3-404
dsp.Counter
3-405
dsp.Counter
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-406
dsp.Counter
Algorithms
3-407
dsp.Counter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-408
dsp.Counter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-409
dsp.Counter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-410
dsp.Counter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-411
dsp.Counter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-412
dsp.Counter.reset
Purpose
Syntax
reset(H)
Description
initial values.
3-413
dsp.Counter.step
Purpose
Syntax
[CNT,HIT] = step(H,EVENT,RESET)
CNT = step(H,EVENT,RESET)
HIT = step(H,EVENT,RESET)
[...] = step(H)
[...] = step(H,EVENT)
Description
3-414
dsp.Counter.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-415
dsp.CoupledAllpassFilter
Purpose
Description
on page 3-416.
2 Call step to filter each channel of the input according to the
Construction
3-416
dsp.CoupledAllpassFilter
Properties
Structure
3-417
dsp.CoupledAllpassFilter
3-418
dsp.CoupledAllpassFilter
3-419
dsp.CoupledAllpassFilter
Methods
Examples
clone
getBranches
isLocked
release
reset
step
3-420
dsp.CoupledAllpassFilter
After creating the filter, generate a random signal, and set up a log of
the output signal, step through the System objects.
while ~isDone(Hsr)
in = step(Hsr);
out = step(Hca, in);
step(Hlog, [in, out]);
end
signalTraces = Hlog.Buffer;
tfestimate(signalTraces(:,1), signalTraces(:,2))
hold on
[A, w] = freqz(Hca);
plot(w/pi, db(A), 'r')
ylim([-80, 10])
hold off
3-421
dsp.CoupledAllpassFilter
Algorithms
Lattice
3-422
dsp.CoupledAllpassFilter
References
[1] Regalia, Philip A., Mitra, Sanjit K., and P.P Vaidyanathan The
Digital All-Pass Filter: A Versatile Signal Processing Building Block.
Proceedings of the IEEE 1988, Vol. 76, No. 1, pp. 1937.
3-423
dsp.CoupledAllpassFilter
[2] Mitra, Sanjit K., and James F. Kaiser, "Handbook for Digital Signal
Processing" New York: John Wiley & Sons, 1993.
See Also
3-424
dsp.CoupledAllpassFilter.clone
Purpose
Create Coupled Allpass Filter System object with same property values
Syntax
C = clone(H)
Description
3-425
dsp.CoupledAllpassFilter.getBranches
Purpose
Syntax
getBranches(H)
Description
3-426
dsp.CoupledAllpassFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-427
dsp.CoupledAllpassFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-428
dsp.CoupledAllpassFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the internal states of the Coupled Allpass filter object,
H, to their initial values. The reset method is always a no-op for
unlocked System objects, as the states may not be allocated when the
object is not locked.
3-429
dsp.CoupledAllpassFilter.step
Purpose
Syntax
Y = step(H,X)
[Y1,...,YN] = step(H,X)
Description
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs (but not for this object).
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-430
dsp.CrossSpectrumEstimator
Purpose
Description
Construction
object, H, with each specified property name set to the specified value.
You can specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN).
Properties
SampleRate
3-431
dsp.CrossSpectrumEstimator
FFT Length
Specify the length of the FFT that the Cross-Spectrum Estimator
uses to compute cross-spectral estimates as a positive, integer
scalar. This property applies when you set the FFTLengthSource
property to 'Property'. The default value is 128.
Window
Window function
Specify a window function for the cross-spectral estimator as one
of 'Rectangular' | 'Chebyshev' | 'Flat Top' | 'Hamming' |
'Hann' | 'Kaiser'. The default value is 'Hann'.
SidelobeAttenuation
3-432
dsp.CrossSpectrumEstimator
Methods
clone
getFrequencyVector
getRBW
isLocked
3-433
dsp.CrossSpectrumEstimator
Examples
reset
step
Add random noise to the sine waves. Step through the System objects
to obtain the data streams, and plot the cross-power spectrum of the
two signals:
for ii = 1:10
x = step(hsin1) + 0.05*randn(1000,1);
y = step(hsin2) + 0.05*randn(1000,1);
Pxy = step(hs, x, y);
step(hplot,20*log10(abs(Pxy)));
end
Algorithms
3-434
Given two signals x and y as inputs. We first window the two inputs,
and scale them by the window power. We then take FFT of the signals,
dsp.CrossSpectrumEstimator
References
[1] Hayes, Monson H. Statistical Digital Signal Processing and
Modeling. Hoboken, NJ: John Wiley & Sons, 1996
[2] Kay, Steven M. Modern Spectral Estimation: Theory and
Application. Englewood Cliffs, NJ: Prentice Hall, 1999
[3] Stoica, Petre and Randolph L. Moses. Spectral Analysis of Signals.
Englewood Cliffs, NJ: Prentice Hall, 2005
[4] Welch, P. D. The use of fast Fourier transforms for the estimation
of power spectra: A method based on time averaging over short modified
periodograms, IEEE Transactions on Audio and Electroacoustics, Vol.
15, pp. 7073, 1967.
See Also
dsp.SpectrumAnalyzer | dsp.TransferFunctionEstimator |
dsp.SpectrumEstimator
3-435
dsp.CrossSpectrumEstimator.clone
Purpose
Syntax
C = clone(H)
Description
3-436
the same property values. The clone method creates a new unlocked
object with uninitialized states.
dsp.CrossSpectrumEstimator.getFrequencyVector
Purpose
Syntax
getFrequencyVector(H)
Description
3-437
dsp.CrossSpectrumEstimator.getRBW
Purpose
Syntax
getRBW(H)
Description
3-438
dsp.CrossSpectrumEstimator.isLocked
Purpose
Syntax
L = isLocked(H)
Description
input attributes and nontunable properties are locked for the System
object. The object performs an internal initialization the first time the
step method is executed. This initialization locks nontunable properties
and input specifications, such as dimensions, complexity, and data type
of the input data. Once this occurs, the isLocked method returns a
true value.
3-439
dsp.CrossSpectrumEstimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-440
dsp.CrossSpectrumEstimator.reset
Purpose
Syntax
reset(H)
Description
3-441
dsp.CrossSpectrumEstimator.step
Purpose
Syntax
Y = step(H,x)
[Y1,...,YN] = step(H,x)
Description
outputs.
The columns of x are treated as independent channels.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-442
dsp.Crosscorrelator
Purpose
Description
3-443.
2 Call step to compute the cross-correlation according to the properties
Construction
value.
Properties
Method
3-443
dsp.Crosscorrelator
3-444
dsp.Crosscorrelator
ProductDataType
3-445
dsp.Crosscorrelator
Methods
Definitions
clone
getNumInputs
getNumOutputs
isLocked
release
step
Cross-correlation sequence
N h1
*
x(n + h) y (n) 0 h N 1
rxy (h) = n=0
*
( N 1) h 0
ryx (h)
where h is the lag and * denotes the complex conjugate. If the inputs
are realizations of jointly WSS stationary random processes, rxy(h) is an
unnormalized estimate of the theoretical cross-correlation:
3-446
dsp.Crosscorrelator
Examples
3-447
dsp.Crosscorrelator
3-448
dsp.Crosscorrelator
Algorithms
See Also
dsp.Autocorrelator | dsp.Convolver
3-449
dsp.Crosscorrelator.clone
Purpose
Syntax
C = clone(H)
Description
3-450
dsp.Crosscorrelator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-451
dsp.Crosscorrelator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-452
dsp.Crosscorrelator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-453
dsp.Crosscorrelator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-454
dsp.Crosscorrelator.step
Purpose
Cross-correlation sequence
Syntax
Y = step(H,A,B)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-455
dsp.CumulativeProduct
Purpose
Description
on page 3-456.
2 Call step to compute the cumulative product according to the
Construction
Properties
Dimension
3-456
dsp.CumulativeProduct
ResetCondition
3-457
dsp.CumulativeProduct
3-458
dsp.CumulativeProduct
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-459
dsp.CumulativeProduct
Algorithms
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
uses the FrameBasedProcessing property. The block uses the Input
processing parameter. See Set the FrameBasedProcessing Property
of a System object for more information.
See Also
3-460
dsp.CumulativeSum
dsp.CumulativeProduct.clone
Purpose
Syntax
C = clone(H)
Description
3-461
dsp.CumulativeProduct.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-462
dsp.CumulativeProduct.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-463
dsp.CumulativeProduct.isLocked
Purpose
Syntax
isLocked(H)
Description
3-464
dsp.CumulativeProduct.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-465
dsp.CumulativeProduct.reset
Purpose
Syntax
reset(H)
Description
3-466
dsp.CumulativeProduct.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-467
dsp.CumulativeSum
Purpose
Description
on page 3-468.
2 Call step to compute the cumulative sum according to the properties
Construction
which computes the running cumulative sum for each channel in the
input.
H = dsp.CumulativeSum('PropertyName',PropertyValue,...)
returns a cumulative sum object, H, with each specified property set to
Properties
Dimension
3-468
dsp.CumulativeSum
3-469
dsp.CumulativeSum
Methods
3-470
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
dsp.CumulativeSum
Examples
Algorithms
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
uses the FrameBasedProcessing property. The block uses the Input
processing parameter. See Set the FrameBasedProcessing Property
of a System object for more information.
See Also
dsp.CumulativeProduct
3-471
dsp.CumulativeSum.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-472
dsp.CumulativeSum.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-473
dsp.CumulativeSum.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-474
dsp.CumulativeSum.isLocked
Purpose
Syntax
isLocked(H)
Description
3-475
dsp.CumulativeSum.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-476
dsp.CumulativeSum.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the states for the running cumulative sum object, H, to
zero when the Dimension property is set to Channels (running sum).
3-477
dsp.CumulativeSum.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-478
dsp.DCT
Purpose
Description
The DCT object computes the discrete cosine transform (DCT) of input.
To compute the DCT of input:
1 Define and set up your DCT object. See Construction on page 3-479.
2 Call step to compute the DCT according to the properties of dsp.DCT.
Construction
Properties
SineComputation
3-479
dsp.DCT
3-480
dsp.DCT
Methods
clone
getNumInputs
getNumOutputs
3-481
dsp.DCT
Examples
isLocked
release
step
Algorithms
See Also
3-482
dsp.DCT.clone
Purpose
Syntax
C = clone(H)
Description
3-483
dsp.DCT.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-484
dsp.DCT.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-485
dsp.DCT.isLocked
Purpose
Syntax
isLocked(H)
Description
3-486
dsp.DCT.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-487
dsp.DCT.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-488
dsp.Delay
Purpose
Description
3-489.
2 Call step to delay the input according to the properties of dsp.Delay.
Construction
sample.
H = dsp.Delay('PropertyName', PropertyValue, ...) returns a
delay object, H, with each property set to the specified value.
H = dsp.Delay(LEN,'PropertyName',PropertyValue, ...) returns
a delay object, H, with the Length property set to LEN and other specified
properties set to the specified values.
Properties
Units
Amount of delay
Specify amount of delay to apply to the input signal. You
can set this property to a scalar, a vector, or an array
containing nonnegative integers depending on the value of the
FrameBasedProcessing property.
3-489
dsp.Delay
3-490
dsp.Delay
3-491
dsp.Delay
3-492
dsp.Delay
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-493
dsp.Delay
Algorithms
See Also
3-494
dsp.VariableIntegerDelay | dsp.VariableFractionalDelay.
dsp.Delay.clone
Purpose
Syntax
C = clone(H)
Description
states.
3-495
dsp.Delay.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-496
dsp.Delay.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-497
dsp.Delay.isLocked
Purpose
Syntax
isLocked(H)
Description
3-498
dsp.Delay.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-499
dsp.Delay.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the states of the delay object H to the values specified
in the InitialConditions property.
After you invoke the step method for a nonzero input, the delay object
states may change and invoking the step method again without
invoking the reset method may produce different outputs for identical
inputs.
For example:
H = dsp.Delay(5);
% Delay input by 5 samples
y = step(H, (1:10)');
% Output is [0 0 0 0 0 1 2 3 4 5]'
% Invoke step without reset
y1 = step(H,(1:10)');
% Output is [6 7 8 9 10 1 2 3 4 5]'
% Reset states
reset(H);
y2 = step(H,(1:10)');
% Output is [0 0 0 0 0 1 2 3 4 5]'
3-500
dsp.Delay.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-501
dsp.DelayLine
Purpose
Description
3-502.
2 Call step to rebuffer the sequence of inputs according to the
Construction
Properties
Length
3-502
dsp.DelayLine
3-503
dsp.DelayLine
more efficient when each step does not require the tapped delay
line output. When you set this property to false, the output is
always linearized and valid. The default is false.
HoldPreviousValue
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-504
dsp.DelayLine
en = logical([1 1 0 1 0]);
y = zeros(4,5);
for ii = 1:5
y(:,ii) = step(hdelayline, ii, en(ii));
end
Algorithms
See Also
dsp.Delay
3-505
dsp.DelayLine.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-506
dsp.DelayLine.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-507
dsp.DelayLine.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-508
dsp.DelayLine.isLocked
Purpose
Syntax
isLocked(H)
Description
3-509
dsp.DelayLine.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-510
dsp.DelayLine.reset
Purpose
Syntax
reset(H)
Description
3-511
dsp.DelayLine.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,EN)
Description
3-512
dsp.DelayLine.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-513
dsp.DigitalDownConverter
Purpose
Description
on page 3-514.
2 Call step to downconvert the input according to the properties of
Construction
3-514
dsp.DigitalDownConverter
I
X
cos(t)
CIC Decimator
M1
Scaling
Second stage
Decimator
M2
Third stage
Decimator
M3
-sin(t)
Oscillator
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 arithmetic is double
or single precision, the CIC interpolator is implemented as a simple FIR
interpolator with a boxcar response. A true CIC interpolator can only
operate with fixed-point signals. The CIC filter is emulated with an FIR
filter so that you can run simulations with floating-point data.
The following block diagram represents the DDC arithmetic with single
or double-precision, floating-point inputs.
3-515
dsp.DigitalDownConverter
float
float
CIC
Response
Implemented
using an FIR
decimator
filter
Scaling,
float
second and
float
third stages
float
Oscillator
The following block diagram represents the DDC arithmetic with signed
fixed-point inputs.
Cast - Filters
Input Data
x
(WL,FL)
Type
Cast
(WL+1, WL-1)
Oscillator
3-516
CIC
Decimator
(full precision)
Scaling
Cast - Filters
coarse/fine gain
Input Data
Type
Second stage
Decimator
(full precision)
Cast - Filter
Input Data
Type
dsp.DigitalDownConverter
Full precision
CIC Decimator
(full precision)
WLcic, FLcic
Coarse gain:
Reinterpret
cast to
multiplication
Ca
Filter
WLcic, F1+F2
Data
WLcic, F1+F2
fg
Fine gain:
16 bits, best precision
3-517
dsp.DigitalDownConverter
Properties
SampleRate
Decimation factor
Set this property to a positive, integer scalar, or to 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 decimation factors for each of the three filtering
stages.
When you set this property to a 1-by-2 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. When you set
the FilterSpecification property to Design parameters,
both elements of the DecimationFactor vector must be greater
than one. When you set the FilterSpecification property to
Coefficients, the first element of the DecimationFactor vector
must be greater than 1.
3-518
dsp.DigitalDownConverter
Filter specification
Set the filter specification as one of Design parameters |
Coefficients. The default is Design parameters. The DDC
object performs decimation using a cascade of three decimation
filters. The first filter stage is always a CIC decimator. When you
set the FilterSpecification property to Design parameters,
the object designs the cascade of decimation filters internally,
according to a set of parameters that you specify using the
filter-related object properties. In this case, the second and
third stages of the cascade consist of a CIC compensator, and
a halfband or lowpass FIR decimator respectively. When you
set the FilterSpecification property to Coefficients, you
specify an arbitrary set of filter coefficients for the second and
third filter stages using the SecondFilterCoefficients, and
ThirdFilterCoefficients properties respectively. You specify
the number of CIC sections using the NumCICSections property.
In all cases, the third filter stage can be bypassed by setting the
DecimationFactor property appropriately.
When the input data type is double or single the object implements
an N-section 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 fixed point type.
3-519
dsp.DigitalDownConverter
MinimumOrderDesign
3-520
dsp.DigitalDownConverter
3-521
dsp.DigitalDownConverter
3-522
dsp.DigitalDownConverter
Type of oscillator
Specify the oscillator as one of Sine wave | NCO | Input port.
The default is Sine wave. When you set this property to Sine
wave, the object frequency down converts the input signal using
a complex exponential obtained from samples of a sinusoidal
trigonometric function. When you set this property to NCO the
object performs frequency down conversion with a complex
exponential obtained using a numerically controlled oscillator
(NCO). When you set this property to Input port, the object
performs frequency down conversion using the complex signal
that you set as an input to the step method.
CenterFrequency
3-523
dsp.DigitalDownConverter
3-524
dsp.DigitalDownConverter
3-525
dsp.DigitalDownConverter
Methods
3-526
clone
fvtool
getDecimationFactors
getFilterOrders
getFilters
getNumInputs
getNumOutputs
groupDelay
isLocked
release
step
visualizeFilterStages
dsp.DigitalDownConverter
Examples
3-527
dsp.DigitalDownConverter
For additional examples using this System object, see the following
demos:
Digital Up and Down Conversion for Family Radio Service
Design and Analysis of a Digital Down Converter
See Also
3-528
dsp.DigitalUpConverter
dsp.DigitalDownConverter.clone
Purpose
Syntax
C = clone(H)
Description
3-529
dsp.DigitalDownConverter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,..,'Arithmetic',ARITH,...)
fvtool(H,..., PROP1, VALUE1,PROP2,VALUE2,...)
Description
is ignored.
fvtool(H,..., PROP1, VALUE1,PROP2,VALUE2,...) launches FVTool
and sets the specified FVTool properties to the specified values.
3-530
dsp.DigitalDownConverter.getDecimationFactors
Purpose
Syntax
M = getDecimationFactors(H)
Description
3-531
dsp.DigitalDownConverter.getFilters
Purpose
Syntax
S = getFilters(H)
getFilters(H,'Arithmetic',ARITH)
Description
System objects and the CIC normalization factor that form the
decimation filter cascade. The ThirdFilterStage structure field is
empty if the third filter stage has been bypassed. The CIC normalization
factor equals the inverse of the CIC filter gain. In some cases, this gain
includes a correction factor to ensure that the cascade response meets
the ripple specifications.
getFilters(H,'Arithmetic',ARITH) specifies the arithmetic of the
filter stages. You can set ARITH to double, single, or fixed-point.
When object H is in an unlocked state, you must specify the arithmetic
input. When object H is in a locked state, the arithmetic input is ignored.
3-532
dsp.DigitalDownConverter.getFilterOrders
Purpose
Syntax
S = getFilterOrders(H)
Description
structure field will be empty if the third filter stage has been bypassed.
3-533
dsp.DigitalDownConverter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-534
dsp.DigitalDownConverter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-535
dsp.DigitalDownConverter.groupDelay
Purpose
Syntax
D = groupDelay(H,N)
[D,F] = groupDelay(H,N)
Description
3-536
dsp.DigitalDownConverter.isLocked
Purpose
Syntax
Y = isLocked(H)
Description
3-537
dsp.DigitalDownConverter.release
Purpose
Syntax
release(H)
Description
3-538
and hardware connections. This method lets you change any properties
or input characteristics.
dsp.DigitalDownConverter.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,Z)
Description
3-539
dsp.DigitalDownConverter.visualizeFilterStages
Purpose
Syntax
visualizeFilterStages(H)
visualizeFilterStages(H,'Arithmetic',ARITH)
hfvt = visualizeFilterStages(H)
Description
the filter stages and of the cascade response. When you set the
FilterSpecification property to Design parameters the method
is ignored.
hfvt = visualizeFilterStages(H) returns the handle to the FVTool
object.
3-540
dsp.DigitalFilter
Purpose
Description
The DigitalFilter object filters each channel of the input using static
or time-varying digital filter implementations.
To filter each channel of the input using digital filter implementation:
1 Define and set up your IIR digital filter. See Construction on page
3-541.
2 Call step to filter each channel according to the properties of
in the toolbox.
Construction
value.
Properties
TransferFunction
Filter structure
Specify the filter structure.
When you set the TransferFunction property to FIR (all
zeros), you can specify the filter structure as one of |
3-541
dsp.DigitalFilter
The biquad filter structure does not apply when you set the
CoefficientsSource property to Input port. The default is
Direct form II transposed.
CoefficientsSource
Numerator coefficients
Specify the filter numerator coefficients as a real or complex
numeric vector. This property applies when you set the
TransferFunction property to FIR (all zeros), the
CoefficientsSource property to Property, and the Structure
property is not set to Lattice MA. This property also applies
when you set the TransferFunction property to IIR (poles
& zeros), the CoefficientsSource to Property, and the
3-542
dsp.DigitalFilter
Denominator coefficients
Specify the filter denominator coefficients as a real or
complex numeric vector. This property applies when you set
the TransferFunction property to IIR (all poles), the
CoefficientsSource property to Property and the Structure
property is not set to Lattice AR. This property also applies
when you set the TransferFunction property to IIR (poles
& zeros), the CoefficientsSource to Property, and the
TransferFunction property to Direct form, Direct form
symmetric, Direct form antisymmetric, or Direct form
transposed. When the TransferFunction property is IIR
(poles & zeros), the numerator and denominator must have
the same complexity. The default is [1 0.1]. This property is
tunable.
ReflectionCoefficients
3-543
dsp.DigitalFilter
filter. Each row of the SOS matrix contains the numerator and
denominator coefficients of the corresponding filter section. The
first three elements of each row are the numerator coefficients
and the last three elements are the denominator coefficients.
You can use real or complex coefficients. This property applies
when you set the TransferFunction property to IIR (poles and
zeros), the CoefficientsSource property to Property, and the
Structure property to Biquad direct form I (SOS), Biquad
direct form I transposed (SOS), Biquad direct form II
(SOS), or Biquad direct form II transposed (SOS). The
default is [1 0.3 0.4 1 0.1 0.2]. This property is tunable.
ScaleValues
3-544
dsp.DigitalFilter
3-545
dsp.DigitalFilter
3-546
dsp.DigitalFilter
3-547
dsp.DigitalFilter
3-548
dsp.DigitalFilter
3-549
dsp.DigitalFilter
DenominatorCoefficientsDataType
3-550
dsp.DigitalFilter
3-551
dsp.DigitalFilter
StateDataType
Methods
3-552
clone
getNumInputs
dsp.DigitalFilter
Examples
getNumOutputs
isLocked
release
reset
step
Use an FIR filter to apply a low pass filter to a waveform with two
sinusoidal components:
t = [0:63]./32e3;
xin = (sin(2*pi*4e3*t)+sin(2*pi*12e3*t)) / 2;
hSR = dsp.SignalSource(xin', 4);
hLog = dsp.SignalSink;
hFilt = dsp.DigitalFilter;
hFilt.TransferFunction = 'FIR (all zeros)';
hFilt.Numerator = fir1(10,0.5);
while ~isDone(hSR)
input = step(hSR);
filteredOutput = step(hFilt,input);
step(hLog,filteredOutput);
end
filteredResult = hLog.Buffer;
periodogram(filteredResult,[],[],32e3)
Algorithms
3-553
dsp.DigitalFilter
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
uses the FrameBasedProcessing property. The block uses the Input
processing parameter. See Set the FrameBasedProcessing Property
of a System object for more information.
See Also
3-554
dsp.BiquadFilter
dsp.DigitalFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-555
dsp.DigitalFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-556
dsp.DigitalFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-557
dsp.DigitalFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-558
dsp.DigitalFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-559
dsp.DigitalFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the digital filter object,H, to their
initial values of 0. The initial filter state values correspond to the initial
conditions for the difference equation defining the filter. After the step
method applies the digital filter object to nonzero input data, the states
may be nonzero. Invoking the step method again without first invoking
thereset method may produce different outputs for an identical input.
For example:
H = dsp.DigitalFilter;
H.TransferFunction = 'FIR (all zeros)';
H.Numerator = fir1(20,0.25);
n = 0:100;
x = cos(0.2*pi*n)+sin(0.8*pi*n);
y = step(H,x);
% Filter states are nonzero
% Invoke step method again without resetting states
y1 = step(H,x);
isequal(y,y1) % returns 0
% Now reset filter states to 0
reset(H)
% Invoke step method
y2 = step(H,x);
isequal(y,y2) % returns a 1
3-560
dsp.DigitalFilter.step
Purpose
Syntax
Y = step(HFILT,X)
Y = step(HFILT,X,COEFF)
Y = step(HFILT,X,NUM,DEN)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-561
dsp.DigitalUpConverter
Purpose
Description
page 3-562.
2 Call step to upconvert the input according to the properties of
Construction
Re{y}
X
I
Q
Im{y}
First Stage
Interpolator
M1
Second Stage
Interpolator
M2
CIC
Interpolator
M3
Scaling
cos(t)
Os
3-562
dsp.DigitalUpConverter
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 arithmetic is double or single precision, the CIC interpolator is
implemented as a simple FIR interpolator with a boxcar response. A
true CIC interpolator can only operate with fixed-point signals. The
CIC filter is emulated with an FIR filter so that you can run simulations
with floating-point data.
The following diagram represents the DUC arithmetic with single or
double-precision, floating-point inputs.
filter interpolator
sections
float
CIC
response
implemented
using an FIR
float
Scaling
float
interpolator
filter
Osci
3-563
dsp.DigitalUpConverter
First stage
interpolator
(full precision)
Cast - Filters
Output Data
Type
Second stage
interpolator
(full precision)
Cast - Filters
Output Data
Type
CIC
interpolator
(full precision)
3-564
Scaling
dsp.DigitalUpConverter
Full precision
CIC Interpolator
WLcic, FLcic
(full precision)
Coarse gain:
Reinterpret
cast to
multiplication
Ca
Filter
WLcic, F1+F2
Data
WLcic, F1+F2
fg
Fine gain:
16 bits, best precision
Properties
SampleRate
3-565
dsp.DigitalUpConverter
3-566
dsp.DigitalUpConverter
3-567
dsp.DigitalUpConverter
3-568
dsp.DigitalUpConverter
3-569
dsp.DigitalUpConverter
the filters so that the cascade response meets the passband ripple
that you specify in the PassbandRipple property. This property
applies when you set the FilterSpecification property to
Design parameters and the MinimumOrderDesign property to
true. The default is 0.1 dB.
StopbandAttenuation
Type of oscillator.
Specify the oscillator as one of Sine wave | NCO. The default
is Sine wave. When you set this property to Sine wave, the
object frequency up converts the output of the interpolation
filter cascade using a complex exponential signal obtained from
samples of a sinusoidal trigonometric function. When you set this
property to NCO the object performs frequency up conversion with
a complex exponential obtained using a numerically controlled
oscillator (NCO).
CenterFrequency
3-570
dsp.DigitalUpConverter
3-571
dsp.DigitalUpConverter
3-572
dsp.DigitalUpConverter
Specify the data type at the output of the first (if it has not been
bypassed), second, and third filter stages as one of Same as input
| Custom. The default is Same as input. 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 has been scaled by the normalization factor.
CustomFiltersOutputDataType
Methods
clone
fvtool
getFilterOrders
3-573
dsp.DigitalUpConverter
Examples
getFilters
getInterpolationFactors
getNumInputs
getNumOutputs
groupDelay
isLocked
release
step
visualizeFilterStages
% 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. Se
% the double sided signal bandwidth to 2 KHz.
hDUC = dsp.DigitalUpConverter(...
'InterpolationFactor', 20,...
'SampleRate', Fs,...
'Bandwidth', 2e3,...
'StopbandAttenuation', 55,...
3-574
dsp.DigitalUpConverter
'PassbandRipple',0.2,...
'CenterFrequency',50e3);
For additional examples using this System object, see the following
demos:
Digital Up and Down Conversion for Family Radio Service
Design and Analysis of a Digital Down Converter
See Also
dsp.DigitalDownConverter
3-575
dsp.DigitalUpConverter.clone
Purpose
Syntax
C = clone(H)
Description
3-576
dsp.DigitalUpConverter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,..,'Arithmetic',ARITH,...)
fvtool(H,..., PROP1, VALUE1,PROP2,VALUE2)
Description
is ignored.
fvtool(H,..., PROP1, VALUE1,PROP2,VALUE2) launches FVTool and
sets the specified FVTool properties to the specified values.
3-577
dsp.DigitalUpConverter.getFilters
Purpose
Syntax
S = getFilters(H)
getFilters(H,'Arithmetic',ARITH)
Description
System objects and the CIC normalization factor that form the
interpolation filter cascade. The FirstFilterStage structure field is
empty if the first filter stage has been bypassed. The CIC normalization
factor equals the inverse of the CIC filter gain. In some cases, this gain
includes a correction factor to ensure that the cascade response meets
the ripple specifications.
getFilters(H,'Arithmetic',ARITH) specifies the arithmetic of the
filter stages. You set ARITH to double, single, or fixed-point. When
object H is in an unlocked state, you must specify the arithmetic input.
When object H is in a locked state, the arithmetic input is ignored.
3-578
dsp.DigitalUpConverter.getFilterOrders
Purpose
Syntax
S = getFilterOrders(H)
Description
structure field will be empty if the first filter stage has been bypassed.
3-579
dsp.DigitalUpConverter.getInterpolationFactors
Purpose
Syntax
M = getInterpolationFactors(H)
Description
3-580
dsp.DigitalUpConverter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-581
dsp.DigitalUpConverter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-582
dsp.DigitalUpConverter.groupDelay
Purpose
Syntax
D = groupDelay(H,N)
[D,F] = groupDelay(H,N)
Description
3-583
dsp.DigitalUpConverter.isLocked
Purpose
Syntax
Y = isLocked(H)
Description
3-584
dsp.DigitalUpConverter.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-585
dsp.DigitalUpConverter.step
Purpose
Syntax
Y = step(H,X)
Description
3-586
dsp.DigitalUpConverter.visualizeFilterStages
Purpose
Syntax
visualizeFilterStages(H)
visualizeFilterStages(H,'Arithmetic',ARITH)
hfvt = visualizeFilterStages(H)
Description
arithmetic of the filter stages. You set input ARITH to double, single,
or fixed-point. When object H is in an unlocked state you must specify
the arithmetic. When object H is in a locked state the arithmetic input
is ignored.
hfvt = visualizeFilterStages(H) returns the handle to the FVTool
object.
3-587
dsp.DyadicAnalysisFilterBank
Purpose
Description
on page 3-588.
2 Call step to get the octave half band frequency decompositions of the
Construction
Properties
Filter
3-588
dsp.DyadicAnalysisFilterBank
Example Setting
N/A
WaveletOrder=3;
Daubechies
extremal phase
WaveletOrder=4;
Symlets
(Daubechies
least-asymmetric)
WaveletOrder=1;
Coiflets
Biorthogonal
Reverse
biorthogonal
Discrete Meyer
[Lo_D,Hi_D]=wfilters('coif1');
FilterOrder='[3/1]'; [Lo_D,Hi_D,Lo_R,Hi_R]=...
wfilters('bior3.1');
FilterOrder='[3/1]'; [Lo_D,Hi_D,Lo_R,Hi_R]=...
wfilters('rbior3.1');
[Lo_D,Hi_D]=wfilters('dmey');
N/A
CustomLowpassFilter
3-589
dsp.DyadicAnalysisFilterBank
3-590
dsp.DyadicAnalysisFilterBank
default is 2. The size of the input along the first dimension must
be a multiple of 2N, where N is the number of levels.
TreeStructure
M
k
Mk = 2
M
2 N
1k N
k = N +1
Methods
clone
getNumInputs
getNumOutputs
3-591
dsp.DyadicAnalysisFilterBank
Examples
isLocked
release
reset
step
Denoise square wave input using dyadic analysis and synthesis filter
banks:
t = 0:.0001:.0511;
x= square(2*pi*30*t);
xn = x' + 0.08*randn(length(x),1);
hdydanl = dsp.DyadicAnalysisFilterBank;
% The filter coefficients correspond to a 'haar' wavelet.
hdydanl.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
hdydanl.CustomHighpassFilter = [-1/sqrt(2) 1/sqrt(2)];
hdydsyn = dsp.DyadicSynthesisFilterBank;
hdydsyn.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
hdydsyn.CustomHighpassFilter = [1/sqrt(2) -1/sqrt(2)];
C = step(hdydanl, xn);
% Subband outputs
C1 = C(1:256); C2 = C(257:384); C3 = C(385:512);
% Set higher frequency coefficients to zero
% to remove the noise.
x_den = step(hdydsyn, [zeros(length(C1),1);...
zeros(length(C2),1);C3]);
subplot(2,1,1), plot(xn); title('Original noisy Signal');
subplot(2,1,2), plot(x_den); title('Denoised Signal');
3-592
dsp.DyadicAnalysisFilterBank
Algorithms
See Also
dsp.DyadicSynthesisFilterBank | dsp.SubbandAnalysisFilter
3-593
dsp.DyadicAnalysisFilterBank.clone
Purpose
Create dyadic analysis filter bank object with same property values
Syntax
C = clone(H)
Description
3-594
dsp.DyadicAnalysisFilterBank.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-595
dsp.DyadicAnalysisFilterBank.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-596
dsp.DyadicAnalysisFilterBank.isLocked
Purpose
Syntax
isLocked(H)
Description
isLocked(H) returns the locked state of the dyadic analysis filter bank
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-597
dsp.DyadicAnalysisFilterBank.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-598
dsp.DyadicAnalysisFilterBank.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the dyadic analysis filter bank
object, H, to their initial values of zero. After the step method applies
the dyadic analysis filter bank to nonzero input data, the filter states
may change. Invoking the step method again without first invoking the
reset method may produce different outputs for an identical input.
Example of resetting filter states:
X = [1 1 7 9 2 8 8 6]';
H = dsp.DyadicAnalysisFilterBank('NumLevels',1);
% Filter states are zero
y = step(H,X);
% Invoke step method again without resetting states
y1 = step(H,X);
isequal(y,y1) % Returns 0
reset(H); % Reset filter states to zero
y2 = step(H,X);
isequal(y,y2) % Returns 1
3-599
dsp.DyadicAnalysisFilterBank.step
Purpose
Syntax
Y = step(H,X)
Description
Examples
3-600
dsp.DyadicAnalysisFilterBank.step
H = dsp.DyadicAnalysisFilterBank('TreeStructure',...
'Symmetric');
Y = step(H,xn);
D1 = Y(1:256); % subband approx. [375,500] Hz
D2 = Y(257:512); % subband approx. [250,375] Hz
D3 = Y(513:768); % subband approx. [125,250] Hz
Approx = Y(769:1024); % subband approx. [0, 125] Hz
3-601
dsp.DyadicSynthesisFilterBank
Purpose
Description
on page 3-602.
2 Call step to reconstruct the signal according to the properties of
Construction
Properties
Filter
3-602
dsp.DyadicSynthesisFilterBank
Sample Setting
for Related Filter
Specification
Properties
Corresponding
Wavelet Toolbox
Function Syntax
Haar
None
wfilters('haar')
Daubechies
H.WaveletOrder =
4
wfilters('db4')
Symlets
H.WaveletOrder =
3
wfilters('sym3')
Coiflets
H.WaveletOrder =
1
wfilters('coif1')
Biorthogonal
H.FilterOrder =
'[3/1]'
wfilters('bior3.1')
Reverse
Biorthogonal
H.FilterOrder =
'[3/1]'
wfilters('rbior3.1')
Discrete Meyer
None
wfilters('dmey')
3-603
dsp.DyadicSynthesisFilterBank
Wavelet order
Specify the order of the wavelet selected in the Filter property.
This property applies only when you set the Filter property to
Daubechies, Symlets or Coiflets. The default is 2.
FilterOrder
3-604
dsp.DyadicSynthesisFilterBank
Methods
clone
getNumInputs
getNumOutputs
isLocked
3-605
dsp.DyadicSynthesisFilterBank
Examples
release
reset
step
3-606
dsp.DyadicSynthesisFilterBank
Algorithms
See Also
dsp.DyadicAnalysisFilterBank | dsp.SubbandSynthesisFilter
3-607
dsp.DyadicSynthesisFilterBank.clone
Purpose
Syntax
C = clone(H)
Description
3-608
dsp.DyadicSynthesisFilterBank.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-609
dsp.DyadicSynthesisFilterBank.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-610
dsp.DyadicSynthesisFilterBank.isLocked
Purpose
Syntax
isLocked(H)
Description
3-611
dsp.DyadicSynthesisFilterBank.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-612
dsp.DyadicSynthesisFilterBank.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the internal states of the dyadic synthesis filter bank
object H to their initial values.
3-613
dsp.DyadicSynthesisFilterBank.step
Purpose
Syntax
X = step(H,S)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-614
dsp.FastTransversalFilter
Purpose
Description
on page 3-615.
2 Call step to implement the filter according to the properties of
Construction
Properties
Method
3-615
dsp.FastTransversalFilter
Length
3-616
dsp.FastTransversalFilter
Methods
clone
isLocked
msesim
release
3-617
dsp.FastTransversalFilter
Examples
reset
step
References
[1] Haykin, Simon. Adaptive Filter Theory, 4th Ed. Upper Saddle
River, NJ: Prentice Hall, 2002
See Also
3-618
dsp.FastTransversalFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-619
dsp.FastTransversalFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-620
the same property values. The clone method creates a new unlocked
object with uninitialized states.
dsp.FastTransversalFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-621
dsp.FastTransversalFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-622
dsp.FastTransversalFilter.reset
Purpose
Syntax
reset(H)
Description
3-623
dsp.FastTransversalFilter.step
Purpose
Syntax
Description
outputs.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-624
dsp.FFT
Purpose
Description
Construction
Properties
FFTImplementation
FFT implementation
3-625
dsp.FFT
FFT length
Specify the FFT length. This property applies when you set the
FFTLengthSource property to Property. The default is 64.
This property must be a power of two when the input is a
fixed-point data type, or when you set the BitReversedOutput
property to true, or when you set the FFTImplementation
property to Radix-2.
3-626
dsp.FFT
WrapInput
3-627
dsp.FFT
3-628
dsp.FFT
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-629
dsp.FFT
Algorithms
References
See Also
3-630
dsp.FFT.clone
Purpose
Syntax
C = clone(H)
Description
3-631
dsp.FFT.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-632
dsp.FFT.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-633
dsp.FFT.isLocked
Purpose
Syntax
isLocked(H)
Description
3-634
dsp.FFT.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-635
dsp.FFT.step
Purpose
Syntax
Y = step(H,X)
Description
3-636
dsp.FilteredXLMSFilter
Purpose
Description
on page 3-637.
2 Call step to implement the filter according to the properties of
Construction
Properties
Length
3-637
dsp.FilteredXLMSFilter
3-638
dsp.FilteredXLMSFilter
Methods
Examples
clone
isLocked
msesim
release
reset
step
=
=
=
=
=
randn(1000,1);
fir1(47,0.4);
0.1*randn(1000,1);
filter(g,1,x) + n
fir1(31,0.5);
Use the Filtered-X LMS Filter to compute the filtered output and the
filter error for the input and the signal to be cancelled:
3-639
dsp.FilteredXLMSFilter
mu = 0.008;
ha = dsp.FilteredXLMSFilter(32, 'StepSize', mu, 'LeakageFactor', ...
1, 'SecondaryPathCoefficients', b);
[y,e] = step(ha,x,d);
References
[1] Kuo, S.M. and Morgan, D.R. Active Noise Control Systems:
Algorithms and DSP Implementations. New York: John Wiley & Sons,
1996.
[2] Widrow, B. and Stearns, S.D. Adaptive Signal Processing. Upper
Saddle River, N.J: Prentice Hall, 1985.
See Also
3-640
dsp.FilteredXLMSFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-641
dsp.FilteredXLMSFilter.msesim
l = 32;
mu = 0.008;
m = 5;
% Filter length
% Filtered-X LMS filter Step size.
% Decimation factor for analysis
% and simulation results
ha = dsp.FilteredXLMSFilter(l,'StepSize',mu);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('Iteration'); ylabel('MSE (dB)');
title('Learning curve for Filtered-X LMS filter used in system identifica
3-642
dsp.FilteredXLMSFilter.clone
Purpose
Syntax
C = clone(H)
Description
the same property values. The clone method creates a new unlocked
object with uninitialized states.
3-643
dsp.FilteredXLMSFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-644
dsp.FilteredXLMSFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-645
dsp.FilteredXLMSFilter.reset
Purpose
Syntax
reset(H)
Description
3-646
dsp.FilteredXLMSFilter.step
Purpose
Syntax
Description
outputs.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-647
dsp.FIRDecimator
Purpose
Description
3-648.
2 Call step to resample the vector or matrix inputs according to the
Construction
value.
H = dsp.FIRDecimator(DECIM, NUM,
'PropertyName',PropertyValue, ...) returns an FIR decimator, H,
with the integer-valued DecimationFactor property set to DECIM, the
Numerator property set to NUM, and other specified properties set to
Properties
DecimationFactor
Decimation factor
Specify the downsampling factor as a positive integer. The FIR
decimator reduces the sampling rate of the input by this factor.
3-648
dsp.FIRDecimator
The size of the input along the first dimension must be a multiple
of the decimation factor. The default is 2.
Numerator
H ( z) =
L 1
bl zl
l =0
Filter structure
Specify the implementation of the FIR filter as either Direct
form or Direct form transposed. The default is Direct form.
Fixed-Point Properties
FullPrecisionOverride
3-649
dsp.FIRDecimator
3-650
dsp.FIRDecimator
3-651
dsp.FIRDecimator
Methods
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Definitions
Polyphase Subfilters
A polyphase implementation of an FIR decimator splits the lowpass
FIR filter impulse response into M different subfilters, where M is the
downsampling, or decimation factor. Let h(n) denote the FIR filter
impulse response of length L and u(n) the input signal. Decimating
the filter output by a factor of M is equivalent to the downsampled
convolution:
3-652
dsp.FIRDecimator
y(n) =
L 1
h(l)u(nM l)
l =0
Examples
3-653
dsp.FIRDecimator
The figure shows that the delay in the decimated output is consistent
with the group delay of the filter when the initial filter states are zero.
3-654
dsp.FIRDecimator
Reduce the sampling rate of an audio signal by 1/2 and play it:
hmfr = dsp.AudioFileReader('OutputDataType',...
'single');
hap = dsp.AudioPlayer(22050/2);
hfirdec = dsp.FIRDecimator;
while ~isDone(hmfr)
frame = step(hmfr);
y = step(hfirdec, frame);
step(hap, y);
end
release(hmfr);
pause(0.5);
release(hap);
Algorithms
3-655
dsp.FIRDecimator
See Also
3-656
dsp.FIRInterpolator | dsp.FIRRateConverter
dsp.FIRDecimator.clone
Purpose
Syntax
C = clone(H)
Description
3-657
dsp.FIRDecimator.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-658
dsp.FIRDecimator.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-659
dsp.FIRDecimator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-660
dsp.FIRDecimator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-661
dsp.FIRDecimator.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-662
dsp.FIRDecimator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-663
dsp.FIRDecimator.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-664
dsp.FIRDecimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-665
dsp.FIRDecimator.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the FIR decimator object,H, to the
initial values of zero. After the step method applies the FIR decimator
to nonzero input data, the filter states may change. Invoking the step
method again without first invoking the reset method may produce
3-666
dsp.FIRDecimator.step
Purpose
Syntax
Y = step(H,X)
Description
3-667
dsp.FIRFilter
Purpose
Description
The FIRFilter object filters each channel of the input using static or
time-varying FIR filter implementations.
To filter each channel of the input:
1 Define and set up your FIR filter. See Construction on page 3-668.
2 Call step to filter each channel of the input according to the
Construction
Properties
Structure
Filter structure
Specify the filter structure.
You can specify the filter structure as one of | Direct form
| Direct form symmetric | Direct form antisymmetric
| Direct form transposed | Lattice MA |. The default is
Direct form.
NumeratorSource
3-668
dsp.FIRFilter
Numerator coefficients
Specify the filter coefficients as a real or complex numeric row
vector. This property applies when you set the NumeratorSource
property to Property, and the Structure property is not
set to Direct form, Direct form symmetric, Direct form
antisymmetric, or Direct form transposed. The default is
[0.5 0.5]. This property is tunable.
ReflectionCoefficients
3-669
dsp.FIRFilter
3-670
dsp.FIRFilter
3-671
dsp.FIRFilter
3-672
dsp.FIRFilter
3-673
dsp.FIRFilter
Methods
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
Use an FIR filter to apply a low pass filter to a waveform with two
sinusoidal components:
t = (0:1000)'/8e3;
xin = sin(2*pi*0.3e3*t)+sin(2*pi*3e3*t);
hSR = dsp.SignalSource;
3-674
dsp.FIRFilter
hSR.Signal = xin;
hLog = dsp.SignalSink;
hFIR = dsp.FIRFilter;
hFIR.Numerator = fir1(10,0.5);
h = dsp.SpectrumAnalyzer('SampleRate',8e3,...
'PlotAsTwoSidedSpectrum',false,...
'OverlapPercent', 80, 'PowerUnits','dBW',...
'YLimits', [-150 -10]);
while ~isDone(hSR)
input = step(hSR);
filteredOutput = step(hFIR,input);
step(hLog,filteredOutput);
step(h,filteredOutput)
end
filteredResult = hLog.Buffer;
fvtool(hFIR,'Fs',8000)
3-675
dsp.FIRFilter
3-676
dsp.FIRFilter
3-677
dsp.FIRFilter
N = 10;
Fc = 0.4;
B = fir1(N,Fc);
Hf1 = dsp.FIRFilter('Numerator',B);
fvtool(Hf1)
3-678
dsp.FIRFilter
3-679
dsp.FIRFilter
N = 10;
Fc = 0.4;
Hf = fdesign.lowpass('N,Fc',N,Fc);
D = design(Hf,'systemobject',true)
fvtool(D);
D =
System: dsp.FIRFilter
Properties:
Structure:
NumeratorSource:
Numerator:
InitialConditions:
FrameBasedProcessing:
3-680
'Direct form'
'Property'
[1x11 double]
0
true
dsp.FIRFilter
3-681
dsp.FIRFilter
Algorithms
See Also
3-682
dsp.BiquadFilter
dsp.FIRFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-683
dsp.FIRFilter.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-684
dsp.FIRFilter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-685
dsp.FIRFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-686
dsp.FIRFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-687
dsp.FIRFilter.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-688
dsp.FIRFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-689
dsp.FIRFilter.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-690
dsp.FIRFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-691
dsp.FIRFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the FIR filter object,H, to their initial
values of 0. The initial filter state values correspond to the initial
conditions for the difference equation defining the filter. After the step
method applies the FIR filter object to nonzero input data, the states
may be nonzero. Invoking the step method again without first invoking
thereset method may produce different outputs for an identical input.
For example:
H = dsp.FIRFilter;
H.Numerator = fir1(20,0.25);
n = 0:100;
x = cos(0.2*pi*n)+sin(0.8*pi*n);
y = step(H,x);
% Filter states are nonzero
% Invoke step method again without resetting states
y1 = step(H,x);
isequal(y,y1) % returns 0
% Now reset filter states to 0
reset(H)
% Invoke step method
y2 = step(H,x);
isequal(y,y2) % returns a 1
3-692
dsp.FIRFilter.step
Purpose
Syntax
Y = step(HFIR,X)
Y = step(HFIR,X,COEFF)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-693
dsp.FIRInterpolator
Purpose
Description
3-694.
2 Call step to upsample the input according to the properties of
in the toolbox.
Construction
value.
H = dsp.FIRInterpolator(INTERP,
NUM,'PropertyName',PropertyValue, ...) returns an FIR
interpolation object, H, with the InterpolationFactor property set to
INTERP, the Numerator property set to NUM, and other properties set to
Properties
InterpolationFactor
Interpolation factor
Specify the integer factor, L, by which to increase the sampling
rate of the input signal. The polyphase implementation uses L
polyphase subfilters to compute convolutions at the lower sample
3-694
dsp.FIRInterpolator
H ( z) =
N 1
b(n) zn
n =0
3-695
dsp.FIRInterpolator
3-696
dsp.FIRInterpolator
CustomProductDataType
3-697
dsp.FIRInterpolator
Methods
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
Double the sampling rate of an audio signal from 22.05 kHz to 44.1
kHz, and play the audio:
hmfr = dsp.AudioFileReader('OutputDataType',...
'single');
hap = dsp.AudioPlayer(44100);
hfirint = dsp.FIRInterpolator(2, ...
firpm(30, [0 0.45 0.55 1], [1 1 0 0]));
while ~isDone(hmfr)
frame = step(hmfr);
y = step(hfirint, frame);
3-698
dsp.FIRInterpolator
step(hap, y);
end
pause(1);
release(hmfr);
release(hap);
Algorithms
See Also
dsp.FIRDecimator | dsp.FIRRateConverter
3-699
dsp.FIRInterpolator.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-700
dsp.FIRInterpolator.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-701
dsp.FIRInterpolator.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-702
dsp.FIRInterpolator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-703
dsp.FIRInterpolator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-704
dsp.FIRInterpolator.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-705
dsp.FIRInterpolator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-706
dsp.FIRInterpolator.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-707
dsp.FIRInterpolator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-708
dsp.FIRInterpolator.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the FIR filter in the interpolator
object, H, to their initial values of 0. The initial filter state values
correspond to the initial conditions for the constant coefficient linear
difference equation defining the FIR filter. After the step method
applies the interpolator to nonzero input data, the states may be
nonzero. Invoking the step method again without first invoking the
reset method may produce different outputs for an identical input.
3-709
dsp.FIRInterpolator.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-710
dsp.FIRRateConverter
Purpose
Description
on page 3-711.
2 Call step to perform sampling rate conversion according to the
Construction
specified value.
H = dsp.FIRRateConverter(L,M,NUM,'PropertyName',
PropertyValue, ...) returns an FIR sample rate converter, H, with
the InterpolationFactor property set to L, the DecimationFactor
property set to M, the Numerator property set to NUM, and other specified
Properties
InterpolationFactor
Interpolation factor
3-711
dsp.FIRRateConverter
Decimation factor
Specify the integer downsampling factor. The default is 2.
Numerator
3-712
dsp.FIRRateConverter
3-713
dsp.FIRRateConverter
Methods
3-714
clone
getNumInputs
dsp.FIRRateConverter
Examples
getNumOutputs
isLocked
release
reset
step
3-715
dsp.FIRRateConverter
'SamplesPerFrame', 300);
hap = dsp.AudioPlayer(32000);
% Create an FIRRateConverter System object with interpolation
% factor = 2, decimation factor = 3. Default FIR filter
% coefficients define a lowpass filter with normalized
% cutoff frequency of 1/3.
hfirrc = dsp.FIRRateConverter(2,3);
while ~isDone(hmfr)
audio1 = step(hmfr);
audio2 = step(hfirrc, audio1);
step(hap, audio2);
end
release(hmfr);
release(hap);
Algorithms
See Also
dsp.FIRInterpolator | dsp.FIRDecimator
3-716
dsp.FIRRateConverter.clone
Purpose
Create FIR sample rate convertor object with same property values
Syntax
C = clone(H)
Description
3-717
dsp.FIRRateConverter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-718
dsp.FIRRateConverter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-719
dsp.FIRRateConverter.isLocked
Purpose
Syntax
isLocked(H)
Description
isLocked(H) returns the locked state of the FIR sample rate converter.
3-720
dsp.FIRRateConverter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-721
dsp.FIRRateConverter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the FIR filter in the sample rate
converter, H, to their initial values of 0. The initial filter state values
correspond to the initial conditions for the constant coefficient linear
difference equation defining the FIR filter. After the step method
applies the FIR rate converter to nonzero input data, the states may
be nonzero. Invoking the step method again without first invoking the
reset method may produce different outputs for an identical input.
3-722
dsp.FIRRateConverter.step
Purpose
Syntax
Y = step(H,X)
Description
3-723
dsp.FrequencyDomainAdaptiveFilter
Purpose
Description
on page 3-724.
2 Call step to implement the filter according to the properties of
Construction
to compute the filtered output and the filter error for a given input
and desired signal.
H = dsp.FrequencyDomainAdaptiveFilter('PropertyName',
PropertyValue, ...) returns an FrequencyDomainAdaptiveFilter
System object, H, with each specified property set to the specified value.
H = dsp.FrequencyDomainAdaptiveFilter(LEN,'PropertyName',
PropertyValue,...) returns an FrequencyDomainAdaptiveFilter
System object, H, with the Length property set to LEN and other specified
Properties
Method
3-724
dsp.FrequencyDomainAdaptiveFilter
3-725
dsp.FrequencyDomainAdaptiveFilter
3-726
dsp.FrequencyDomainAdaptiveFilter
Methods
Examples
clone
isLocked
msesim
release
reset
step
3-727
dsp.FrequencyDomainAdaptiveFilter
[y,e] = step(ha,x,d);
References
[1] Shynk, J.J.Frequency-Domain and Multirate Adaptive Filtering.
IEEE Signal Processing Magazine, Vol. 9, No. 1, pp. 1437, Jan. 1992.
See Also
3-728
dsp.FrequencyDomainAdaptiveFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-729
dsp.FrequencyDomainAdaptiveFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-730
the same property values. The clone method creates a new unlocked
object with uninitialized states.
dsp.FrequencyDomainAdaptiveFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
Adaptive filter.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-731
dsp.FrequencyDomainAdaptiveFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-732
dsp.FrequencyDomainAdaptiveFilter.reset
Purpose
Syntax
reset(H)
Description
3-733
dsp.FrequencyDomainAdaptiveFilter.step
Purpose
Syntax
Description
outputs.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-734
dsp.HDLNCO
Purpose
Description
Construction
Input Arguments
Inc
3-735
dsp.HDLNCO
Default: 100
Properties
PhaseIncrementSource
PhaseIncrement
PhaseOffset
3-736
dsp.HDLNCO
NumDitherBits
NumQuantizerAccumulatorBits
Set PhasePort to true to return the current phase along with the
output from the step method. The default value of this property is
false.
3-737
dsp.HDLNCO
ResetAction
Specify the output signal data type. Options are: double, single,
and Binary point scaling. If this property is set to Binary
point scaling, the output sign, word length, and fraction length
are taken from the following three properties. The default is
Binary point scaling.
OutputSigned
3-738
dsp.HDLNCO
Methods
Examples
clone
isLocked
release
step
%
%
%
%
%
3-739
dsp.HDLNCO
for k= 1:1/Ts
y(k) = step(hnco,true);
end
Algorithms
3-740
dsp.HDLNCO
(0 A
)
2
(0 B
24 )
2
(0 C
2 8 )
2
3-741
dsp.HDLNCO
See Also
3-742
dsp.NCO
dsp.HDLNCO.clone
Purpose
Syntax
C = clone(H)
Description
Input
Arguments
Output
Arguments
3-743
dsp.HDLNCO.isLocked
Purpose
Syntax
L = isLocked(H)
Description
object, H.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
Input
Arguments
Output
Arguments
3-744
dsp.HDLNCO.release
Purpose
Syntax
release(H)
Description
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
Input
Arguments
3-745
dsp.HDLNCO.step
Purpose
Syntax
[Y,validOut] = step(HNCO,Inc,validIn)
[Y,validOut] = step(HNCO,validIn)
[Y,validOut] = step(HNCO,Offset,validIn)
[Y,validOut] = step(HNCO,Inc,Offset,validIn)
[Y,validOut] = step(HNCO,Dither,validIn)
[Y,validOut] = step(HNCO,Inc,Offset,Dither,validIn)
[Y,COSINE,validOut] = step(HNCO, ___ )
[Y,PHASE,validOut]= step(HNCO, ___ )
Description
fi object scalar.
[Y,validOut] = step(HNCO,Inc,Offset,validIn) returns a
sinusoidal signal, Y, with phase increment, Inc, and phase offset,
Offset, when the PhaseIncrementSource and the PhaseOffsetSource
properties are both set to Input port.
[Y,validOut] = step(HNCO,Dither,validIn) returns a sinusoidal
3-746
dsp.HDLNCO.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-747
dsp.Histogram
Purpose
Description
3-748.
2 Call step to generate the histogram for an input according to the
Construction
Properties
LowerLimit
Lower boundary
Specify the lower boundary of the lowest-valued bin as a
real-valued scalar. NaN and Inf are not valid values for this
property. The default is 0. This property is tunable.
UpperLimit
Upper boundary
3-748
dsp.Histogram
3-749
dsp.Histogram
ResetCondition
3-750
dsp.Histogram
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Compute a histogram with four bins, for possible input values 1 through
4:
hhist = dsp.Histogram(1,4,4);
y = step(hhist, [1 2 2 3 3 3 4 4 4 4]');
% y equals [1; 2; 3; 4] - one one, two twos, etc.
3-751
dsp.Histogram
Algorithms
See Also
3-752
dsp.Histogram.clone
Purpose
Syntax
C = clone(H)
Description
3-753
dsp.Histogram.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-754
dsp.Histogram.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-755
dsp.Histogram.isLocked
Purpose
Syntax
isLocked(H)
Description
3-756
dsp.Histogram.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-757
dsp.Histogram.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the Histogram object bin values to zero when you set the
RunningHistogram property to true.
3-758
dsp.Histogram.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-759
dsp.IDCT
Purpose
Description
The IDCT object computes the inverse discrete cosine transform (IDCT)
of an input.
To compute the IDCT of an input:
1 Define and set up your IDCT object. See Construction on page
3-760.
2 Call step to compute the IDCT of an input according to the properties
Construction
Properties
SineComputation
3-760
dsp.IDCT
OverflowAction
3-761
dsp.IDCT
AccumulatorDataType
3-762
dsp.IDCT
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-763
dsp.IDCT
hidct = dsp.IDCT;
xt = step(hidct, XXt);
plot(1:128,[x xt]);
legend('Original signal','Reconstructed signal',...
'location','best');
Algorithms
See Also
3-764
dsp.IDCT.clone
Purpose
Syntax
C = clone(H)
Description
3-765
dsp.IDCT.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-766
dsp.IDCT.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-767
dsp.IDCT.isLocked
Purpose
Syntax
isLocked(H)
Description
3-768
dsp.IDCT.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-769
dsp.IDCT.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-770
dsp.IFFT
Purpose
Description
Construction
Properties
FFTImplementation
FFT implementation
3-771
dsp.IFFT
3-772
dsp.IFFT
FFT length
Specify the FFT length as a numeric scalar. This
property applies when you set the BitReversedInput and
ConjugateSymmetricInput properties to false, and the
FFTLengthSource property to Property. The default is 64.
This property must be a power of two when the input is a
fixed-point data type, or when you set the FFTImplementation
property to Radix-2.
When you set the FFT implementation property to Radix-2, or
when you set the BitReversedOutput property to true, this value
must be a power of two.
WrapInput
3-773
dsp.IFFT
3-774
dsp.IFFT
Methods
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-775
dsp.IFFT
Examples
Algorithms
References
See Also
3-776
dsp.IFFT.clone
Purpose
Syntax
C = clone(H)
Description
3-777
dsp.IFFT.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-778
dsp.IFFT.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-779
dsp.IFFT.isLocked
Purpose
Syntax
isLocked(H)
Description
3-780
dsp.IFFT.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-781
dsp.IFFT.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-782
dsp.IIRFilter
Purpose
Description
The IIRFilter object filters each channel of the input using IIR filter
implementations.
To filter each channel of the input:
1 Define and set up your IIR filter. See Construction on page 3-783.
2 Call step to filter each channel of the input according to the
Construction
Properties
Structure
Filter structure
Specify the filter structure.
You can specify the filter structure as one of | Direct
form I | Direct form I transposed | Direct form II |
Direct form II transposed. The default is Direct form II
transposed. This property is nontunable.
Numerator
3-783
dsp.IIRFilter
Denominator
3-784
dsp.IIRFilter
3-785
dsp.IIRFilter
3-786
dsp.IIRFilter
3-787
dsp.IIRFilter
3-788
dsp.IIRFilter
CustomNumeratorAccumulatorDataType
3-789
dsp.IIRFilter
Methods
clone
freqz
Frequency response
fvtool
getNumInputs
getNumOutputs
impz
Impulse response
isLocked
phasez
release
reset
step
Examples
Use fvtool to see the magnitude response of a lowpass IIR filter. Also
use the Spectrum Analyzer to display the power spectrum of the output
signal.
x = randn(2048,1);
x = x-mean(x);
Hsr = dsp.SignalSource;
Hsr.Signal = x;
Hlog = dsp.SignalSink;
3-790
dsp.IIRFilter
N = 10;
Fc = 0.4;
[b,a] = butter(N,Fc);
H = dsp.IIRFilter('Numerator',b,'Denominator',a);
h = dsp.SpectrumAnalyzer('SampleRate',8e3,...
'PlotAsTwoSidedSpectrum',false,...
'OverlapPercent', 80,'PowerUnits','dBW',...
'YLimits', [-220 -10]);
while ~isDone(Hsr)
input = step(Hsr);
output = step(H,input);
step(h,output)
step(Hlog,output);
end
Result = Hlog.Buffer;
fvtool(H,'Fs',8000)
3-791
dsp.IIRFilter
3-792
dsp.IIRFilter
3-793
dsp.IIRFilter
The are two ways, either you first design the constructor and then
design the filter as a System object that you can apply:
D = fdesign.comb('notch','N,BW',8,0.02);
H = design(D,'systemobject',true)
fvtool(H);
H =
System: dsp.IIRFilter
Properties:
Structure:
Numerator:
Denominator:
InitialConditions:
FrameBasedProcessing:
3-794
dsp.IIRFilter
or, you have the filter coefficients, and then you use dsp.IIRFilter, to
apply it:
3-795
dsp.IIRFilter
3-796
dsp.IIRFilter
3-797
dsp.IIRFilter
Algorithms
See Also
3-798
dsp.IIRFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-799
dsp.IIRFilter.freqz
Purpose
Frequency response
Syntax
[h,w] = freqz(H)
[h,w] = freqz(H,n)
[h,w] = freqz(H,Name,Value)
freqz(H)
Description
3-800
dsp.IIRFilter.fvtool
Purpose
Syntax
fvtool(H)
fvtool(H,'Arithmetic',ARITH,...)
Description
3-801
dsp.IIRFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-802
dsp.IIRFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-803
dsp.IIRFilter.impz
Purpose
Impulse response
Syntax
[h,t] = impz(H)
[h,t] = impz(H,Name,Value)
impz(H)
Description
computed.
[h,t] = impz(H,Name,Value) returns the impulse response h, and the
corresponding time pointst , with additional options specified by one or
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
3-804
dsp.IIRFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-805
dsp.IIRFilter.phasez
Purpose
Syntax
[phi,w] = phasez(H)
[phi,w] = phasez(H,n)
[phi,w] = phasez(H,Name,Value)
phasez(H)
Description
object H.
3-806
dsp.IIRFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-807
dsp.IIRFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the IIR filter object, H, to their initial
3-808
dsp.IIRFilter.step
Purpose
Syntax
Y = step(H,X)
Description
Y = step(H,X) filters the real or complex input signal X using the IIR
filter, H, to produce the output Y . When the input data is of a fixed-point
type, it must be signed. The IIR filter object operates on each channel of
the input signal independently over successive calls to step method.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-809
dsp.Interpolator
Purpose
Description
page 3-810.
2 Call step to interpolate the input according to the properties of
in the toolbox.
Construction
Properties
InterpolationPointsSource
Interpolation points
This property only applies when you set the
InterpolationPointsSource property to Property.
Specify the interpolation points as a column vector or a matrix
with the same number of channels as the input.
3-810
dsp.Interpolator
Interpolation method
Specify the interpolation method as Linear or FIR. When this
property is Linear, the interpolator object interpolates data
values by assuming that the data varies linearly between adjacent
samples. When this property is FIR, the interpolator object uses
polyphase interpolation to replace filtering (convolution) at the
upsampled rate with a series of convolutions at the lower rate. The
interpolator object always performs linear interpolation if there
are insufficient low-rate samples to perform FIR interpolation as
explained in the description of the FilterHalfLength property.
The default is Linear.
FilterHalfLength
3-811
dsp.Interpolator
3-812
dsp.Interpolator
Methods
clone
getNumInputs
getNumOutputs
isLocked
3-813
dsp.Interpolator
Definitions
release
step
k = 0, 1,, L 1
n = 0, 1,, 2 P 1
Polyphase Subfilter
h0(n)
h1(n)
h2(n)
The following code shows how to find the polyphase subfilters for the
default FIR interpolator object:
H = dsp.Interpolator('Method','FIR');
L = H.InterpolationPointsPerSample;
P = H.FilterHalfLength;
FiltCoeffs = intfilt(L,P,H.Bandwidth);
% Returns filter of length 2*P*L-1
FiltLen=length(FiltCoeffs);
FiltCols = ceil(FiltLen/2/L);
3-814
dsp.Interpolator
Examples
3-815
dsp.Interpolator
For the indices 1 to 5 and 25 to 29, the interpolator object uses linear
interpolation in both cases. The reason for this is that there are not
enough low-rate samples surrounding the interpolation points at those
indices to use FIR interpolation with the specified filter length.
Interpolate a sinusoid with linear interpolation:
t = 0:.0001:.0511;
x = sin(2*pi*20*t);
x1 = x(1:50:end);
I = 1:0.1:length(x1);
H = dsp.Interpolator('InterpolationPointsSource',...
'Input port');
y = H.step(x1',I');
stem(I',y, 'r');
title('Original and Interpolated Signal');
hold on; stem(x1, 'Linewidth', 2);
legend('Interpolated','Original');
3-816
dsp.Interpolator
3-817
dsp.Interpolator
Algorithms
See Also
3-818
dsp.Interpolator.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-819
dsp.Interpolator.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-820
dsp.Interpolator.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-821
dsp.Interpolator.isLocked
Purpose
Syntax
isLocked(H)
Description
3-822
dsp.Interpolator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-823
dsp.Interpolator.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,IPTS)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-824
dsp.KalmanFilter
Purpose
Description
3-825.
2 Call step to filter each channel of the input according to the
Construction
3-825
dsp.KalmanFilter
Properties
StateTransitionMatrix
3-826
dsp.KalmanFilter
3-827
dsp.KalmanFilter
Methods
Examples
clone
isLocked
release
reset
step
Add noise to the scalar, and pass the result to the Kalman filter. Step
through the System objects to obtain the data streams, and plot the
filtered signal:
3-828
dsp.KalmanFilter
while(~isDone(hSig))
trueVal = step(hSig);
noisyVal = trueVal + sqrt(R)*randn;
estVal = step(hKalman, noisyVal);
step(hTScope,noisyVal,trueVal,estVal);
end
numSamples = 4000;
R = 0.02;
hSig = dsp.SignalSource;
hSig.Signal = [ ones(numSamples/4,1);
-3*ones(numSamples/4,1);...
4*ones(numSamples/4,1); -0.5*ones(numSamples/4,1)];
hTScope = dsp.TimeScope('NumInputPorts', 3, 'TimeSpan', numSamples, ..
'TimeUnits', 'Seconds', 'YLimits',[-5 5], ...
'Title', ['True(channel 1), noisy(channel 2) and ',...
'estimated(channel 3) values'], ...
'ShowLegend', true);
hKalman = dsp.KalmanFilter('ProcessNoiseCovariance', 0.0001,...
'MeasurementNoiseCovariance', R,...
'InitialStateEstimate', 5,...
'InitialErrorCovarianceEstimate', 1,...
'ControlInputPort',false);
ctr = 0;
Add noise to the signal. Step through the System objects to obtain the
data streams, and plot the filtered signal:
while(~isDone(hSig))
trueVal = step(hSig);
noisyVal = trueVal + sqrt(R)*randn;
estVal = step(hKalman, noisyVal);
step(hTScope,trueVal,noisyVal,estVal);
% Disabling the correction step of second filter for the middle
3-829
dsp.KalmanFilter
3-830
dsp.KalmanFilter
Add noise to the signal. Step through the System objects to obtain the
data streams, and plot the filtered signal:
while(~isDone(hSig))
trueVal = step(hSig);
noisyVal = trueVal + sqrt(R)*randn(1,2);
estVal = step(hKalman, noisyVal);
% Plot results of first channel on Time Scope
step(hTScope1,trueVal(:,1),noisyVal(:,1),estVal(:,1));
% Plot results of second channel on Time Scope
step(hTScope2,trueVal(:,2),noisyVal(:,2),estVal(:,2));
end
Algorithms
3-831
dsp.KalmanFilter
References
[1] Greg Welch and Gary Bishop, An Introduction to the Kalman Filter,
Technical Report TR95 041. University of North Carolina at Chapel
Hill: Chepel Hill, NC., 1995.
See Also
3-832
Kalman Filter
dsp.KalmanFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-833
dsp.KalmanFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-834
dsp.KalmanFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-835
dsp.KalmanFilter.reset
Purpose
Syntax
reset(H)
Description
3-836
dsp.KalmanFilter.step
Purpose
Syntax
Y = step(H,X)
[Y1,...,YN] = step(H,X)
[zEst, xEst, MSE_Est, zPred, xPred, MSE_Pred] = step(H, z, u)
Description
3-837
dsp.LDLFactor
Purpose
Description
page 3-838.
2 Call step to factor the matrices according to the properties of
the toolbox.
Construction
Properties
Fixed-Point Properties
AccumulatorDataType
3-838
dsp.LDLFactor
3-839
dsp.LDLFactor
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-840
dsp.LDLFactor
y = step(hldl, A);
Algorithms
See Also
dsp.LUFactor
3-841
dsp.LDLFactor.clone
Purpose
Syntax
C = clone(H)
Description
3-842
dsp.LDLFactor.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-843
dsp.LDLFactor.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-844
dsp.LDLFactor.isLocked
Purpose
Syntax
isLocked(H)
Description
3-845
dsp.LDLFactor.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-846
dsp.LDLFactor.step
Purpose
Syntax
Y = step(H,S)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-847
dsp.LevinsonSolver
Purpose
Description
3-848.
2 Call step to solve the system of equations according to the properties
Construction
Properties
AOutputPort
3-848
dsp.LevinsonSolver
3-849
dsp.LevinsonSolver
3-850
dsp.LevinsonSolver
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Reflection coefficients
corresponding to columns of
input
3-851
dsp.LevinsonSolver
a = step(hac, x);
c = step(hlevinson, a); % Compute polynomial coefficients
Algorithms
See Also
3-852
dsp.Autocorrelator
dsp.LevinsonSolver.clone
Purpose
Syntax
C = clone(H)
Description
unlocked object.
3-853
dsp.LevinsonSolver.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-854
dsp.LevinsonSolver.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-855
dsp.LevinsonSolver.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-856
dsp.LevinsonSolver.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-857
dsp.LevinsonSolver.step
Purpose
Syntax
K = step(H,X)
A = step(H,X)
[A, K] = step(H,X)
[..., P] = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-858
dsp.LMSFilter
Purpose
Description
on page 3-859.
2 Call step to implement the filter according to the properties of
the toolbox.
Construction
computes the filtered output, filter error and the filter weights for a
given input and desired signal using the Least Mean Squares (LMS)
algorithm.
H = dsp.LMSFilter('PropertyName', PropertyValue,...) returns
an LMS filter object, H, with each property set to the specified value.
H = dsp.LMSFilter(LEN,'PropertyName',PropertyValue,...)
returns an LMS filter object, H, with the Length property set to LEN, and
Properties
Method
3-859
dsp.LMSFilter
3-860
dsp.LMSFilter
3-861
dsp.LMSFilter
OverflowAction
3-862
dsp.LMSFilter
3-863
dsp.LMSFilter
3-864
dsp.LMSFilter
3-865
dsp.LMSFilter
Methods
3-866
clone
getNumInputs
getNumOutputs
dsp.LMSFilter
Examples
isLocked
maxstep
msepred
msesim
release
reset
step
3-867
dsp.LMSFilter
Algorithms
y(n) w T (n 1)u(n)
e(n) d(n) y(n)
w(n) w(n 1) f (u(n), e(n), )
The various LMS adaptive filter algorithms available in this System
object are defined as:
LMS:
3-868
u (n)
+ u H (n)u(n)
dsp.LMSFilter
Sign-Error LMS:
See Also
Variable
Description
u(n)
u*(n)
w(n)
y(n)
e(n)
d(n)
dsp.BlockLMSFilter | dsp.DigitalFilter
3-869
dsp.LMSFilter.maxstep
Purpose
Syntax
MUMAX = maxstep(H,X)
[MUMAX,MUMAXMSE] = maxstep(H,X)
Description
3-870
dsp.LMSFilter.msepred
Purpose
Syntax
[MMSE,EMSE] = msepred(H,X,D)
[MMSE,EMSE,MEANW,MSE,TRACEK] = msepred(H,X,D)
[MMSE,EMSE,MEANW,MSE,TRACEK] = msepred(H,X,D,M)
Description
3-871
dsp.LMSFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-872
dsp.LMSFilter.msesim
l = 32;
mu = 0.008;
m = 5;
%
%
%
%
Filter length
LMS Step size.
Decimation factor for analysis
and simulation results
ha = dsp.LMSFilter(l,'StepSize',mu);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
plot(m*(1:length(simmse)),10*log10(simmse));
xlabel('Iteration'); ylabel('MSE (dB)');
title('Learning curve for LMS filter used in system identification')
3-873
dsp.LMSFilter.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-874
dsp.LMSFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-875
dsp.LMSFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-876
dsp.LMSFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-877
dsp.LMSFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-878
dsp.LMSFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the LMS FIR filter,H, to their initial
values specified in the InitialConditions property. The initial filter
3-879
dsp.LMSFilter.step
Purpose
Syntax
[Y,ERR,WTS] = step(H,X,D)
[Y, ERR] = step(H,X,D)
[...] = step(H,X,D,MU)
[...] = step(H,X,D,A)
[...] = step(H,X,D,R)
[Y,ERR,WTS] = step(H,X,D,MU,A,R)
Description
the mean square error between the output and the desired signal.
[Y, ERR] = step(H,X,D) filters the input X , using D as the desired
signal. This approach returns the filtered output in Y and the filter
error in ERR when the WeightsOutputPort property is false.
[...] = step(H,X,D,MU) uses MU as the step size, when the
StepSizeSource property is 'Input port'.
[...] = step(H,X,D,A) uses A as the adaptation control, when the
AdaptInputPort property is true. When A is nonzero, the LMS filter
continuously updates the filter weights. When A is zero, the filter
3-880
dsp.LMSFilter.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-881
dsp.LogicAnalyzer
Purpose
Description
3-883.
2 Call step to display the transitions of the signals in the Logic
3-882
dsp.LogicAnalyzer
See the following sections for more information on the Logic Analyzer
Graphical User Interface:
Signal Display on page 3-890
Toolbar on page 3-895
Construction
Properties
BackgroundColor
3-883
dsp.LogicAnalyzer
'White'
This property is Tunable.
Default: 'Cyan'
DisplayChannelFontSize
3-884
dsp.LogicAnalyzer
Default: 1
DisplayChannelRadix
3-885
dsp.LogicAnalyzer
3-886
dsp.LogicAnalyzer
ReduceUpdates
3-887
dsp.LogicAnalyzer
See TimeSpan for information on the x-axis limits and time span
settings.
Default: 0
TimeSpan
Methods
3-888
addCursor
addDivider
addWave
clone
deleteCursor
deleteDisplayChannel
getCursorInfo
getCursorTags
getDisplayChannelInfo
dsp.LogicAnalyzer
Examples
getDisplayChannelTags
getNumInputs
getNumOutputs
hide
isLocked
modifyCursor
modifyDisplayChannel
moveDisplayChannel
release
reset
show
step
The following examples illustrate how to use the Logic Analyzer object
to view a variety of input signals in the time domain.
3-889
dsp.LogicAnalyzer
Run the release method to let property values and input characteristics
change.
release(hla1);
Signal
Display
3-890
Logic Analyzer uses the Time span and Time display offset
properties to determine the time range. To change the signal display
settings, modify these properties. For example, if you set the Time span
to 25 seconds, the scope displays 25 seconds worth of simulation data at
dsp.LogicAnalyzer
a time. If you also set the Time display offset to 5 seconds, the scope
displays values on the time-axis from 5 to 30 seconds.
To communicate the simulation time that corresponds to the current
display, the scope uses the Simulation time indicators on the scope
window. The following figure highlights these and other important
aspects of the Logic Analyzer window.
3-891
dsp.LogicAnalyzer
3-892
dsp.LogicAnalyzer
Indicators
Display Channels The scope displays on the y-axis a number of
display channels. Each display channel may contain either a wave
or a divider and is identified by a unique tag. The displayed values
are the signal values for the sample period from one transition to
another. To get the tags for an existing display channel, call the
getDisplayChannelTags method. To get information about an
existing display channel, call the getDisplayChannelInfo method.
To modify the properties of an existing display channel, call the
modifyDisplayChannel method. To move a display channel, call the
moveDisplayChannel method. To delete a display channel, call the
deleteDisplayChannel method.
To select a display channel, click on its name. Use shift-click or
control-click (command-click on the Mac OS X platform) to select
or deselect multiple display channels. When one or more channels
are selected, you can use the Edit menu or right-click and use the
context menu to cut, copy, and paste channels. The right-click
context menu also lets you add a wave or divider, and modify, move,
or delete channels.
3-893
dsp.LogicAnalyzer
Processing Occurs after you run the step method and before
you run the release method.
Stopped Occurs after you construct the scope object and before
you first run the step method. This status also occurs after you
run the release method.
3-894
dsp.LogicAnalyzer
length( x)
formula: tsim tsim
. To set the sample rate, modify
SampleRate
the SampleTime property.
The Simulation time is part of the Status Bar in the scope window.
You can choose to hide or display the entire Status Bar. From the
scope menu, select View > Status Bar .
Minimum time-axis limit The scope sets the minimum time-axis
limit using the value of the Time display offset property.
Maximum time-axis limit The scope sets the maximum time-axis
limit by summing the value of Time display offset parameter with
the value of the Time span parameter.
Toolbar
You can control whether the toolbar appears in the Logic Analyzer
window. From the Logic Analyzer menu, select View > Toolbar. The
Logic Analyzer toolbar contains the following buttons.
Button
Shortcut Description
Keys
n/a
n/a
Left
arrow,
Right
arrow
3-895
dsp.LogicAnalyzer
Button
Shortcut Description
Keys
n/a
+, i
, o, _
n/a
n/a
Visuals
Logic
Analyzer
Properties
3-896
dsp.LogicAnalyzer
Background Color
Specify the background color of the display to be either 'Black' or
'White'.
Radix
Specify as a string the radix (i.e., base of the numeric system) from
one of the following options:
'Binary' Displays values as 0s and 1s.
'Hexadecimal' Displays values as symbols from 0 to 9 and A to F
'Octal' Displays values as numbers from 0 to 7
'Signed decimal' Displays the signed, stored integer value
3-897
dsp.LogicAnalyzer
Height
Specify as a scalar integer the height of the channels in the display
in units of 16 pixels.
Color
Specify the color for channels in the display to be one of the following
options:
'Black'
'Blue'
'Green'
'Cyan'
'Red'
'Magenta'
'White'
Format
Specify as a string the wave format from one of the following options:
'Analog' Shows values as an analog plot
'Digital' Shows values as digital transitions
Font Size
Specify as a scalar nonnegative integer the font size in points for values
shown in the channels in the display.
Spacing
Specify as a positive scalar integer the spacing between channels in the
display in units of 4 pixels.
3-898
dsp.LogicAnalyzer
Logic
Analyzer
Modify
display
channel
If you select more than one channel wave or divider, the dialog box
shows only these fields.
3-899
dsp.LogicAnalyzer
If you select more than one channel wave or divider with different
property values, No change is displayed for that property. Selecting a
value applies that value to all selected channels.
Input Channel
Select the input data source for the channel. This field is displayed only
if you selected a single channel or divider.
Name
Specify the name to display for the selected channel or divider. This
field is displayed only if you selected a single channel or divider.
Radix
Select the radix (base of the numeric system) from one of the following
options:
Default Uses the default value specified in the Visuals Logic
Analyzer Properties dialog box.
Hexadecimal Displays values as symbols from 0 to 9 and A to F
Octal Displays values as numbers from 0 to 7
Binary Displays values as 0s and 1s.
3-900
dsp.LogicAnalyzer
Color
Select the color for channels in the display to be one of the following
options:
Default Uses the default color specified in the Visuals Logic
Analyzer Properties dialog box.
Black
Blue
Green
Cyan
Red
Magenta
Yellow
White
Height
Specify as a scalar integer the height of the selected channel in the
display in units of 16 pixels. Setting the height to 0 uses the default
value specified in the Visuals Logic Analyzer Properties dialog
box. If you have selected more than one channel, specify a scalar integer
to apply the same height to all channels or a vector of integer heights to
apply different heights to each selected channel.
Font Size
Specify as a scalar integer the font size of the selected channel in the
display in units of 16 pixels. Setting the font size to 0 uses the default
value specified in the Visuals Logic Analyzer Properties dialog
box. If you have selected more than one channel, specify a scalar integer
3-901
dsp.LogicAnalyzer
to apply the same font size to all channels or a vector of font sizes to
apply different fone sizes to each selected channel.
Format
Select the wave format from one of the following options:
Default Uses the default format specified in the Visuals Logic
Analyzer Properties dialog box.
Digital Shows values as digital transitions
Analog Shows values as an analog plot
See Also
3-902
dsp.LogicAnalyzer.addCursor
Purpose
Syntax
cursorTag = addCursor(H)
cursorTag = addCursor(H,'Name',Value)
Description
Input
Arguments
Specify as a string the color of the cursor from one of the following
options:
'Black'
'Blue'
3-903
dsp.LogicAnalyzer.addCursor
'Cyan'
'Green'
'Magenta'
'Red'
'White'
'Yellow'
Example: 'Color','Blue'
Data Types
char
Default: 'Yellow'
Location - Location of the cursor
numeric scalar
Default: 0
Locked - Locked status of the cursor
logical scalar
3-904
dsp.LogicAnalyzer.addCursor
Default: false
3-905
dsp.LogicAnalyzer.addDivider
Purpose
Syntax
dividerTag = addDivider(H)
dividerTag = addDivider(H,'Name',Value)
Description
Input
Arguments
divider
dsp.LogicAnalyzer object
Example: 'addDivider(H)' adds a divider with the default
characteristics.
Example: 'H.addDivider()' adds a divider with the default
characteristics.
3-906
dsp.LogicAnalyzer.addDivider
Example: 'DisplayChannel',2
Data Types
double | single | uint8 | uint16 | uint32 | uint64 | int8 |
int16 | int32 | int64
Default: NumInputPorts
Height - Height of the divider
scalar integer
Default: 0
Name - The name or label for the divider
string
Specify as a string the name that you would like to set for the
new divider.
Example: 'Name','MyDivider'
Data Types
char
Default: ''
3-907
dsp.LogicAnalyzer.addWave
Purpose
Syntax
waveTag = addWave(H)
waveTag = addWave(H,'Name',Value)
Description
Input
Arguments
dsp.LogicAnalyzer object
3-908
dsp.LogicAnalyzer.addWave
'Cyan'
'Default'
'Green'
'Magenta'
'Red'
'White'
'Yellow'
When you choose 'Default', the value of the
DisplayChannelColor property in the Logic Analyzer is
used.
Example: 'Color','Blue'
Data Types
char
Default: 'Default'
DisplayChannel - Channel on the display that shows this wave
scalar numeric value in the range (1,NumInputPorts)
Default: NumInputPorts
FontSize - Font size for values in the wave
scalar nonnegative integer
3-909
dsp.LogicAnalyzer.addWave
Default: 0
Format - Display format for the wave
string enumeration
Default: 'Default'
Height - Height of the wave
scalar integer
3-910
dsp.LogicAnalyzer.addWave
Example: 'Height',2
Data Types
double
Default: 0
InputChannel - Input channel that corresponds to this wave
scalar integer in the range (1,NumInputPorts)
This property specifies the input channel whose data is used for
this wave. By default, it will connect the first input to this wave.
Example: 'InputChannel',2
Data Types
double | single | uint8 | uint16 | uint32 | uint64 | int8 |
int16 | int32 | int64
Default: 1
Name - The name or label for the wave
string
Specify as a string the name that you would like to set for the
new wave.
Example: 'Name','MyWave'
Data Types
char
Default: ''
Radix - Radix for the wave
string enumeration
3-911
dsp.LogicAnalyzer.addWave
'Default'
'Hexadecimal'
'Octal'
'Signed decimal'
'Unsigned decimal'
When the input signals are of class double, single, or logical, you
should not set this property. When you choose 'Default', the
value of the DisplayChannelRadix property in the Logic Analyzer
is used.
Example: 'Radix','Hexadecimal'
Data Types
char
Default: 'Default'
3-912
dsp.LogicAnalyzer.clone
Purpose
Syntax
C = clone(H)
Description
states.
3-913
dsp.LogicAnalyzer.deleteCursor
Purpose
Syntax
deleteCursor(H,tag)
deleteCursor(H,'CursorTag',tag)
Description
Input
Arguments
cursor
dsp.LogicAnalyzer object handle
The Logic Analyzer object from which you want to delete a cursor,
specified as a handle to the dsp.LogicAnalyzer object.
tag - The tag identifying which cursor to delete
3-914
dsp.LogicAnalyzer.deleteCursor
3-915
dsp.LogicAnalyzer.deleteDisplayChannel
Purpose
Syntax
deleteDisplayChannel(H,tag)
deleteDisplayChannel(H,'DisplayChannelTag',tag)
Description
Input
Arguments
a display channel
dsp.LogicAnalyzer object
The Logic Analyzer object from which you want to delete a display
channel, specified as a handle to the dsp.LogicAnalyzer object.
tag - The tag identifying which display channel to delete
string
3-916
dsp.LogicAnalyzer.deleteDisplayChannel
to delete
string
The tag identifying which display channel to delete, specified as a
string.
Example: 'DisplayChannelTag','C5'
Data Types
char
3-917
dsp.LogicAnalyzer.getCursorInfo
Purpose
Syntax
getCursorInfo(H,'CursorTag',tag)
Description
Input
Arguments
cursor settings
dsp.LogicAnalyzer object
The Logic Analyzer object from which you want to return cursor
settings, specified as a handle to the dsp.LogicAnalyzer object.
3-918
dsp.LogicAnalyzer.getCursorTags
Purpose
Syntax
T = getCursorTags(H)
Description
Input
Arguments
Analyzer. You can use these tags to get information about a cursor
using the dsp.LogicAnalyzer.getCursorInfo method, to modify a
cursor using the dsp.LogicAnalyzer.modifyCursor method, or to
delete a cursor using the dsp.LogicAnalyzer.deleteCursor method.
H - The Logic Analyzer object from which you want to return
Output
Arguments
3-919
dsp.LogicAnalyzer.getDisplayChannelInfo
Purpose
Syntax
getDisplayChannelInfo(H,'DisplayChannelTag',tag)
Description
Input
Arguments
3-920
dsp.LogicAnalyzer.getDisplayChannelTags
Purpose
Syntax
T = getDisplayChannelTags(H)
Description
Input
Arguments
Output
Arguments
3-921
dsp.LogicAnalyzer.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-922
dsp.LogicAnalyzer.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-923
dsp.LogicAnalyzer.hide
Purpose
Syntax
hide(H)
Description
See Also
dsp.LogicAnalyzer.show
3-924
dsp.LogicAnalyzer.isLocked
Purpose
Syntax
isLocked(H)
Description
3-925
dsp.LogicAnalyzer.modifyCursor
Purpose
Syntax
modifyCursor(H,tag)
modifyCursor(H,'CursorTag',tag)
modifyCursor(H,tag,'Name',Value)
modifyCursor(H,'CursorTag',tag,'Name',Value)
Description
order.
modifyCursor(H,'CursorTag',tag,'Name',Value) modifies the
properties of the cursor specified by the input tag with each specified
property Name set to the specified value. You can specify NameValue
arguments in any order.
Input
Arguments
cursor
dsp.LogicAnalyzer object
The Logic Analyzer object for which you want to modify a cursor
specified, as a handle to the dsp.LogicAnalyzer object.
tag - The tag identifying which cursor to modify
3-926
dsp.LogicAnalyzer.modifyCursor
Specify as a string the color of the cursor from one of the following
options:
'Black'
'Blue'
'Cyan'
'Green'
'Magenta'
'Red'
'White'
'Yellow'
Example: 'Color','Blue'
Data Types
char
Default: 'Yellow'
3-927
dsp.LogicAnalyzer.modifyCursor
Default: 0
Locked - Locked status of the cursor
logical scalar
Default: false
3-928
dsp.LogicAnalyzer.modifyDisplayChannel
Purpose
Syntax
modifyDisplayChannel(H,tag,'Name',Value)
modifyDisplayChannel(H,'CursorTag',tag,'Name',Value)
Description
the properties of the display channel specified by the input tag with
each specified property Name set to the specified value. You can specify
NameValue arguments in any order.
Input
Arguments
a display channel
dsp.LogicAnalyzer object
The Logic Analyzer object for which you want to modify a display
channel, specified as a handle to the dsp.LogicAnalyzer object.
tag - The tag identifying which display channel to modify
3-929
dsp.LogicAnalyzer.modifyDisplayChannel
3-930
dsp.LogicAnalyzer.modifyDisplayChannel
Default: 'Default'
DisplayChannel - Channel on the display that shows this wave
scalar numeric value in the range (1,NumInputPorts)
Default: NumInputPorts
FontSize - Font size for values in the wave
scalar nonnegative integer
Default: 0
Format - Display format for the wave
string enumeration
3-931
dsp.LogicAnalyzer.modifyDisplayChannel
Default: 'Default'
Height - Height of the wave
scalar integer
Default: 0
InputChannel - Input channel that corresponds to this wave
scalar integer in the range (1,NumInputPorts)
This property specifies the input channel whose data is used for
this wave. By default, it will connect the first input to this wave.
Example: 'InputChannel',2
Data Types
double | single | uint8 | uint16 | uint32 | uint64 | int8 |
int16 | int32 | int64
Default: 1
Name - The name or label for the wave
string
3-932
dsp.LogicAnalyzer.modifyDisplayChannel
Specify as a string the name that you would like to set for the
new wave.
Example: 'Name','MyWave'
Data Types
char
Default: ''
Radix - Radix for the wave
string enumeration
Default: 'Default'
3-933
dsp.LogicAnalyzer.modifyDisplayChannel
Default: NumInputPorts
Height - Height of the divider
scalar integer
Default: 0
Name - The name or label for the divider
3-934
dsp.LogicAnalyzer.modifyDisplayChannel
string
Specify as a string the name that you would like to set for the
new divider.
Example: 'Name','MyDivider'
Data Types
char
Default: ''
3-935
dsp.LogicAnalyzer.moveDisplayChannel
Purpose
Syntax
moveDisplayChannel(H,'DisplayChannelTag',tag,'DisplayChannel',
displaychannelvalue)
Description
moveDisplayChannel(H,'DisplayChannelTag',tag,'DisplayChannel',
displaychannelvalue) moves the display channel, either a wave or a
Input
Arguments
display channel
dsp.LogicAnalyzer object
The Logic Analyzer object in which you want to move a display
channel, specified as a handle to the dsp.LogicAnalyzer object.
to move
string
The tag identifying which display channel to move, specified as a
string.
Example: 'DisplayChannelTag','W1'
Data Types
char
3-936
dsp.LogicAnalyzer.moveDisplayChannel
3-937
dsp.LogicAnalyzer.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
You should call the release method after calling the step method when
there is no new data for the simulation. When you call the release
method, the axes will automatically scale in the scope figure window.
After calling the release method, any non-tunable properties can be
set once again.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
Algorithms
See Also
dsp.LogicAnalyzer.reset
3-938
dsp.LogicAnalyzer.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the internal states of the scope object H to their initial
values.
You should call the reset method after calling the step method when
you want to clear the scope figure displays, prior to releasing system
resources. This action enables you to start a simulation from the
beginning. When you call the reset method, the displays will become
blank again. In this sense, its functionality is similar to that of the
MATLAB clf function. Do not call the reset method after calling the
release method.
Algorithms
See Also
dsp.LogicAnalyzer | dsp.LogicAnalyzer.release
3-939
dsp.LogicAnalyzer.show
Purpose
Syntax
show(H)
Description
See Also
3-940
visible.
dsp.LogicAnalyzer.hide
dsp.LogicAnalyzer.step
Purpose
Syntax
step(H,X)
step(H,X1,X2,...,XN)
Description
3-941
dsp.LowerTriangularSolver
Purpose
Description
page 3-942.
2 Call step to solve the equation according to the properties of
Construction
Properties
OverwriteDiagonal
3-942
dsp.LowerTriangularSolver
Fixed-Point Properties
RoundingMethod
3-943
dsp.LowerTriangularSolver
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-944
dsp.LowerTriangularSolver
u = tril(rand(4, 4));
b = rand(4, 1);
% Check that result is the solution to the linear
% equations.
x1 = inv(u)*b
x = step(hlowtriang, u, b)
Algorithms
See Also
dsp.UpperTriangularSolver
3-945
dsp.LowerTriangularSolver.clone
Purpose
Syntax
C = clone(H)
Description
3-946
dsp.LowerTriangularSolver.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-947
dsp.LowerTriangularSolver.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-948
dsp.LowerTriangularSolver.isLocked
Purpose
Syntax
isLocked(H)
Description
3-949
dsp.LowerTriangularSolver.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-950
dsp.LowerTriangularSolver.step
Purpose
Syntax
X = step(H,L,B)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-951
dsp.LPCToAutocorrelation
Purpose
Description
Construction
autocorrelation coefficients.
H =
dsp.LPCToAutocorrelation('PropertyName',PropertyValue,...)
returns an LPC to autocorrelation conversion object, H, with each
Properties
PredictionErrorInputPort
3-952
dsp.LPCToAutocorrelation
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
See Also
3-953
dsp.LPCToAutocorrelation.clone
Purpose
Syntax
C = clone(H)
Description
unlocked object.
3-954
dsp.LPCToAutocorrelation.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-955
dsp.LPCToAutocorrelation.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-956
dsp.LPCToAutocorrelation.isLocked
Purpose
Syntax
isLocked(H)
Description
3-957
dsp.LPCToAutocorrelation.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-958
dsp.LPCToAutocorrelation.step
Purpose
Syntax
AC = step(H,A)
AC = step(H,A,P)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-959
dsp.LPCToCepstral
Purpose
Description
on page 3-960.
2 Call step to convert LPC according to the properties of
in the toolbox.
Construction
coefficients (CCs).
H = dsp.LPCToCepstral('PropertyName',PropertyValue,...)
returns an LPC to cepstral converter object, H, with each specified
Properties
PredictionErrorInputPort
3-960
dsp.LPCToCepstral
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-961
dsp.LPCToCepstral
hac.MaximumLagSource = 'Property';
hac.MaximumLag = 9; % Compute autocorrelation lags between [0:9]
hlpc2cc = dsp.LPCToCepstral;
x = [1:100]';
a = step(hac, x);
A = step(hlevinson, a); % Compute LPC coefficients
CC = step(hlpc2cc, A); % Convert LPC to CC.
Algorithms
See Also
3-962
dsp.LPCToCepstral.clone
Purpose
Syntax
C = clone(H)
Description
3-963
dsp.LPCToCepstral.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-964
dsp.LPCToCepstral.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-965
dsp.LPCToCepstral.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-966
dsp.LPCToCepstral.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-967
dsp.LPCToCepstral.step
Purpose
Syntax
CC = step(H,A)
CC = step(H,A,P)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-968
dsp.LPCToLSF
Purpose
Description
on page 3-969.
2 Call step to convert LPC according to the properties of dsp.LPCToLSF.
Construction
Properties
NumCoarseGridPoints
3-969
dsp.LPCToLSF
1
k
(n 2
)
of the
actual
LSP value. Here n is the value of the
NumCoarseGridPoints property, and the object searches a
3-970
dsp.LPCToLSF
Methods
clone
getNumInputs
getNumOutputs
isLocked
release
3-971
dsp.LPCToLSF
Examples
reset
step
Algorithms
See Also
3-972
dsp.LSFToLPC | dsp.LPCToLSP
dsp.LPCToLSF.clone
Purpose
Syntax
C = clone(H)
Description
3-973
dsp.LPCToLSF.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-974
dsp.LPCToLSF.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-975
dsp.LPCToLSF.isLocked
Purpose
Syntax
isLocked(H)
Description
3-976
dsp.LPCToLSF.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-977
dsp.LPCToLSF.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the values for overwriting the invalid outputs to their
initial values.
3-978
dsp.LPCToLSF.step
Purpose
Syntax
LSF = step(H,A)
[..., STATUS] = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-979
dsp.LPCToLSP
Purpose
Description
on page 3-980.
2 Call step to convert LPC according to the properties of dsp.LPCToLSP.
Construction
Properties
NumCoarseGridPoints
3-980
dsp.LPCToLSP
1
n 2k
of the actual LSP value. Here n is the value of the
NumCoarseGridPoints property and the object searches a
maximum of
k (n-1)
points for finding the roots. The NumBisects property value k,
must be a positive scalar integer. The default is 4. This property
is tunable.
ExceptionOutputPort
3-981
dsp.LPCToLSP
Specify the source of values for the first output when the output is
invalid as Auto or Property. This property applies only when you
set the OverwriteInvalidOutput property to true. The default is
Auto. When this property is Auto, the object uses a default value
for the first output. The default value corresponds to the LSP
representation of an allpass filter.
FirstOutputValues
Methods
3-982
clone
getNumInputs
getNumOutputs
isLocked
dsp.LPCToLSP
Examples
release
reset
step
Algorithms
See Also
dsp.LSPToLPC | dsp.LPCToLSF
3-983
dsp.LPCToLSP.clone
Purpose
Syntax
C = clone(H)
Description
3-984
dsp.LPCToLSP.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-985
dsp.LPCToLSP.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-986
dsp.LPCToLSP.isLocked
Purpose
Syntax
isLocked(H)
Description
3-987
dsp.LPCToLSP.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-988
dsp.LPCToLSP.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the values for overwriting the invalid outputs to their
initial values.
3-989
dsp.LPCToLSP.step
Purpose
Syntax
LSF = step(H,A)
[..., STATUS] = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-990
dsp.LPCToRC
Purpose
Description
on page 3-991.
2 Call step to convert LPC according to the properties of dsp.LPCToRC.
Construction
specified value.
Properties
PredictionErrorOutputPort
3-991
dsp.LPCToRC
Specify the action that the object takes when the first coefficient
of each channel of the LPC input is not 1. Select Replace with 1
or Normalize. The default is Replace with 1.
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-992
dsp.LPCToRC
Algorithms
See Also
dsp.RCToLPC | dsp.LPCToAutocorrelation
3-993
dsp.LPCToRC.clone
Purpose
Syntax
C = clone(H)
Description
3-994
dsp.LPCToRC.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-995
dsp.LPCToRC.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-996
dsp.LPCToRC.isLocked
Purpose
Syntax
isLocked(H)
Description
3-997
dsp.LPCToRC.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-998
dsp.LPCToRC.step
Purpose
Syntax
[K,P] = step(H,A)
K = step(H,A)
[..., S] = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-999
dsp.LSFToLPC
Purpose
Description
on page 3-1000.
2 Call step to convert LSF according to the propeties of dsp.LSFToLPC.
Construction
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1000
dsp.LSFToLPC
hlpc2lsf = dsp.LPCToLSF;
ylsf = step(hlpc2lsf, a);
hlsf2lpc = dsp.LSFToLPC;
ylpc = step(hlsf2lpc, ylsf) % Check values are same as a.
Algorithms
See Also
dsp.LPCToLSF | dsp.LSPToLPC
3-1001
dsp.LSFToLPC.clone
Purpose
Syntax
C = clone(H)
Description
3-1002
dsp.LSFToLPC.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1003
dsp.LSFToLPC.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1004
dsp.LSFToLPC.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1005
dsp.LSFToLPC.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1006
dsp.LSFToLPC.step
Purpose
Syntax
A = step(H,LSF)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1007
dsp.LSPToLPC
Purpose
Description
on page 3-1008.
2 Call step to convert LSP according to the properties of dsp.LSPToLPC.
Construction
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1008
dsp.LSPToLPC
Algorithms
See Also
dsp.LPCToLSP | dsp.LSFToLPC
3-1009
dsp.LSPToLPC.clone
Purpose
Syntax
C = clone(H)
Description
3-1010
dsp.LSPToLPC.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1011
dsp.LSPToLPC.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1012
dsp.LSPToLPC.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1013
dsp.LSPToLPC.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1014
dsp.LSPToLPC.step
Purpose
Syntax
A = step(H,LSP)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1015
dsp.LUFactor
Purpose
Description
The LUFactor object factors a square matrix into lower and upper
triangular matrices.
To factor a square matrix into lower and upper triangular matrices:
1 Define and set up your System object. See Construction on page
3-1016.
2 Call step to factor the square matrix according to the properties
Construction
value.
Properties
ExceptionOutputPort
3-1016
dsp.LUFactor
3-1017
dsp.LUFactor
OutputDataType
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1018
dsp.LUFactor
Algorithms
See Also
dsp.LDLFactor
3-1019
dsp.LUFactor.clone
Purpose
Syntax
C = clone(H)
Description
3-1020
dsp.LUFactor.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1021
dsp.LUFactor.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1022
dsp.LUFactor.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1023
dsp.LUFactor.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1024
dsp.LUFactor.step
Purpose
Syntax
[LU,P] = step(H,A)
[LU,P,S] = step(H,A)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
.
3-1025
dsp.MatFileReader
Purpose
Description
3-1026.
2 Call step to read the MAT file according to the properties of
in the toolbox.
Construction
values.
Properties
Filename
3-1026
dsp.MatFileReader
FrameBasedProcessing
Methods
Examples
clone
isDone
End-of-file status
isLocked
release
reset
step
originalData = rand(40,2);
3-1027
dsp.MatFileReader
See Also
3-1028
dsp.MatFileWriter
dsp.MatFileReader.clone
Purpose
Syntax
C = clone(H)
Description
3-1029
dsp.MatFileReader.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1030
dsp.MatFileReader.isDone
Purpose
End-of-file status
Syntax
STATUS = isDone(H)
Description
3-1031
dsp.MatFileReader.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1032
dsp.MatFileReader.reset
Purpose
Syntax
reset(H)
Description
of the file.
3-1033
dsp.MatFileReader.step
Purpose
Syntax
X = step(H)
Description
3-1034
dsp.MatFileWriter
Purpose
Description
3-1035.
2 Call step to write data according to the properties of
in the toolbox.
Construction
Properties
Filename
3-1035
dsp.MatFileWriter
FrameBasedProcessing
Methods
Examples
clone
isLocked
release
step
See Also
3-1036
dsp.MatFileReader
dsp.MatFileWriter.clone
Purpose
Create MAT file writer object with the same property values
Syntax
C = clone(H)
Description
3-1037
dsp.MatFileWriter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1038
dsp.MatFileWriter.release
Purpose
Syntax
release(H)
Description
3-1039
dsp.MatFileWriter.step
Purpose
Syntax
step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1040
dsp.Maximum
Purpose
Description
3-1041.
2 Call step to find the maximum according to the properties of
toolbox.
Construction
specified value.
Properties
ValueOutputPort
3-1041
dsp.Maximum
3-1042
dsp.Maximum
3-1043
dsp.Maximum
3-1044
dsp.Maximum
Methods
clone
getNumInputs
3-1045
dsp.Maximum
Examples
getNumOutputs
isLocked
release
reset
step
Maximum value
Algorithms
3-1046
dsp.Maximum
See Also
dsp.Minimum | dsp.Mean
3-1047
dsp.Maximum.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-1048
dsp.Maximum.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1049
dsp.Maximum.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1050
dsp.Maximum.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1051
dsp.Maximum.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1052
dsp.Maximum.reset
Purpose
Syntax
reset(H)
Description
3-1053
dsp.Maximum.step
Purpose
Maximum value
Syntax
[VAL,IND] = step(H,X)
VAL = step(H,X)
IND = step(H,X)
VAL = step(H,X,R)
[...] = step(H,I,ROI)
[...] = step(H,I,LABEL,LABELNUMBERS)
[...,FLAG] = step(H,I,ROI)
[...,FLAG] = step(H,I,LABEL,LABELNUMBERS)
Description
3-1054
dsp.Maximum.step
indicating whether the input label numbers are valid. To enable this
type of processing, set the ROIProcessing and ValidityOutputPort
properties to true and the ROIForm property to Label matrix.
For full ROI processing support, install the Computer Vision System
Toolbox product. If you only have the DSP System Toolbox product
installed, you can only specify the value of the ROIForm property as
Rectangles.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1055
dsp.Mean
Purpose
Description
3-1056.
2 Call step to compute the mean according to the properties of
toolbox.
Construction
value.
Properties
RunningMean
3-1056
dsp.Mean
3-1057
dsp.Mean
3-1058
dsp.Mean
3-1059
dsp.Mean
CustomOutputDataType
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Mean value
3-1060
dsp.Mean
y = step(hmean2, x);
% y(i) is the mean of all values in the vector x(1:i)
Algorithms
See Also
dsp.Maximum | dsp.Minimum
3-1061
dsp.Mean.clone
Purpose
Syntax
C = clone(H)
Description
states.
3-1062
dsp.Mean.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1063
dsp.Mean.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1064
dsp.Mean.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1065
dsp.Mean.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1066
dsp.Mean.reset
Purpose
Syntax
reset(H)
Description
reset(H) sets the internal states of the Mean object H to their initial
values.
3-1067
dsp.Mean.step
Purpose
Mean value
Syntax
Y = step(H,X)
Y = step(H,X,R)
Y = step(H,X,ROI)
Y = step(H,X,LABEL,LABELNUMBERS)
[Y,FLAG] = step(H,X,ROI)
[Y,FLAG] = step(H,X,LABEL,LABELNUMBERS)
Description
method.
Y = step(H,X,R) resets the computation of the running mean based on
the value of the reset signal, R, and the ResetCondition property. To
enable this type of processing, set the RunningMean property to true
and the ResetInputPort property to true.
Y = step(H,X,ROI) computes the mean of input image X within the
given region of interest ROI. To enable this type of processing, set the
ROIProcessing property to true and the ROIForm property to Lines,
Rectangles or Binary mask.
Y = step(H,X,LABEL,LABELNUMBERS) computes the mean of the
input image, X, for the region whose labels are specified in the vector
LABELNUMBERS. The regions are defined and labeled in the matrix LABEL.
To enable this type of processing, set the ROIProcessing property to
true and the ROIForm property to Label matrix.
[Y,FLAG] = step(H,X,ROI) returns FLAG, indicating whether the
given region of interest ROI, is within the image bounds. To enable this
type of processing, set the ROIProcessing and ValidityOutputPort
properties to true and the ROIForm property to Lines, Rectangles
or Binary mask.
[Y,FLAG] = step(H,X,LABEL,LABELNUMBERS) returns FLAG which
indicates whether the input label numbers are valid. To enable this
type of processing, set the ROIProcessing and ValidityOutputPort
properties to true and the ROIForm property to Label matrix.
3-1068
dsp.Mean.step
For full ROI processing support, install the Computer Vision System
Toolbox product. If you have only the DSP System Toolbox product
installed, you can only specify the value of this property as Rectangles.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1069
dsp.Median
Purpose
Description
The Median object computes the median value of the input. The object
can compute the median along each dimension (row or column) of the
input or of the entire input.
To compute the median of the input:
1 Define and set up your median System object. See Construction
on page 3-1070.
2 Call step to compute the median according to the properties of
toolbox.
Construction
method.
H = dsp.Median('PropertyName',PropertyValue,...) returns a
median System object, H, with each property set to the value you specify.
Properties
SortMethod
Sort method
Specify the method the object should use to sort the data before
computing the median. You can specify Quick sort or Insertion
sort. The quick sort algorithm uses a recursive sort method and
is faster at sorting more than 32 elements. The insertion sort
algorithm uses a nonrecursive method and is faster at sorting less
than 32 elements. If you are using the Median object to generate
code, you should use the insertion sort algorithm to prevent
recursive function calls in your generated code. The default is
Quick sort.
Dimension
3-1070
dsp.Median
3-1071
dsp.Median
Methods
3-1072
clone
getNumInputs
dsp.Median
Examples
getNumOutputs
isLocked
release
step
Median value
Algorithms
See Also
3-1073
dsp.Median.clone
Purpose
Syntax
C = clone(H)
Description
3-1074
dsp.Median.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1075
dsp.Median.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1076
dsp.Median.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1077
dsp.Median.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1078
dsp.Median.step
Purpose
Median value
Syntax
Y = step(H,X)
Description
the result in Y.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1079
dsp.Minimum
Purpose
Description
3-1080.
2 Call step to compute the minimum according to the properties of
toolbox.
Construction
specified value.
Properties
ValueOutputPort
3-1080
dsp.Minimum
3-1081
dsp.Minimum
3-1082
dsp.Minimum
3-1083
dsp.Minimum
ProductDataType
Methods
3-1084
clone
getNumInputs
getNumOutputs
dsp.Minimum
Examples
isLocked
release
reset
step
Algorithms
3-1085
dsp.Minimum
See Also
3-1086
dsp.Maximum | dsp.Mean
dsp.Minimum.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-1087
dsp.Minimum.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1088
dsp.Minimum.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1089
dsp.Minimum.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1090
dsp.Minimum.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1091
dsp.Minimum.reset
Purpose
Syntax
reset(H)
Description
3-1092
reset(H) sets the internal states of the Minimum object H to their initial
values.
dsp.Minimum.step
Purpose
Syntax
[VAL,IND] = step(H,X)
VAL = step(H,X)
IND = step(H,X)
VAL = step(H,X,R)
[...] = step(H,I,ROI)
[...] = step(H,I,LABEL,LABELNUMBERS)
[...,FLAG] = step(H,I,ROI)
[...,FLAG] = step(H,I,LABEL,LABELNUMBERS)
Description
3-1093
dsp.Minimum.step
indicating whether the input label numbers are valid. To enable this
type of processing, set the ROIProcessing and ValidityOutputPort
properties to true and the ROIForm property to Label matrix.
For full ROI processing support, install the Computer Vision System
Toolbox product. If you have only the DSP System Toolbox product
installed, you can only specify the value of the ROIForm property as
Rectangles.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1094
signalblks.MultimediaFileReader
Purpose
Description
on page 3-1095.
2 Call step to read from a multimedia file according to the properties
Construction
file.
H =
signalblks.MultimediaFileReader('PropertyName',PropertyValue,...)
returns a multimedia file reader System object, H, with each specified
Properties
Filename
3-1095
signalblks.MultimediaFileReader
3-1096
signalblks.MultimediaFileReader
Methods
clone
close
Release resources
getNumInputs
getNumOutputs
info
isDone
isLocked
reset
step
3-1097
signalblks.MultimediaFileReader
Examples
Read an audio file and play the file back using the standard audio
output device:
hmfr = signalblks.MultimediaFileReader('speech_dft.avi');
hap = dsp.AudioPlayer('SampleRate', 22050);
while ~isDone(hmfr)
audio = step(hmfr);
step(hap, audio);
end
close(hmfr); % close the input file
close(hap); % close the audio output device
Algorithms
See Also
3-1098
signalblks.MultimediaFileWriter
signalblks.MultimediaFileReader.clone
Purpose
Syntax
C = clone(H)
Description
3-1099
signalblks.MultimediaFileReader.close
Purpose
Release resources
Note MultimediaFileReader will be removed in a future release. Use
AudioFileReader instead. See dsp.AudioFileWriter.release .
Syntax
close(H)
Description
3-1100
signalblks.MultimediaFileReader.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
method
The getNumInputs method returns a positive integer that is the number
of expected inputs (not counting the object itself) to the step method.
This value will change if you alter any properties that turn inputs on or
off. You must call the step method with the number of input arguments
equal to the result of getNumInputs(H).
3-1101
signalblks.MultimediaFileReader.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1102
signalblks.MultimediaFileReader.info
Purpose
Syntax
S = info(H)
Description
Value
Audio
Video
AudioSampleRate
Audio sampling rate of the multimedia file in hertz.
This field is available when the file has audio content.
AudioNumBits Number of bits used to encode the audio stream. This
field is available when the file has audio content.
AudioNumChannels
Number of audio channels. This field is available
when the file has audio content.
FrameRate
3-1103
signalblks.MultimediaFileReader.info
3-1104
Field
Value
VideoSize
VideoFormat
signalblks.MultimediaFileReader.isDone
Purpose
Syntax
STATUS = isDone(H)
Description
3-1105
signalblks.MultimediaFileReader.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1106
signalblks.MultimediaFileReader.reset
Purpose
Syntax
reset(H)
Description
3-1107
signalblks.MultimediaFileReader.step
Purpose
Syntax
AUDIO = step(H)
I = step(H)
[I,AUDIO] = step(H)
[...,EOF] = step(H)
[Y,CB,CR] = step(H)
[Y,CB,CR,AUDIO] = step(H)
Description
each time the output contains the last audio sample and/or video frame
in the file.
[Y,CB,CR] = step(H) outputs one frame of YCbCr 4:2:2 video data in
the color components Y, CB, and CR. This behavior applies when you set
the VideoOutputPort property to true, the ImageColorSpace property
to YCbCr 4:2:2, and an input file which contains video data.
3-1108
signalblks.MultimediaFileReader.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1109
signalblks.MultimediaFileWriter
Purpose
Description
on page 3-1110.
2 Call step to write to a multimedia file according to the properties
Construction
Properties
Filename
3-1110
signalblks.MultimediaFileWriter
3-1111
signalblks.MultimediaFileWriter
VideoInputPort
3-1112
signalblks.MultimediaFileWriter
Methods
clone
close
Release resources
getNumInputs
getNumOutputs
3-1113
signalblks.MultimediaFileWriter
Examples
isLocked
step
Algorithms
3-1114
signalblks.MultimediaFileWriter
See Also
signalblks.MultimediaFileReader
3-1115
signalblks.MultimediaFileWriter.clone
Purpose
Create multimedia file writer object with the same property values
Note MultimediaFileWriter will be removed in a future release. Use
AudioFileWriter instead. See dsp.AudioFileWriter.clone.
Syntax
C = clone(H)
Description
3-1116
signalblks.MultimediaFileWriter.close
Purpose
Release resources
Note MultimediaFileWriter will be removed in a future release. Use
AudioFileWriter instead. See dsp.AudioFileWriter.release.
Syntax
close(H)
Description
3-1117
signalblks.MultimediaFileWriter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1118
signalblks.MultimediaFileWriter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1119
signalblks.MultimediaFileWriter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1120
signalblks.MultimediaFileWriter.step
Purpose
Syntax
step(H,AUDIO)
step(H,I)
step(H,I,AUDIO)
step(H,Y,Cb,Cr)
step(H,Y,CB,CR)
step(H,Y,CB,CR,AUDIO)
Description
signal.
step(H,I,AUDIO) writes one frame of video, I , and one frame of
audio samples, AUDIO , to the output file when you enable both the
AudioInputPort and VideoInputPort properties.
step(H,Y,Cb,Cr) writes one frame of video with Y, Cb, Cr components
to the file. This applies only when you set the FileColorSpace property
to YCbCr 4:2:2
step(H,Y,CB,CR) writes one frame of YCbCr 4:2:2 data in the
color components Y, CB, and CR, to the output file when you set the
VideoInputPort property to true. The width of CB and CR must be
half of the width of Y, and the value of the FileColorSpace property
must be set to YCbCr 4:2:2.
step(H,Y,CB,CR,AUDIO) writes one frame of YCbCr 4:2:2 data in
the color components Y, CB, and CR, and one frame of audio samples,
AUDIO, to the output file when you set both the AudioInputPort and
3-1121
signalblks.MultimediaFileWriter.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1122
dsp.NCO
Purpose
Description
page 3-1123.
2 Call step to generate the signals according to the properties of
Construction
Properties
PhaseIncrementSource
Phase increment
Specify the phase increment as an integer scalar. This property
applies only when you set the PhaseIncrementSource property to
Property. The default is 100.
PhaseOffsetSource
3-1123
dsp.NCO
Phase offset
Specify the phase offset as an integer scalar. This property applies
only when you set the PhaseOffsetSource property to Property.
The default is 0.
Dither
3-1124
dsp.NCO
PhaseQuantizationErrorOutputPort
3-1125
dsp.NCO
Methods
3-1126
clone
getNumInputs
getNumOutputs
info
dsp.NCO
Examples
isLocked
release
reset
step
3-1127
dsp.NCO
'NumDitherBits', 4, ...
'NumQuantizerAccumulatorBits', Nqacc,...
'SamplesPerFrame', 1/Ts, ...
'CustomAccumulatorDataType', numerictype([],Nacc));
y = step(hnco);
% Plot the mean-square spectrum of the 510 Hz sinewave
% generated by the NCO
periodogram(double(y),hann(length(y),'periodic'),[],1/Ts,'power');
Algorithms
See Also
3-1128
dsp.SineWave
dsp.NCO.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states
3-1129
dsp.NCO.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1130
dsp.NCO.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1131
dsp.NCO.info
Purpose
Syntax
S = info(H)
Description
3-1132
Field
Value
NumPointsLUT
SineLUTSize
TheoreticalSFDR
FrequencyResolution
dsp.NCO.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1133
dsp.NCO.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1134
dsp.NCO.reset
Purpose
Syntax
reset(H)
Description
3-1135
dsp.NCO.step
Purpose
Syntax
Y = step(H,INC)
Y = step(H)
Y = step(H,OFFSET)
Y = step(H,INC,OFFSET)
[Y,COSINE] = step(H, ___ )
[Y,QERR] = step(H, ___ )
Description
determines the number of samples per frame of the output signal. The
number of columns of the OFFSET determines the number of channels
of the output signal.
Y = step(H,INC,OFFSET) returns a sinusoidal signal, Y, with
phase increment, INC, and phase offset, OFFSET, when the
PhaseIncrementSource and the PhaseOffsetSource properties are
both Input port. INC and OFFSET must both be row vectors of the
same length, where the length determines the number of channels in
the output signal.
[Y,COSINE] = step(H, ___ ) returns a sinusoidal signal, Y, and a
cosinusoidal signal, COSINE, when the Waveform property is set to
Sine and cosine. This syntax can include any of the input arguments
in previous syntaxes.
3-1136
dsp.NCO.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1137
dsp.Normalizer
Purpose
Description
page 3-1138.
2 Call step to perform vector normalization according to the properties
Construction
the input over each column by the squared 2-norm of the column plus a
bias term of 1e-10 used to protect against divide-by-zero.
H = dsp.Normalizer('PropertyName',PropertyValue, ...) returns
a normalization object, H, with each property set to the specified value.
Properties
Method
3-1138
dsp.Normalizer
3-1139
dsp.Normalizer
AccumulatorDataType
Methods
3-1140
clone
getNumInputs
getNumOutputs
dsp.Normalizer
Examples
isLocked
release
step
Normalize a matrix:
hnorm = dsp.Normalizer;
x = magic(3);
y = step(hnorm, x);
Algorithms
See Also
dsp.ArrayVectorMultiplier
3-1141
dsp.Normalizer.clone
Purpose
Syntax
C = clone(H)
Description
3-1142
dsp.Normalizer.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1143
dsp.Normalizer.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1144
dsp.Normalizer.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1145
dsp.Normalizer.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1146
dsp.Normalizer.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1147
dsp.NotchPeakFilter
Purpose
Description
3-1148.
2 Call step to filter each channel of the input according to the
Construction
returns a notch filter with each specified property name set to the
specified value. You can specify additional name-value pair arguments
in any order as (Name1,Value1,...,NameN,ValueN).
H = dsp.NotchPeakFilter('specification', 'Quality factor
and center frequency') specifies the quality factor (Q factor) of the
notch or peak filter instead of the 3 dB bandwidth. The Q factor is
3-1148
dsp.NotchPeakFilter
Properties
Specification
Filter specification
Set the specification as one of 'Bandwidth and center
frequency' | 'Quality factor and center frequency'
| 'Coefficients'. The default is 'Bandwidth and center
frequency'.
Bandwidth
3 dB bandwidth
Specify the filters 3 dB bandwidth as a finite positive numeric
scalar in Hertz. This property is applicable only if specification
is 'Bandwidth and center frequency'. The default is 2205 Hz.
This property is tunable.
CenterFrequency
3-1149
dsp.NotchPeakFilter
Bandwidth coefficient
Specify the value that determines the filters 3 dB bandwidth as a
finite numeric scalar between 0 and 1. Where 0 corresponds to the
maximum 3 dB bandwidth (SampleRate/4), and 1 corresponds to
the minimum 3 dB bandwidth (0 Hz, an allpass filter). The default
is 0.72654. This property is only applicable if specification is
set to 'Coefficients'. This property is tunable.
CenterFrequencyCoefficient
Methods
3-1150
clone
getBandwidth
Get 3 dB bandwidth
getCenterFrequency
getOctaveBandwidth
getQualityFactor
isLocked
dsp.NotchPeakFilter
Examples
release
reset
step
tf
Transfer function
Notch filter
This example shows how to use dsp.NotchPeakFilter as a notch filter
with center frequency of 5000 Hz and a 3 dB bandwidth of 500 Hz.
h = dsp.NotchPeakFilter('CenterFrequency',5000,'Bandwidth',500);
hscope = dsp.SpectrumAnalyzer('SampleRate',44100,...
'PlotAsTwoSidedSpectrum',false,'SpectralAverages',50);
for i=1:5000
y = step(h,randn(1024,1));
step(hscope,y);
if (i==2500)
% Tune center frequency to 10000
h.CenterFrequency = 10000;
end
end
release(h)
release(hscope)
3-1151
dsp.NotchPeakFilter
3-1152
dsp.NotchPeakFilter
Algorithms
H ( z) (1 b)
1 z2
1 2b cos w0 z1 (2b 1) z2
The previous equation is for peak filter, and the following equation is
for notch filter.
H ( z) b
1 2 cos w0 z1 z2
1 2b cos w0 z1 (2b 1) z2
With
1
1 tan(w / 2)
Hnotch ( z) H peak ( z) 1
they can be written as:
1
1 A( z)
2
1
Hnotch ( z) 1 A( z)
2
H peak ( z)
nd
A( z)
a2 a1 z1 z2
1 a1 z1 a2 z2
and
a1 2b cos 0
a2 2b 1
3-1153
dsp.NotchPeakFilter
where
G3 dB a2 2b 1
Gcf
a1 a1 a2
1 a22
cos w0
Notice that Gcf depends only on the center frequency, and G3dB depends
only on the 3 dB bandwidth.
3-1154
dsp.NotchPeakFilter
References
[1] Sophocles J. Orfanidis, Introduction to Signal Processing,
Prentice-Hall, Upper Saddle River, New Jersey
See Also
3-1155
dsp.NotchPeakFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-1156
dsp.NotchPeakFilter.getBandwidth
Purpose
Get 3 dB bandwidth
Syntax
BW= getBandwidth(H)
Description
3-1157
dsp.NotchPeakFilter.getCenterFrequency
Purpose
Syntax
CF= getCenterFrequency(H)
Description
3-1158
dsp.NotchPeakFilter.getOctaveBandwidth
Purpose
Syntax
N = getOctaveBandwidth(H)
Description
3-1159
dsp.NotchPeakFilter.getQualityFactor
Purpose
Syntax
Q = getQualityFactor(H)
Description
3-1160
dsp.NotchPeakFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1161
dsp.NotchPeakFilter.release
Purpose
Syntax
release(H)
Description
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1162
dsp.NotchPeakFilter.reset
Purpose
Syntax
reset(H)
Description
3-1163
dsp.NotchPeakFilter.step
Purpose
Syntax
Y = step(H,x)
[Y1,...,YN] = step(H,x)
Description
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, nontunable properties or any input characteristics (size, data
type and complexity) cannot change without reinitializing (unlocking
and relocking) the object.
3-1164
dsp.NotchPeakFilter.tf
Purpose
Transfer function
Syntax
[B,A] = tf(H)
[B,A,B2,A2] = tf(H)
Description
3-1165
dsp.ParametricEQFilter
Purpose
Description
3-1166.
2 Call step to filter each channel according to the properties of
Construction
specifies the gain values for the bandwidth and center frequency. This
removes the trigonometry calculations involved when the properties are
tuned. The CenterFrequencyCoefficient should be a scalar between
-1 and 1, with -1 corresponding to 0 Hz, and 1 corresponding to the
Nyquist frequency. The BandwidthCoefficient should be a scalar
between -1 and 1, with -1 corresponding to the largest bandwidth, and 1
corresponding to the smallest bandwidth. In this mode, the peak gain is
specified in linear units rather than dB.
3-1166
dsp.ParametricEQFilter
parametric equalizer filter with each specified property name set to the
specified value. You can specify several name-value pair arguments in
any order as ('Name1',Value1,...,'NameN',ValueN).
Properties
Specification
bandwidth of filter
Specify the filters bandwidth as a finite positive numeric scalar,
in Hz. This property is applicable if Specification is set to
Bandwidth and center frequency. The default is 2205 Hz. This
property is tunable.
BandwidthCoefficient
3-1167
dsp.ParametricEQFilter
3-1168
dsp.ParametricEQFilter
Methods
clone
getBandwidth
3-1169
dsp.ParametricEQFilter
getCenterFrequency
getOctaveBandwidth
getPeakGain
getPeakGaindB
getQualityFactor
isLocked
release
reset
Reset states of
ParametricEQFilter object
step
tf
Examples
Create objects to estimate and display the transfer function of the filter.
htf = dsp.TransferFunctionEstimator('FrequencyRange','onesided',...
'SpectralAverages',50);
3-1170
dsp.ParametricEQFilter
Random signal
Filter signal
Estimate transfer function
Convert to dB
Display transfer function
if (i==1)
% Pause to display initial transfer functi
pause;
end
if (i==500)
% Tune filter
h.CenterFrequency = 10000;
h.Bandwidth = 2000;
h.PeakGaindB = -10;
end
end
3-1171
dsp.ParametricEQFilter
3-1172
dsp.ParametricEQFilter
Algorithm
H ( z) Hnotch ( z) GH peak ( z)
Here is a graph of the two cases (boost and cut) of the magnitude
squared of the transfer functions:
3-1173
dsp.ParametricEQFilter
3-1174
dsp.ParametricEQFilter
3-1175
dsp.ParametricEQFilter
(
H ( z)
1 G
cos 0 1 1 G 2
)z (
)z
1
1
1
cos 0 1 1 2
1 2(
)z
)z (
1
1
) 2(
where
tan(
)
2
and
GB2
1 G2
2
References
[1] Orfanidis, Sophocles J. Introduction to Signal Processing Upper
Saddle River, NJ: Prentice-Hall, 1996
Related
Examples
3-1176
dsp.ParametricEQFilter.clone
Purpose
Syntax
C = clone(H)
Description
object.
3-1177
dsp.ParametricEQFilter.getBandwidth
Purpose
Syntax
BW = getBandwidth(H)
Description
3-1178
dsp.ParametricEQFilter.getCenterFrequency
Purpose
Syntax
CF = getCenterFrequency(H)
Description
3-1179
dsp.ParametricEQFilter.getOctaveBandwidth
Purpose
Syntax
N = getOctaveBandwidth(H)
Description
3-1180
dsp.ParametricEQFilter.getPeakGain
Purpose
Syntax
G = getPeakGain(H)
Description
3-1181
dsp.ParametricEQFilter.getPeakGaindB
Purpose
Syntax
G = getPeakGaindB(H)
Description
3-1182
dsp.ParametricEQFilter.getQualityFactor
Purpose
Syntax
Q = getQualityFactor(H)
Description
3-1183
dsp.ParametricEQFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1184
dsp.ParametricEQFilter.release
Purpose
Syntax
release(H)
Description
See Also
dsp.ParametricEQFilter.isLocked | dsp.ParametricEQFilter.step
3-1185
dsp.ParametricEQFilter.reset
Purpose
Syntax
reset(H)
Description
3-1186
dsp.ParametricEQFilter.step
Purpose
Syntax
Y = step(H, X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1187
dsp.ParametricEQFilter.tf
Purpose
Syntax
[B,A] = tf(H)
Description
3-1188
dsp.PeakFinder
Purpose
Description
3-1189.
2 Call step to compute the extrema according to the properties of
the toolbox.
Construction
compares the current signal value to the previous and next values to
determine if the current value is an extremum.
H = dsp.PeakFinder('PropertyName',PropertyValue,...) returns
a peak finder System object, H, with each specified property set to the
specified value.
Properties
PeakType
3-1189
dsp.PeakFinder
3-1190
dsp.PeakFinder
OverflowAction
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1191
dsp.PeakFinder
Algorithms
See Also
dsp.Maximum | dsp.Minimum
3-1192
dsp.PeakFinder.clone
Purpose
Syntax
C = clone(H)
Description
3-1193
dsp.PeakFinder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1194
dsp.PeakFinder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1195
dsp.PeakFinder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1196
dsp.PeakFinder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1197
dsp.PeakFinder.step
Purpose
Syntax
YCNT = step(H,X)
[YCNT,IDX] = step(H,X)
[..., VAL] = step(H,X)
[..., POL] = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1198
dsp.PeakToPeak
Purpose
Peak-to-peak value
Description
on page 3-1199.
2 Call step to compute the peak-to-peak value for an input vector
Construction
Properties
CustomDimension
3-1199
dsp.PeakToPeak
Default: 'Column'
FrameBasedProcessing
3-1200
dsp.PeakToPeak
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
References
3-1201
dsp.PeakToPeak
See Also
3-1202
dsp.Maximum | dsp.PeakToRMS
dsp.PeakToPeak.clone
Purpose
Syntax
clone(H)
Description
3-1203
dsp.PeakToPeak.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1204
dsp.PeakToPeak.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-1205
dsp.PeakToPeak.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1206
dsp.PeakToPeak.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1207
dsp.PeakToPeak.reset
Purpose
Syntax
reset(H)
Description
3-1208
dsp.PeakToPeak.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
3-1209
dsp.PeakToRMS
Purpose
Description
Construction
Properties
CustomDimension
3-1210
dsp.PeakToRMS
Dimension
3-1211
dsp.PeakToRMS
Methods
Definitions
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Peak-magnitude-to-RMS Level
The peak-magnitude-to-RMS level is
|| X ||
N
1
N
|X n |2
n1
where the l-infinity norm and RMS values are computed along the
specified dimension.
3-1212
dsp.PeakToRMS
Examples
References
See Also
dsp.Maximum | dsp.PeakToPeak
3-1213
dsp.PeakToRMS.clone
Purpose
Syntax
clone(H)
Description
3-1214
dsp.PeakToRMS.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1215
dsp.PeakToRMS.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1216
dsp.PeakToRMS.isLocked
Purpose
Syntax
isLocked(H)
Description
object H.
3-1217
dsp.PeakToRMS.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1218
dsp.PeakToRMS.reset
Purpose
Syntax
reset(H)
Description
3-1219
dsp.PeakToRMS.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
3-1220
dsp.PhaseUnwrapper
Purpose
Description
3-1221.
2 Call step to unwrap the signal phase according to the properties of
in the toolbox.
Construction
Properties
InterFrameUnwrap
3-1221
dsp.PhaseUnwrapper
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-1222
dsp.PhaseUnwrapper
Algorithms
See Also
unwrap
3-1223
dsp.PhaseUnwrapper.clone
Purpose
Syntax
clone(H)
Description
3-1224
dsp.PhaseUnwrapper.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1225
dsp.PhaseUnwrapper.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-1226
dsp.PhaseUnwrapper.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1227
dsp.PhaseUnwrapper.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1228
dsp.PhaseUnwrapper.reset
Purpose
Syntax
reset(H)
Description
3-1229
dsp.PhaseUnwrapper.step
Purpose
Syntax
Y = step(H,X)
Description
Y = step(H,X) unwraps the input signal X in radians for the root mean
square (RMS) object H.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1230
dsp.PulseMetrics
Purpose
Description
The PulseMetrics object computes rise times, fall times, pulse widths,
and cycle metrics including pulse period, pulse separation, and duty
cycle for bilevel waveforms.
To obtain pulse metrics for a bilevel waveform:
1 Define and set up your pulse metrics. See Construction on page
3-1231.
2 Call step to compute the pulse metrics according to the properties of
in the toolbox.
Construction
Properties
CycleOutputPort
3-1231
dsp.PulseMetrics
3-1232
dsp.PulseMetrics
3-1233
dsp.PulseMetrics
Default: 3
RunningMetrics
3-1234
dsp.PulseMetrics
transition. The metrics are reported for the transition the next
time step is called if the RunningMetrics property is set to true.
Default: false
SettlingSeekDuration
3-1235
dsp.PulseMetrics
TimeInputPort
Methods
3-1236
clone
getNumInputs
getNumOutputs
isLocked
plot
dsp.PulseMetrics
Examples
reset
step
Call step to compute the cycle metrics and plot the result.
[pulse, cycle] = step(hpm1,x,t);
plot(hpm1)
text(t(2),-0.5,['Duty Cycle: ',num2str(cycle.DutyCycle)]);
3-1237
dsp.PulseMetrics
Compute the pulse and transition metrics and plot the result.
[pulse, transition] = step(hpm2,x);
plot(hpm2)
References
See Also
dsp.StateLevels | dsp.TransitionMetrics
3-1238
dsp.PulseMetrics.clone
Purpose
Syntax
clone(H)
Description
3-1239
dsp.PulseMetrics.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1240
dsp.PulseMetrics.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1241
dsp.PulseMetrics.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1242
dsp.PulseMetrics.plot
Purpose
Syntax
plot(H)
Description
plot(H) plots the signal and metrics resulting from the last call of the
step method.
3-1243
dsp.PulseMetrics.reset
Purpose
Syntax
reset(H)
Description
reset(H) clears information from previous calls to step.
3-1244
dsp.PulseMetrics.step
Purpose
Syntax
PULSE = step(H,X)
[PULSE,CYCLE] = step(H,X)
[PULSE, TRANSITION] = step(H,X)
[PULSE,PRESHOOT] = step(H,X)
[PULSE,POSTSHOOT] = step(H,X)
[PULSE,SETTLING] = step(H,X)
[...] = step(H,X,T)
Description
whose fields contain real-valued column vectors when you set the
CycleOutputPort property to true. The number of rows of each field
3-1245
dsp.PulseMetrics.step
two columns which correspond to the metrics of the first and second
transitions. The number of rows corresponds to the number of pulses
found in the input waveform.
TRANSITION fields:
3-1246
dsp.PulseMetrics.step
3-1247
dsp.PulseMetrics.step
output ports. However, the output arguments are defined in the order
shown here.
= step(H,X,T) performs the above metrics with respect to a
sampled signal, whose sample values, X, and sample instants, T, are
real-valued column vectors of the same length. The additional input T
applies only when you set the TimeInputPort property to true.
[...]
3-1248
dsp.RCToAutocorrelation
Purpose
Description
3-1249.
2 Call step to convert reflection coefficients according to the properties
Construction
Properties
PredictionErrorInputPort
3-1249
dsp.RCToAutocorrelation
Methods
Examples
clone
Create RC to autocorrelation
object with same property values
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
3-1250
dsp.RCToAutocorrelation
See Also
3-1251
dsp.RCToAutocorrelation.clone
Purpose
Syntax
C = clone(H)
Description
3-1252
dsp.RCToAutocorrelation.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1253
dsp.RCToAutocorrelation.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1254
dsp.RCToAutocorrelation.isLocked
Purpose
Syntax
isLocked(H)
Description
System object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1255
dsp.RCToAutocorrelation.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1256
dsp.RCToAutocorrelation.step
Purpose
Syntax
AC = step(H,K)
AC = step(H,K,P)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1257
dsp.RCToLPC
Purpose
Description
on page 3-1258.
2 Call step to convert RC to LPC according to the properties of
toolbox.
Construction
specified value.
Properties
PredictionErrorOutputPort
3-1258
dsp.RCToLPC
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
(1:100)';
step(hac, x);
step(hlevinson, a); % Compute reflection coefficients
P] = step(hrc2lpc, k);
3-1259
dsp.RCToLPC
See Also
3-1260
dsp.LPCToRC | dsp.LPCToAutocorrelation
dsp.RCToLPC.clone
Purpose
Syntax
C = clone(H)
Description
3-1261
dsp.RCToLPC.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1262
dsp.RCToLPC.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1263
dsp.RCToLPC.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1264
dsp.RCToLPC.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1265
dsp.RCToLPC.step
Purpose
Syntax
[A,P] = step(H,K)
A = step(H,K)
[..., S] = step(H,K)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1266
dsp.RLSFilter
Purpose
Description
The RLSFilter object filters each channel of the input using RLS filter
implementations.
To filter each channel of the input:
1 Define and set up your RLS filter. See Construction on page 3-1267.
2 Call step to filter each channel of the input according to the
Construction
the filter weights for a given input and desired signal using the RLS
algorithm.
H = dsp.RLSFilter('PropertyName',PropertyValue, ...) returns
an RLS filter System object, H, with each specified property set to the
specified value.
H = dsp.RLSFilter(LEN, 'PropertyName', PropertyValue, ...)
returns an RLS filter System object, H. This System object has the
Length property set to LEN, and other specified properties set to the
specified values.
Properties
Method
3-1267
dsp.RLSFilter
3-1268
dsp.RLSFilter
3-1269
dsp.RLSFilter
Methods
Examples
clone
isLocked
msesim
release
reset
step
Noise Cancellation
hrls2 = dsp.RLSFilter('Length', 11, 'Method', 'Householder RLS');
hfilt2 = dsp.FIRFilter('Numerator',fir1(10, [.5, .75]));
% Noise
x = randn(1000,1);
3-1270
dsp.RLSFilter
d = step(hfilt2, x) + sin(0:.05:49.95)';
% Noise + Signal
[y, err] = step(hrls2, x, d);
subplot(2,1,1), plot(d), title('Noise + Signal');
subplot(2,1,2), plot(err), title('Signal');
Algorithms
1P(n 1)u(n)
k ( n)
1 1u H (n)P(n 1)u(n)
y (n) w T (n 1)u(n)
e( n ) d ( n ) y ( n )
w (n) w (n 1) k (n)e(n)
P(n) 1P(n 1) 1k (n)u H (n)P(n 1)
where -1 denotes the reciprocal of the exponential weighting factor.
The variables are as follows:
Variable
Description
u(n)
P(n)
k(n)
3-1271
dsp.RLSFilter
Variable
Description
w(n)
y(n)
e(n)
d(n)
References
[1] M Hayes, Statistical Digital Signal Processing and Modeling, New
York: Wiley, 1996
[2] S. Haykin, Adaptive Filter Theory, 4th Edition, Upper Saddle River,
NJ: Prentice Hall, 2002
[3] A.A. Rontogiannis and S. Theodoridis, "Inverse factorization
adaptive least-squares algorithms," Signal Processing, vol. 52, no. 1,
pp. 35-47, July 1996.
[4] S.C. Douglas, "Numerically-robust O(N2) RLS algorithms using
least-squares prewhitening," Proc. IEEE Int. Conf. on Acoustics,
Speech, and Signal Processing, Istanbul, Turkey, vol. I, pp. 412-415,
June 2000.
See Also
3-1272
dsp.RLSFilter.msesim
Purpose
Syntax
MSE = msesim(H,X,D)
[MSE,MEANW,W,TRACEK] = msesim(H,X,D)
[...] = msesim(H,X,D,M)
Description
3-1273
dsp.RLSFilter.clone
Purpose
Syntax
C = clone(OBJ)
Description
See Also
3-1274
dsp.RLSFilter.step | dsp.RLSFilter.isLocked |
dsp.RLSFilter.reset
dsp.RLSFilter.isLocked
Purpose
Syntax
L = isLocked(OBJ)
Description
See Also
input attributes and nontunable properties are locked for the System
object, OBJ. The object performs an internal initialization the first
time the step method is executed. This initialization locks nontunable
properties and input specifications, such as dimensions, complexity,
and data type of the input data. Once this occurs, the isLocked method
returns a true value.
dsp.RLSFilter.step | dsp.RLSFilter.release
3-1275
dsp.RLSFilter.release
Purpose
Syntax
release(OBJ)
Description
See Also
3-1276
dsp.RLSFilter.isLocked | dsp.RLSFilter.step
dsp.RLSFilter.reset
Purpose
Syntax
reset(OBJ)
Description
3-1277
dsp.RLSFilter.step
Purpose
Syntax
Y = step(OBJ,x)
[Y1,...,YN] = step(OBJ,x)
Description
N outputs.
Every System object has a step method. The step method processes
the input data according to the object algorithm. The number of the
input and the output arguments depends on the algorithm, and may
depend also on one or more property settings. The step method for some
objects accepts fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
3-1278
dsp.RMS
Purpose
Description
The RMS object computes the root mean square (RMS) value.
To compute the RMS value of your input:
1 Define and set up your RMS calculation. See Construction on page
3-1279.
2 Call step to compute the RMS value for an input according to the
Construction
Properties
RunningRMS
3-1279
dsp.RMS
ResetCondition
3-1280
dsp.RMS
Methods
Definitions
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Root-Mean-Square Level
The root-mean-square level of a vector, X, is
X RMS
1
N
|X n |2
n1
3-1281
dsp.RMS
Rising edge
Rising edge
Rising edge
Rising edge
A falling edge:
Falls from a positive value to a negative value or zero.
Falls from zero to a negative value, where the fall is not a
continuation of a fall from a positive value to zero.
Falling edge
Falling edge
3-1282
Falling edge
Falling edge
dsp.RMS
Examples
Algorithms
3-1283
dsp.RMS
See Also
3-1284
dsp.RMS.clone
Purpose
Syntax
clone(H)
Description
clone(H) clones the current instance of the root mean square (RMS)
object H
3-1285
dsp.RMS.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1286
dsp.RMS.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1287
dsp.RMS.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1288
isLocked(H) returns the locked state of the root mean square (RMS)
object H.
dsp.RMS.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1289
dsp.RMS.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the running root mean square (RMS) for the object H.
3-1290
dsp.RMS.step
Purpose
Syntax
Y = step(H,X)
Y = step(H,X,R)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1291
dsp.ScalarQuantizerDecoder
Purpose
Description
on page 3-1292.
2 Call step to convert the index value according to the properties of
Construction
Properties
CodebookSource
Codebook
Specify the codebook as a vector of quantized output values that
correspond to each index value. The default is 1:10. This property
is tunable.
3-1292
dsp.ScalarQuantizerDecoder
OutputDataType
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1293
dsp.ScalarQuantizerDecoder
Algorithms
See Also
3-1294
dsp.ScalarQuantizerEncoder | dsp.VectorQuantizerDecoder
dsp.ScalarQuantizerDecoder.clone
Purpose
Syntax
C = clone(H)
Description
3-1295
dsp.ScalarQuantizerDecoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1296
dsp.ScalarQuantizerDecoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1297
dsp.ScalarQuantizerDecoder.isLocked
Purpose
Syntax
isLocked(H)
Description
System object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1298
dsp.ScalarQuantizerDecoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1299
dsp.ScalarQuantizerDecoder.step
Purpose
Syntax
Q = step(H, I)
Q = step(H,I,C)
Description
3-1300
dsp.ScalarQuantizerEncoder
Purpose
Description
on page 3-1301.
2 Call step to encode the input value according to the properties of
Construction
Properties
BoundaryPointsSource
3-1301
dsp.ScalarQuantizerEncoder
log 2 (P)
where P is the number of boundary points. The default is Linear.
TiebreakerRule
3-1302
dsp.ScalarQuantizerEncoder
Codebook
Specify the codebook as a vector of quantized output values
that correspond to each region. If the Partitioning property is
Bounded and the boundary points vector has length N, you must
set this property to a vector of length N-1. If the Partitioning
property is Unbounded and the boundary points vector has
length N, you must set this property to a vector of length N+1.
This property applies when you set the BoundaryPointsSource
property to Property and either the CodewordOutputPort
property or the QuantizationErrorOutputPort property is true.
The default is 1.5:9.5. This property is tunable.
ClippingStatusOutputPort
3-1303
dsp.ScalarQuantizerEncoder
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Quantize the varying fractional inputs between zero and five to the
closest integers, and then plot the results:
hsqe = dsp.ScalarQuantizerEncoder;
hsqe.BoundaryPoints = [-.001 .499 1.499 ...
2.499 3.499 4.499 5.001];
hsqe.CodewordOutputPort = true;
hsqe.Codebook = [0 1 2 3 4 5];
input = (0:0.02:5)';
[index, quantizedValue] = step(hsqe, input);
plot(1:length(input), [input quantizedValue]);
3-1304
dsp.ScalarQuantizerEncoder
Algorithms
See Also
dsp.ScalarQuantizerDecoder | dsp.VectorQuantizerEncoder
3-1305
dsp.ScalarQuantizerEncoder.clone
Purpose
Syntax
Description
object.
3-1306
dsp.ScalarQuantizerEncoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1307
dsp.ScalarQuantizerEncoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1308
dsp.ScalarQuantizerEncoder.isLocked
Purpose
Syntax
isLocked(H)
Description
object H.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1309
dsp.ScalarQuantizerEncoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1310
dsp.ScalarQuantizerEncoder.step
Purpose
Syntax
INDEX= step(HSQE,INPUT)
[...] = step(HSQE,INPUT,BPOINTS)
[...] = step(HSQE,INPUT,BPOINTS,CODEBOOK)
[...,CODEWORD] = step(HSQE, ...)
[..., QERR] = step(HSQE, ...)
[...,CLIPSTATUS] = step(HSQE, ...)
Description
3-1311
dsp.ScalarQuantizerEncoder.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1312
dsp.SignalSink
Purpose
Description
3-1313.
2 Call step to log the simulation data according to the properties of
the toolbox.
Construction
in the object.
H = dsp.SignalSink('PropertyName',PropertyValue,...) returns
a signal sink, H, with each specified property set to the specified value.
Properties
FrameBasedProcessing
3-1313
dsp.SignalSink
zeros. To capture all input data without extra padding, set the
BufferLength property to inf. The default is inf.
Decimation
Decimation factor
Setting this property to any positive integer d causes the signal
sink to write data at every dth sample. The default is 1.
FrameHandlingMode
Methods
3-1314
clone
getNumInputs
getNumOutputs
isLocked
release
dsp.SignalSink
Examples
reset
step
Algorithms
See Also
dsp.SignalSource
3-1315
dsp.SignalSink.clone
Purpose
Syntax
C = clone(H)
Description
3-1316
dsp.SignalSink.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1317
dsp.SignalSink.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1318
dsp.SignalSink.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1319
dsp.SignalSink.reset
Purpose
Syntax
reset(H)
Description
3-1320
initial values.
dsp.SignalSink.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1321
dsp.SignalSink.step
Purpose
Syntax
step(H,Y)
Description
step(H,Y) buffers the signal Y. The buffer may be accessed at any time
from the Buffer property of H.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1322
dsp.SignalSource
Purpose
Description
3-1323.
2 Call step to import the variable according to the properties of
in the toolbox.
Construction
Properties
Signal
3-1323
dsp.SignalSource
Methods
Examples
clone
getNumInputs
getNumOutputs
isDone
isLocked
release
reset
step
3-1324
dsp.SignalSource
while(~isDone(hsr1))
y1(idx) = step(hsr1);
idx = idx+1;
end
Algorithms
See Also
dsp.SignalSink
3-1325
dsp.SignalSource.clone
Purpose
Syntax
C = clone(H)
Description
un-initialized states.
3-1326
dsp.SignalSource.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1327
dsp.SignalSource.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1328
dsp.SignalSource.isDone
Purpose
Syntax
isDone(H)
Description
3-1329
dsp.SignalSource.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1330
dsp.SignalSource.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the signal reader object H, to start reading from the
3-1331
dsp.SignalSource.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1332
dsp.SignalSource.step
Purpose
Syntax
Y = step(H)
Description
3-1333
dsp.SineWave
Purpose
Discrete-time sinusoid
Description
y(n) = A sin(2 fn + )
where A is the amplitude, f is the frequency in hertz, and is the initial
phase, or phase offset, in radians. A complex exponential is defined as:
y(n) = Ae j (2 fn+ )
For both real and complex sinusoids, the amplitude, frequency, and
phase offsets can be scalars or length-N vectors, where N is the desired
number of channels in the output. When you specify at least one of
these properties as a length-N vector, scalar values specified for the
other properties are applied to each of the N channels.
To generate a discrete-time sinusoid:
1 Define and set up your sine wave. See Construction on page 3-1334.
2 Call step to generate the sinusoid according to the properties of
toolbox.
Construction
3-1334
dsp.SineWave
FREQ, the PhaseOffset property set to PHASE, and the other specified
Properties
Amplitude
3-1335
dsp.SineWave
3-1336
dsp.SineWave
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-1337
dsp.SineWave
Algorithms
See Also
dsp.Chirp | dsp.NCO
3-1338
dsp.SineWave.clone
Purpose
Syntax
C = clone(H)
Description
3-1339
dsp.SineWave.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1340
dsp.SineWave.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1341
dsp.SineWave.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1342
dsp.SineWave.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1343
dsp.SineWave.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the sine wave object to the beginning (n=0). If you
invoke the step method without first invoking the reset method, the
sine wave object generates additional samples of the original sinusoid.
As an example:
H = dsp.SineWave('Amplitude',1,'Frequency',1/4,'SamplesPerFrame',7);
% 7 samples of a sine wave with frequency of 1/4 Hz
y = step(H);
% Call step method without reset
y1 = step(H);
stem([y; y1])
% y1 is a continuation of y
% Now reset
reset(H);
y2 = step(H);
% y2 starts at n=0 and equals y
isequal(y,y2)
3-1344
dsp.SineWave.step
Purpose
Syntax
Y = step(H)
Description
3-1345
dsp.SpectrumAnalyzer
Purpose
Description
page 3-1348.
2 Call step to display the frequency spectrum of the signals in the
3-1346
dsp.SpectrumAnalyzer
3-1347
dsp.SpectrumAnalyzer
Note If you own the MATLAB Coder product, you can generate C or
C++ code from MATLAB code in which an instance of this system object
is created. When you do so, the scope system object is automatically
declared as an extrinsic variable. In this manner, you are able to see
the scope display in the same way that you would see a figure using the
plot function, without directly generating code from it. For the full list
of system objects supporting code generation, see DSP System Toolbox
in the MATLAB Coder documentation.
Construction
Properties
CenterFrequency
3-1348
dsp.SpectrumAnalyzer
SampleRate SampleRate
is
,
FrequencyOffset hertz.
2
2
the PlotAsTwoSidedSpectrum
property is set to false, the
When
SampleRate
interval is 0,
FrequencyOffset hertz.
2
FFT length
Specify as a positive, scalar integer the length of the FFT
that the Spectrum Analyzer uses to compute spectral
estimates. This property applies only when you set the
FrequencyResolutionMethod property to 'WindowLength' and
the FFTLengthSource property to 'Property'. The FFTLength
must be greater than or equal to the WindowLength. You cannot
control the FFT length when the FrequencyResolutionMethod
property is 'RBW'. In that case, the FFT length is set as the
window length required to achieve the specified resolution
bandwidth value or 1024, whichever is larger.
This property is Tunable.
Default: 128
FFTLengthSource
3-1349
dsp.SpectrumAnalyzer
Frequency offset
Specify as a real, scalar value a frequency offset, in
hertz. The frequency-axis values are offset by the
value specified in this property. The overall span must
fall within the Nyquist frequency interval. When the
PlotAsTwoSidedSpectrum property is true, the Nyquist
SampleRate SampleRate
,
interval is
FrequencyOffset
2
you set2the PlotAsTwoSidedSpectrum
hertz. When
property to
SampleRate
FrequencyOffset
span2in different
Default: 0
FrequencyResolutionMethod
3-1350
dsp.SpectrumAnalyzer
NENBW * Fs
as
where NENBW is the normalized effective
window
noiseNbandwidth
of the window currently specified in the Window
property. You can control the number of FFT points only when
the FrequencyResolutionMethod property is 'WindowLength'.
When the FrequencyResolutionMethod property is 'RBW', the
FFT length is the window length that results from achieving the
specified RBW value or 1024, whichever is larger.
This property is Tunable.
Default: 'RBW'
FrequencyScale
Frequency scale
Specify the frequency scale as either 'Linear' or 'Log'. This
property applies only when you set the SpectrumType property to
'Power' or 'Power density'. When you set the FrequencyScale
property to 'Log', the Spectrum Analyzer displays the frequencies
on the x-axis on a logarithmic scale. To use the 'Log' setting, you
must also set the PlotAsTwoSidedSpectrum property to false.
When the PlotAsTwoSidedSpectrum property is true, you must
set this property to 'Linear'.
This property is Tunable.
Default: 'Linear'
FrequencySpan
3-1351
dsp.SpectrumAnalyzer
SampleRate SampleRate
,
FrequencyOffset hertz. If
2 PlotAsTwoSidedSpectrum
2
you
set the
property to false, the
SampleRate
Nyquist interval is 0,
FrequencyOffset hertz.
2
3-1352
dsp.SpectrumAnalyzer
OverlapPercent
Overlap percentage
Specify as a real, scalar value, the percentage overlap between the
previous and current buffered data segments. The overlap creates
a window segment that is used to compute a spectral estimate.
The value must be greater than or equal to zero and less than
100. This property is Tunable.
Default: 0
PlotAsTwoSidedSpectrum
3-1353
dsp.SpectrumAnalyzer
3-1354
dsp.SpectrumAnalyzer
Default: true
Position
Power units
Specify the units in which the Spectrum Analyzer displays power
values as either 'dBm', 'dBW', or 'Watts'.
This property is Tunable.
Default: 'dBm'
RBW
Resolution bandwidth
Specify as a real, positive scalar the resolution bandwidth
(RBW), in hertz. RBW controls the spectral resolution of
Spectrum Analyzer. This property applies only when you set
the FrequencyResolutionMethod property to 'RBW' and the
RBWSource property to 'Property'. You must specify a value
to ensure that there are at least two RBW intervals over the
specified frequency span. Thus, the ratio of the overall span to
RBW must be greater than two:
span
2 . You can specify
RBW
3-1355
dsp.SpectrumAnalyzer
the overall span in different ways based on how you set the
FrequencySpan property.
This property is Tunable.
See also: RBWSource.
Default: 9.76
RBWSource
3-1356
dsp.SpectrumAnalyzer
Reference load
Specify as a real, positive scalar the load, in ohms, that the
Spectrum Analyzer uses as a reference to compute power values.
This property is Tunable.
Default: 1
SampleRate
3-1357
dsp.SpectrumAnalyzer
this property to false, the scope does not display a legend. This
property applies only when you set the SpectrumType property to
'Power' or 'Power density'. This property is Tunable.
Default: false
SidelobeAttenuation
SampleRate SampleRate
,
interval is
FrequencyOffset
2
you set2the PlotAsTwoSidedSpectrum
hertz. When
property to
hertz.
3-1358
SampleRate
FrequencyOffset
2
dsp.SpectrumAnalyzer
Default: 10e3
SpectralAverages
Spectrum type
Specify the spectrum type as one of 'Power', 'Power density',
or 'Spectrogram'.
When you set this property to 'Power', the Spectrum Analyzer
shows the power spectrum.
When you set this property to 'Power density', the Spectrum
Analyzer shows the power spectral density. The power spectral
density is the magnitude squared of the spectrum normalized
to a bandwidth of 1 hertz.
When you set this property to 'Spectrogram', the Spectrum
Analyzer open a spectrogram view, which shows frequency
content over time. Each line of the spectrogram is one
periodogram. Time scrolls from the bottom to the top of the
display. The most recent spectrogram update is at the bottom
of the display.
3-1359
dsp.SpectrumAnalyzer
SampleRate SampleRate
,
interval is
FrequencyOffset
2
set the2PlotAsTwoSidedSpectrum
hertz. If you
property to
hertz.
SampleRate
FrequencyOffset
2
3-1360
dsp.SpectrumAnalyzer
SampleRate SampleRate
is
,
FrequencyOffset hertz.
2
2
the PlotAsTwoSidedSpectrum
When
property is set to false,
SampleRate
the interval is 0,
FrequencyOffset hertz.
2
Time resolution
Specify the time resolution of each spectrogram line as a positive
scalar, expressed in seconds. This property applies when you
set the SpectrumType property to 'Spectrogram', and the
TimeResolutionSource property to 'Property'.
The time resolution value is determined based on frequency
resolution method, the RBW setting, and the time resolution
setting.
Frequency
Resolution
RBW
Time
Setting Resolution
Setting
Time Resolution
'RBW'
'Auto'
'Auto'
1/RBW s
'RBW'
'Auto'
Manually
entered
Time Resolution s
'RBW'
Manually'Auto'
entered
1/RBW s
3-1361
dsp.SpectrumAnalyzer
Frequency
Resolution
RBW
Time
Setting Resolution
Setting
Time Resolution
'RBW'
ManuallyManually
entered entered
Must be equal to
or greater than the
minimum attainable
time resolution,
1/RBW s. Several
spectral estimates are
combined into one
spectrogram line to
obtain the desired
time resolution.
Interpolation is used to
obtain time resolution
values that are not
integer multiples of
1/RBW s.
'Window
Length'
1/RBW s
'Auto'
RBW =
(NENBW*Fs)/Window
Length, where
NENBW is the
normalized effective
noise bandwidth of the
specified window.
'Window
Length'
3-1362
Manually
entered
Must be equal to
or greater than the
minimum attainable
time resolution,
(NENBW*Fs)/Window
Length. Several
spectral estimates
are combined into one
dsp.SpectrumAnalyzer
Frequency
Resolution
RBW
Time
Setting Resolution
Setting
Time Resolution
spectrogram line to
obtain the desired
time resolution.
Interpolation is used to
obtain time resolution
values that are not
integer multiples of
1/RBW s.
This property is Tunable.
Default: 0.001
TimeResolutionSource
Time span
Specify the time span of the spectrogram display as a
positive scalar in seconds. This property applies when you
set the SpectrumType property to 'Spectrogram' and the
TimeSpanSource property to 'Property'. You must set the time
span to be at least twice as large as the duration of the number
of samples required for a spectral update.
3-1363
dsp.SpectrumAnalyzer
Display title
Specify the display title as a string. Enter %<SignalLabel> to use
the signal labels in the Simulink Model as the axes titles. This
property is Tunable.
Default: ''
Window
Window function
Specify a window function for the spectral estimator as one of the
options in the following table. For information on any window
function, follow the link to the corresponding function reference in
the Signal Processing Toolbox documentation.
3-1364
dsp.SpectrumAnalyzer
Window
Option
'Rectangular'
rectwin
'Chebyshev'
chebwin
'Flat Top'
flattopwin
'Hamming'
hamming
'Hann'
hann
'Kaiser'
kaiser
NENBW * Fs
N window
where Nwindow is
3-1365
dsp.SpectrumAnalyzer
Specify as a string the text for the scope to display to the left of
the y-axis. Tunable
This property applies only when you set the SpectrumType
property to 'Power' or 'Power density'. Regardless of this
property, Spectrum Analyzer always displays power units as one
of 'dBm', 'dBW', 'Watts', 'dBm/Hz', 'dBW/Hz', 'Watts/Hz'.
See also: PowerUnits on page 1889.
Default: ''
YLimits
Methods
3-1366
clone
getNumInputs
getNumOutputs
hide
isLocked
release
dsp.SpectrumAnalyzer
Examples
reset
show
step
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes. It updates the display
one more time if any data is in the internal buffer.
release(hsa);
View a one-sided power spectrum made from the sum of five real sine
waves with different amplitudes and frequencies.
Fs = 100e6;
fSz = 5000;
% Sampling frequency
% Frame size
hsin1 = dsp.SineWave(1e0,
3-1367
dsp.SpectrumAnalyzer
hsin2
hsin3
hsin4
hsin5
=
=
=
=
dsp.SineWave(1e-1,
dsp.SineWave(1e-2,
dsp.SineWave(1e-3,
dsp.SineWave(1e-4,
15e6,
25e6,
35e6,
45e6,
0,
0,
0,
0,
'SamplesPerFrame',
'SamplesPerFrame',
'SamplesPerFrame',
'SamplesPerFrame',
fSz,
fSz,
fSz,
fSz,
hsb = dsp.SpectrumAnalyzer;
hsb.SampleRate = Fs;
hsb.SpectralAverages = 1;
hsb.PlotAsTwoSidedSpectrum = false;
hsb.RBWSource = 'Auto';
hsb.PowerUnits = 'dBW';
hsb.Position = [749 227 976 721];
for idx = 1:1e2
y1 = step(hsin1);
y2 = step(hsin2);
y3 = step(hsin3);
y4 = step(hsin4);
y5 = step(hsin5);
step(hsb,y1+y2+y3+y4+y5+0.0001*randn(fSz,1));
end
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(hsb);
This example shows the spectrogram for a chirp signal with added
random noise.
Fs = 233e3;
frameSize = 20e3;
3-1368
'SampleRate',
'SampleRate',
'SampleRate',
'SampleRate',
dsp.SpectrumAnalyzer
hchirp = dsp.Chirp('SampleRate',Fs,...
'SamplesPerFrame',frameSize,...
'InitialFrequency',11e3,...
'TargetFrequency',11e3+55e3);
hss = dsp.SpectrumAnalyzer('SampleRate',Fs);
hss.SpectrumType = 'Spectrogram';
hss.RBWSource = 'Property';
hss.RBW = 500;
hss.TimeSpanSource = 'Property';
hss.TimeSpan = 2;
hss.PlotAsTwoSidedSpectrum = false;
for idx = 1:50
y = step(hchirp)+ 0.05*randn(frameSize,1);
step(hss,y);
end
release(hss)
Signal
Display
3-1369
dsp.SpectrumAnalyzer
Simulation status
Resolution Bandwidth
Time Resolution
Offset Display Time
(only for spectrogram)
3-1370
dsp.SpectrumAnalyzer
Op
1
NENBW Fs
100
NENBW * Fs
specify the window length and the resulting RBW is
.
The Samples/update in this case is directly related toNRBW
by the
window
Op
100
3-1371
dsp.SpectrumAnalyzer
Details
Time resolution is the amount of data, in seconds, used to compute
a spectrogram line. The Time Resolution parameter is available
only when the spectrum Type is Spectrogram. The minimum
attainable resolution is the amount of data time required to compute
a single spectral estimate. When the SpectrumType property is
set to 'Spectrogram', you can get or set the minimum attainable
resolution value from the TimeResolution property. See the time
resolution table at TimeResolution.
Offset The constant frequency offset to apply to the entire
spectrum.
Details
Spectrum Analyzer adds this constant offset to the values on the
frequency-axis using the value of Offset on the Trace options pane
of the Spectrum Settings panel. You can also set the offset from
the FrequencyOffset property. The offset is the current time value
at the middle of the interval of the line displayed at 0 seconds. The
actual time of a particular spectrogram line is the offset minus the
y-axis time listing. The offset is displayed on the plot only when the
spectrum Type is Spectrogram.
Simulation Status Provides the current status of the model
simulation.
Details
The status can be one of the following conditions:
3-1372
dsp.SpectrumAnalyzer
Display time The amount of time that has progressed since the
last update to the Spectrum Analyzer display.
Details
Every time you call the step method, the simulation time increases
by the number of rows in the input signal divided by the sample
length( x)
rate, as given by the following formula: tsim tsim
.
SampleRate
At the beginning of a simulation, you can modify the SampleRate
parameter on the Main options pane of the Spectrum Settings
panel. You can also set the sample rate using the SampleRate
property. The display time is updated each time the display is
updated. When ReducePlotRate is true, the simulation time and
display time might differ. If at the end of a for loop that includes the
Spectrum Analyzer, the times differ, you can call the release method
to update the display with any data left in the buffer. Note, however,
that if the remaining data is not a complete window interval, the
display is not updated.
The Display time indicator is a component of the Status Bar in
the Spectrum Analyzer window. You can choose to hide or display
the entire Status Bar. From the Spectrum Analyzer menu, select
View > Status Bar .
Frequency span The range of values shown on the frequency-axis
on the Spectrum Analyzer window.
Details
Spectrum Analyzer sets the frequency span using the values of
parameters on the Main options pane of the Spectrum Settings
panel.
3-1373
dsp.SpectrumAnalyzer
By default, the Full Span check box in the Main options pane is
enabled, and its equivalent FrequencySpan property is set to 'Full'.
In this case, the Spectrum Analyzer computes and plots the spectrum
over the entire Nyquist frequency interval. When the Two-sided
spectrum check box in the Trace options pane is enabled, and its
equivalent PlotAsTwoSidedSpectrum property is true, the Nyquist
SampleRate SampleRate
,
interval is
FrequencyOffset hertz.
2
2
PlotAsTwoSidedSpectrum
If you set the
property
to false, the
SampleRate
Nyquist interval is 0,
FrequencyOffset hertz.
2
3-1374
dsp.SpectrumAnalyzer
Note When this check box is selected, Spectrum Analyzer may display
a misleading spectrum in some situations. For example, if the input
signal is wide-band with non-stationary behavior, such as a chirp
signal, Spectrum Analyzer might display a stationary spectrum. The
reason for this behavior is that Spectrum Analyzer buffers the input
signal data and only updates the display periodically at approximately
20 times per second. Therefore, Spectrum Analyzer does not render
changes to the spectrum that occur and elapse between updates, which
gives the impression of an incorrect spectrum. To ensure that spectral
estimates are as accurate as possible, clear the Reduce Plot Rate to
Improve Performance check box. When you clear this box, Spectrum
Analyzer calculates spectra whenever there is enough data, rendering
results correctly.
Toolbar
ShortcutDescription
Keys
Ctrl+P Print the current Spectrum Analyzer
window. To enable printing, run the
release method.
To print the current scope window to
a figure rather than sending it to your
printer, select File > Print to figure.
3-1375
dsp.SpectrumAnalyzer
ButtonMenu
Location
ShortcutDescription
Keys
3-1376
Tools >
Zoom In
N/A
Tools >
Zoom X
N/A
Tools >
Zoom Y
N/A
Tools >
Scaling
Properties
dsp.SpectrumAnalyzer
Note The axes control (zoom) buttons do not change the settings
related to frequency span for Spectrum Analyzer. These buttons are
purely graphical. Spectrum computations are not affected when you
zoom.
Measurements Buttons
Tools > Measurements
N/A
Open
> Cursor
or close the Cursor
Measurements
Measurements panel. This panel
controls the display of vertical and
horizontal cursors on the spectrum
display.
3-1377
dsp.SpectrumAnalyzer
3-1378
dsp.SpectrumAnalyzer
Spectrum
Settings
button.
3-1379
dsp.SpectrumAnalyzer
3-1380
dsp.SpectrumAnalyzer
Sample rate (Hz) The sample rate, in hertz, of the input signals.
Full frequency span Enable this check box to have Spectrum
Analyzer compute and plot the spectrum over the entire
Nyquist frequency interval. By default, when the Two-sided
spectrum check box is also enabled, the Nyquist interval is
SampleRate SampleRate
,
FrequencyOffset hertz. If you
2
clear
the 2Two-sided spectrum
check box, the Nyquist interval
SampleRate
is 0,
FrequencyOffset hertz. Enabling this check box
2 to setting
is equivalent
the FrequencySpan property to 'Full'.
Tunable.
Span (Hz) and CF (Hz), or FStart (Hz) and FStop (Hz) When
Span (Hz) is showing in the Main Options pane, you define
the range of values shown on the frequency-axis on the Spectrum
Analyzer window using frequency span and center frequency.
From the drop-down list, select FStart (Hz) to define the range
of frequency-axis values using start frequency and stop frequency
instead.
3-1381
dsp.SpectrumAnalyzer
3-1382
dsp.SpectrumAnalyzer
N samples
Op
1
NENBW Fs
100
3-1383
dsp.SpectrumAnalyzer
Op
3-1384
dsp.SpectrumAnalyzer
N window
w2 (n)
n=1
the following equation: NENBW = N window
. The
2
rectangular window has the smallest NENBW,
with a value
of 1. All
N window
1
window has an NENBW value of approximately
3-1385
dsp.SpectrumAnalyzer
3-1386
dsp.SpectrumAnalyzer
SampleRate SampleRate
,
interval is
FrequencyOffset
2spectrum is2selected,
hertz if Two-sided
and
SampleRate
0,
FrequencyOffset hertz otherwise. This
2 is equivalent
parameter
to the FrequencyOffset property.
Normal trace Normal trace view. This parameter applies only
when the Spectrum Type is Power or Power density. By default,
when this check box is enabled, Spectrum Analyzer calculates and
plots the power spectrum or power spectrum density computed by
the Welch estimator. The Welch estimator performs a smoothing
operation by averaging a number of spectral estimates. To clear
this check box, you must first select either the Max hold trace or
the Min hold trace check box. This parameter is equivalent to the
PlotNormalTrace property. Tunable.
Max hold trace Maximum hold trace view. This parameter
applies only when the Spectrum Type is Power or Power density.
Select this check box to enable Spectrum Analyzer to plot the
maximum spectral values of all the estimates obtained. This
parameter is equivalent to the PlotMaxHoldTrace property.
Tunable.
Min hold trace Minimum hold trace view. This parameter applies
only when the Spectrum Type is Power or Power density. Select
this check box to enable Spectrum Analyzer to plot the minimum
spectral values of all the estimates obtained. This parameter is
equivalent to the PlotMinHoldTrace property. Tunable.
3-1387
dsp.SpectrumAnalyzer
Measurements The Measurements panels are the panels that appear to the
right side of the Spectrum Analyzer figure. These panels are
Panels
3-1388
dsp.SpectrumAnalyzer
Button Description
Expand the current panel. This button appears after you
click the collapse button to hide the panes in the current
panel. Click this button to display the panes in the current
panel and show measurements again. After you click this
button, it becomes the collapse button
again.
Undock the current panel. This button lets you move the
current panel into a separate window that can be relocated
anywhere on your screen. After you click this button, it
becomes the dock button
in the new window.
Dock the current panel. This button appears only after you
click the undock button. Click this button to put the current
panel back into the right side of the Scope window. After
you click this button, it becomes the undock button
again.
Close the current panel. This button lets you remove the
current panel from the right side of the Scope window.
Some panels have their measurements separated by category into a
number of panes. Click the pane expand button
to show each pane
that is hidden in the current panel. Click the pane collapse button
to
hide each pane that is shown in the current panel.
3-1389
dsp.SpectrumAnalyzer
You can choose to hide or display the Trace Selection panel. In the
Scope menu, select Tools > Measurements > Trace Selection.
button.
3-1390
dsp.SpectrumAnalyzer
Note You must pause the spectrogram display before you can use
cursors.
3-1391
dsp.SpectrumAnalyzer
3-1392
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
dsp.SpectrumAnalyzer
Abbreviation
Name
Multiplier
micro
10^6
milli
10^3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
button.
The Peak finder panel is separated into two panes, labeled Settings
and Peaks. You can expand each pane to see the available options.
3-1393
dsp.SpectrumAnalyzer
Settings Pane
The Settings pane enables you to modify the parameters used to
calculate the peak values within the displayed portion of the input
signal. For more information on the algorithms this pane uses, see the
Signal Processing Toolbox findpeaks function reference.
Peak Threshold The level above which peaks are detected. This
setting is equivalent to the MINPEAKHEIGHT parameter, which you can
set when you run the findpeaks function.
Max Num of Peaks The maximum number of peaks to show. The
value you enter must be a scalar integer between 1 and 99. This
setting is equivalent to the NPEAKS parameter, which you can set
when you run the findpeaks function.
Min Peaks Distance The minimum number of samples between
adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE
parameter, which you can set when you run the findpeaks function.
Peak Excursion The minimum height difference between a peak
and its neighboring samples. Peak excursion is illustrated alongside
peak threshold in the following figure.
3-1394
dsp.SpectrumAnalyzer
3-1395
dsp.SpectrumAnalyzer
Peaks Pane
The Peaks pane displays all of the largest calculated peak values.
It also shows the coordinates at which the peaks occur, using the
parameters you define in the Settings pane. You set the Max Num of
Peaks parameter to specify the number of peaks shown in the list.
3-1396
dsp.SpectrumAnalyzer
Use the check boxes to control which peak values are shown on the
display. By default, all check boxes are cleared and the Peak Finder
panel hides all the peak values. To show all the peak values on the
display, select the check box in the top-left corner of the Peaks pane.
To hide all the peak values on the display, clear this check box. To
show an individual peak, select the check box directly to the left of its
Value listing. To hide an individual peak, clear the check box directly
to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the
value associated with each measurement indicates the abbreviation for
the appropriate International System of Units (SI) prefix, such as m for
milli-. For example, if the input signal is measured in volts, an m next
to a measurement value indicates that this value is in units of millivolts.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
micro
10^6
milli
10^3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
3-1397
dsp.SpectrumAnalyzer
button.
3-1398
dsp.SpectrumAnalyzer
Select the frequency span of the channel, Span(Hz), and specify the
center frequency CF (Hz) of the channel. Alternatively, select the
starting frequency, FStart(Hz), and specify the starting frequency
and ending frequency (FStop (Hz)) values of the channel.
3-1399
dsp.SpectrumAnalyzer
3-1400
Select the frequency span of the channel, Span (Hz), and specify
the center frequency CF (Hz) of the channel. Alternatively, select
the starting frequency, FStart(Hz), and specify the starting
frequency and ending frequency (FStop (Hz)) values of the
channel.
dsp.SpectrumAnalyzer
Filter The filter to use for both main and adjacent channels.
Available filters are None, Gaussian, and RRC (root-raised cosine).
button.
3-1401
dsp.SpectrumAnalyzer
3-1402
dsp.SpectrumAnalyzer
3-1403
dsp.SpectrumAnalyzer
3-1404
dsp.SpectrumAnalyzer
3-1405
dsp.SpectrumAnalyzer
spectral window. If the TOI has the same amplitude as the input
two-tone signal, reduce the power of that input signal.
3-1406
dsp.SpectrumAnalyzer
3-1407
dsp.SpectrumAnalyzer
Visuals
Spectrum
Properties
button.
Display Pane
When the Spectrum Type is Power or Power density, the Display
pane of the VisualsSpectrum Properties dialog box appears as follows:
3-1408
dsp.SpectrumAnalyzer
Title
Select this check box to show the legend in the display. The channel
legend displays a name for each channel of each input signal. When
the legend appears, you can place it anywhere inside of the scope
window. To turn the legend off, clear the Show legend check box.
This parameter applies only when the Spectrum Type is Power or
Power density. Tunable
You can edit the name of any channel in the legend. To do so,
double-click the current name, and enter a new channel name. By
default, if the signal has multiple channels, the scope uses an index
number to identify each channel of that signal. To change the
appearance of any channel of any input signal in the scope window,
from the scope menu, select View > Style.
Show grid
When you select this check box, a grid appears in the display of the
scope figure. To hide the grid, clear this check box. Tunable
3-1409
dsp.SpectrumAnalyzer
Y-limits (Minimum)
Specify the text for the scope to display to the left of the y-axis.
Regardless of this property, Spectrum Analyzer always displays power
units after this text as one of 'dBm', 'dBW', 'Watts', 'dBm/Hz',
'dBW/Hz', or 'Watts/Hz'. Tunable.
Color map
Select the color map for the spectrogram, or enter a 3-column matrix
expression for the color map. See colormap for information. Tunable.
Color-limits (Minimum)
Set the signal power for the minimum color value of the spectrogram.
Tunable.
Color-limits (Maximum)
Set the signal power for the maximum color value of the spectrogram.
Tunable.
Style
Dialog
Box
3-1410
In the Style dialog box, you can customize the style of power and power
density displays. This dialog box is not available in spectrogram view.
You are able to change the color of the figure, the background and
foreground colors of the axes, and properties of the lines. From the
Spectrum Analyzer menu, select View > Style to open this dialog box.
dsp.SpectrumAnalyzer
Properties
The Style dialog box allows you to modify the following properties of
the Spectrum Analyzer figure:
Figure color
Specify the color that you want to apply to the background of the scope
figure. By default, the figure color is gray.
Axes colors
Specify the color that you want to apply to the background of the axes.
Properties for line
Specify the channel for which you want to modify the visibility, line
properties, and marker properties.
Visible
Specify the line style, line width, and line color for the selected channel.
3-1411
dsp.SpectrumAnalyzer
Marker
Specify marks for the selected channel to show at its data points. This
parameter is similar to the Marker property for the MATLAB Handle
Graphics plot objects. You can choose any of the marker symbols from
the following table.
Specifier
Marker Type
none
No marker (default)
Circle
Square
Cross
Point
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)
3-1412
dsp.SpectrumAnalyzer
Tools
Axes
Scaling
Properties
Properties
The ToolsAxes Scaling Properties dialog box appears as follows for
power and power density views.
3-1413
dsp.SpectrumAnalyzer
Specify when the scope should automatically scale the axes. If the
spectrogram is displayed, specify when the scope should automatically
scale the color. You can select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes or color. You can manually scale the
axes or color in any of the following ways:
Auto When you select this option, the scope scales the axes or color
as needed, both during and after simulation. Selecting this option
shows the Do not allow Y-axis limits to shrink or Do not allow
color limits to shrink .
3-1414
dsp.SpectrumAnalyzer
When you select this property, the y-axis are only allowed to grow
during axes scaling operations. If the spectrogram is displayed,
selecting this property allows the color limits to only grow during axis
scaling. If you clear this check box, the y-axis or color limits may shrink
during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
or Color scaling property. When you set the Axes scaling or Color
scaling property to Manual or After N Updates, the y-axis or color
limits are allowed to shrink. Tunable.
Number of updates
Select this check box to scale the axes when the simulation stops. If the
spectrogram is displayed, select this check box to scale the color when
the simulation stops. The y-axis is always scaled. The x-axis limits are
only scaled if you also select the Scale X-axis limits check box.
Y-axis Data range (%) / Color-limits Data range
Set the percentage of the y-axis that the scope should use to display
the data when scaling the axes. If the spectrogram is displayed, set
the percentage of the power values range within the color map. Valid
values are between 1 and 100. For example, if you set this property
to 100, the Scope scales the y-axis limits such that your data uses
the entire y-axis range. If you then set this property to 30, the scope
3-1415
dsp.SpectrumAnalyzer
increases the y-axis range or color such that your data uses only 30% of
the y-axis range or color. Tunable.
Y-axis Align / Color-limits Align
Specify where the scope should align your data with respect to the
y-axis when it scales the axes. If the spectrogram is displayed, specify
where the scope should align your data with respect to the y-axis when
it scales the color. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
X-axis Data range (%)
Set the percentage of the x-axis that the Scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the x-axis
limits such that your data uses the entirex-axis range. If you then set
this property to 30, the Scope increases the x-axis range such that your
data uses only 30% of the x-axis range. Use the x-axis Align property to
specify data placement with respect to the x-axis.
This property appears only when you select the Scale X-axis limits
check box. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
Algorithms
3-1416
Spectrum Analyzer uses the RBW or the Window Length setting in the
Spectrum Settings panel to determine the data window length. The
value of the FrequencyResolutionMethod property determines whether
RBW or window length is used. Then, it partitions the input signal into
a number of windowed data segments. Finally, Spectrum Analyzer
uses the modified periodogram method to compute spectral updates,
averaging the windowed periodograms for each segment.
dsp.SpectrumAnalyzer
Op
1
NENBW Fs
100
N samples
RBW
The normalized effective noise bandwidth, NENBW, is a factor
that depends on the windowing method. Spectrum Analyzer shows
NENBW in the Window Options pane of the Spectrum Settings
panel. Overlap percentage, Op, is the value of the Overlap %
parameter in the Window Options pane of the Spectrum Settings
panel. Fs is the sample rate of the input signal. Spectrum Analyzer
shows sample rate in the Main Options pane of the Spectrum
Settings panel.
a When in RBW mode, the window length required to compute
N window =
NENBW Fs
RBW
3-1417
dsp.SpectrumAnalyzer
Op
N samples = 1
N window
100
Nsamples
0%
100
50%
50
80%
20
N window
NENBW = N window
w2 (n)
n=1
N window
d When in RBW mode, you can set the resolution bandwidth using
w(n)
the value of the RBW
parameter
on the Main options pane
n=1 panel.
You must specify a value to
of the Spectrum Settings
ensure that there are at least two RBW intervals over the specified
frequency span. The ratio of the overall span to RBW must be
greater than two, as given in the following equation.
3-1418
dsp.SpectrumAnalyzer
span
2
RBW
By default, the RBW parameter on the Main options pane is
set to Auto. In this case, the Spectrum Analyzer determines the
appropriate value to ensure that there are 1024 RBW intervals
over the specified frequency span. Thus, when you set RBW to
span
1024
e When in window length mode, you specify Nwindow and the resulting
RBW is
Auto, it is calculated by the following equation. RBWauto
NENBW * Fs
N window
In some cases, the number of samples provided in the input are not
sufficient to achieve the resolution bandwidth that you specify. When
this situation occurs, Spectrum Analyzer produces a message on the
display, as shown in the following figure.
3-1419
dsp.SpectrumAnalyzer
N FFT
2
( p)
[ n]e
j 2 f ( n 1) T
1 P n =1
PSD( f ) =
N window
P p=1
2
F
w [ n]
discrete
s is the
In this equation, x[n]
input signal. On every input
n =1
signal frame, Spectrum Analyzer generates as many overlapping
windows as possible, each window denoted as x(p)[n], and computes
their periodograms. Spectrum Analyzer displays a running average
of the P most current periodograms.
Power Spectrum The power spectrum is the product of the
power spectral density and the resolution bandwidth, as given by the
following equation.
N FFT
F NENBW 1
Pspectrum ( f ) = PSD( f ) RBW = PSD( f ) s
=
N window
P
( p)
[ n]e
j 2 f ( n 1) T
n =1
N window
w[ n ]
Spectrogram Each line of the spectrogram is one periodogram. n =1
3-1420
p=1
dsp.SpectrumAnalyzer
100 - Occupied BW %
2
100 - Occupied BW %
2
The bandwidth between the lower and upper power frequency values
is the occupied bandwidth.
The frequency halfway between the lower and upper frequency
values is the center frequency.
The Distortion Measurements are computed as follows.
3-1421
dsp.SpectrumAnalyzer
3 The power and width of the second, and higher order harmonics (P2,
Wsum = W0+W1+W2+...+Wn.
The sum of powers of the second and higher order harmonics are
computed as Pharmonic = P2+P3+P4+...+Pn.
6 The sum of the noise power is then estimated as Pnoise = (Premaining*dF
7 The metrics for SNR, THD, SINAD, and SFDR are then computed
3-1422
dsp.SpectrumAnalyzer
3-1423
dsp.SpectrumAnalyzer
3-1424
dsp.SpectrumAnalyzer
3-1425
dsp.SpectrumAnalyzer
where F1 and F2 are the sinusoid input frequencies and |A| + |B| =
N. A and B are integer values.
For intermodulation measurements, the third-order intercept (TOI)
point is computed as follows, where P is power in decibels of the
measured power referenced to one milliwatt (dBm).:
See Also
3-1426
dsp.SpectrumAnalyzer.clone
Purpose
Syntax
C = clone(H)
Description
3-1427
dsp.SpectrumAnalyzer.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1428
dsp.SpectrumAnalyzer.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-1429
dsp.SpectrumAnalyzer.hide
Purpose
Syntax
hide(H)
Description
See Also
3-1430
object, H.
dsp.SpectrumAnalyzer | dsp.SpectrumAnalyzer.show
dsp.SpectrumAnalyzer.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1431
dsp.SpectrumAnalyzer.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
You should call the release method after calling the step method when
there is no new data for the simulation. When you call the release
method, the axes will automatically scale in the Spectrum Analyzer
figure window. After calling the release method, any non-tunable
properties can be set once again.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
Algorithms
See Also
dsp.SpectrumAnalyzer | dsp.SpectrumAnalyzer.reset
3-1432
dsp.SpectrumAnalyzer.reset
Purpose
Syntax
reset(H)
Description
You should call the reset method after calling the step method
when you want to clear the Spectrum Analyzer figure displays, prior
to releasing system resources. This action enables you to start a
simulation from the beginning. When you call the reset method, the
displays will become blank again. In this sense, its functionality is
similar to that of the MATLAB clf function. Do not call the reset
method after calling the release method.
Algorithms
See Also
dsp.SpectrumAnalyzer | dsp.SpectrumAnalyzer.release
3-1433
dsp.SpectrumAnalyzer.show
Purpose
Syntax
show(H)
Description
See Also
dsp.SpectrumAnalyzer | dsp.SpectrumAnalyzer.hide
3-1434
dsp.SpectrumAnalyzer.step
Purpose
Syntax
step(H,X)
Description
Analyzer figure.
3-1435
dsp.SpectrumEstimator
Purpose
Description
on page 3-1436.
2 Call step to implement the estimator according to the properties of
Construction
H, with each specified property name set to the specified value. You
can specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN).
Properties
SampleRate
Spectrum type
Specify the spectrum type as one of 'Power' | 'Power density'.
When the spectrum type is 'Power', the power spectral density is
3-1436
dsp.SpectrumEstimator
FFT Length
Specify the length of the FFT that the Spectrum Estimator uses
to compute spectral estimates as a positive, integer scalar. This
property applies when you set the FFTLengthSource property to
'Property'. The default value is 128.
Window
Window function
Specify a window function for the spectral estimator as one of
'Rectangular' | 'Chebyshev' | 'Flat Top' | 'Hamming' |
'Hann' | 'Kaiser'. The default value is 'Hann'.
SidelobeAttenuation
3-1437
dsp.SpectrumEstimator
Methods
3-1438
clone
getFrequencyVector
dsp.SpectrumEstimator
Examples
getRBW
isLocked
reset
step
Use the Spectrum Estimator to compute the power spectrum of the sine
wave. Also, use the Array Plot to display the spectrum:
hs = dsp.SpectrumEstimator('SampleRate', hsin.SampleRate,...
'SpectrumType','Power',...
'FrequencyRange','centered');
hplot = dsp.ArrayPlot('PlotType','Line','XOffset',-500,'YLimits',...
[0 .35],'YLabel','Power Spectrum (Watts)',...
'XLabel','Frequency (Hz)',...
'Title','Power Spectrum of 100 Hz Sine Wave');
Add random noise to the sine wave. Step through the System objects to
obtain the data streams, and plot the power spectrum of the signal:
for ii = 1:10
x = step(hsin) + 0.05*randn(1000,1);
Pxx = step(hs, x);
step(hplot,Pxx);
end
3-1439
dsp.SpectrumEstimator
Algorithms
Let x be the input frame. We first multiply x by the window, and scale
it by the window power. We then take FFT of the signal, calling it Y.
This is followed by taking the square magnitude of the FFT, i.e., Z =
Y*conj(Y). We average the last N number of Zs, and scale the answer
by the sample rate.
For further information refer to the Algorithms on page 3-1416 section
in Spectrum Analyzer, which uses the same algorithm.
References
[1] Hayes, Monson H. Statistical Digital Signal Processing and
Modeling. Hoboken, NJ: John Wiley & Sons, 1996
[2] Kay, Steven M. Modern Spectral Estimation: Theory and
Application. Englewood Cliffs, NJ: Prentice Hall, 1999
[3] Stoica, Petre and Randolph L. Moses. Spectral Analysis of Signals.
Englewood Cliffs, NJ: Prentice Hall, 2005
[4] Welch, P. D. The use of fast Fourier transforms for the estimation
of power spectra: A method based on time averaging over short modified
periodograms, IEEE Transactions on Audio and Electroacoustics, Vol.
15, pp. 7073, 1967.
See Also
3-1440
dsp.SpectrumAnalyzer | dsp.TransferFunctionEstimator |
dsp.CrossSpectrumEstimator
dsp.SpectrumEstimator.clone
Purpose
Syntax
C = clone(H)
Description
the same property values. The clone method creates a new unlocked
object with uninitialized states.
3-1441
dsp.SpectrumEstimator.getFrequencyVector
Purpose
Syntax
getFrequencyVector(H)
Description
3-1442
dsp.SpectrumEstimator.getRBW
Purpose
Syntax
getRBW(H)
Description
3-1443
dsp.SpectrumEstimator.isLocked
Purpose
Syntax
L = isLocked(H)
Description
3-1444
input attributes and nontunable properties are locked for the System
object. The object performs an internal initialization the first time the
step method is executed. This initialization locks nontunable properties
and input specifications, such as dimensions, complexity, and data type
of the input data. Once this occurs, the isLocked method returns a
true value.
dsp.SpectrumEstimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1445
dsp.SpectrumEstimator.reset
Purpose
Syntax
reset(H)
Description
3-1446
dsp.SpectrumEstimator.step
Purpose
Syntax
Y = step(H,x)
[Y1,...,YN] = step(H,x)
Description
outputs.
The columns of x are treated as independent channels.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1447
dsp.StandardDeviation
Purpose
Description
on page 3-1448.
2 Call step to compute the standard deviation according to the
Construction
Properties
RunningStandardDeviation
3-1448
dsp.StandardDeviation
ROIProcessing
Enable region of interest processing
Set this property to true to enable calculating the standard
deviation within a particular region for each image. This property
applies only when you set the RunningStandardDeviation
property to false and the Dimension property is All. The default
is false.
Full ROI processing support requires a Computer Vision System
Toolbox license. With only the DSP System Toolbox license,
Rectangles is the only selection that applies for the ROIForm
property.
3-1449
dsp.StandardDeviation
ROIForm
3-1450
dsp.StandardDeviation
FrameBasedProcessing
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-1451
dsp.StandardDeviation
Algorithms
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
uses the FrameBasedProcessing property. The block uses the Input
processing parameter. See Set the FrameBasedProcessing Property
of a System object for more information.
See Also
3-1452
dsp.StandardDeviation.clone
Purpose
Syntax
C = clone(H)
Description
3-1453
dsp.StandardDeviation.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1454
dsp.StandardDeviation.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1455
dsp.StandardDeviation.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1456
dsp.StandardDeviation.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1457
dsp.StandardDeviation.reset
Purpose
Syntax
reset(H)
Description
3-1458
dsp.StandardDeviation.step
Purpose
Syntax
Y =
Y =
Y =
Y =
[Y,
[Y,
Description
step(H,X)
step(H,X,R)
step(H,X,ROI)
step(H,X,LABEL,LABELNUMBERS)
FLAG] = step(H,X,ROI)
FLAG] = step(H,X,LABEL,LABELNUMBERS)
the given region of interest is within the image bounds when the
ValidityOutputPort property is true.
[Y, FLAG] = step(H,X,LABEL,LABELNUMBERS) returns FLAG which
indicates whether the input label numbers are valid when the
ValidityOutputPort property is true.
3-1459
dsp.StandardDeviation.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1460
dsp.StateLevels
Purpose
Description
on page 3-1461.
2 Call step to estimate the state levels for an input vector according to
Construction
Properties
HistogramBounds
3-1461
dsp.StateLevels
the minimum and maximum input values. When you set this
property to 'Property', the histogram bounds are determined
by the value of the HistogramBounds property. This property
applies when you set the Method property to 'Histogram mode'
or 'Histogram mean', and the RunningStateLevels property is
false.
Default: 'Auto'
HistogramNumBins
3-1462
dsp.StateLevels
State
State-Level Tolerances
Each state level can have associated lower- and upper-state boundaries.
These state boundaries are defined as the state level plus or minus a
scalar multiple of the difference between the high state and low state.
To provide a useful tolerance region, the scalar is typically a small
number such as 2/100 or 3/100. In general, the % tolerance region for
the low state is defined as
(S S )
S1 100
2
1
3-1463
dsp.StateLevels
3-1464
dsp.StateLevels
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
plot
release
reset
step
Plot the clock data along with the estimated state levels and histograms.
plot(h)
3-1465
dsp.StateLevels
Algorithms
References
See Also
dsp.TransitionMetrics | dsp.PulseMetrics
3-1466
dsp.StateLevels.clone
Purpose
Syntax
clone(H)
Description
3-1467
dsp.StateLevels.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1468
dsp.StateLevels.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1469
dsp.StateLevels.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1470
dsp.StateLevels.plot
Purpose
Syntax
plot(H)
Description
plot(H) plots the signal and state levels computed in the last call to the
step method. If the Method property of the state levels object is set to
'Histogram mode' or 'Histogram Mean', the histogram is plotted in a
3-1471
dsp.StateLevels.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1472
dsp.StateLevels.reset
Purpose
Syntax
reset(H)
Description
3-1473
dsp.StateLevels.step
Purpose
Syntax
LEVELS = step(H,X)
[LEVELS,HISTOGRAM] = step(H,X)
Description
vector.
[LEVELS,HISTOGRAM] = step(H,X) returns a double-precision column
vector, HISTOGRAM, containing the histogram of the sample values in
X. You can obtain this output only when you set the Method property
to either 'Histogram mean' or 'Histogram mode', and you set the
HistogramOutputPort property to true.
3-1474
dsp.SubbandAnalysisFilter
Purpose
Description
Construction
Properties
LowpassCoefficients
3-1475
dsp.SubbandAnalysisFilter
3-1476
dsp.SubbandAnalysisFilter
OverflowAction
3-1477
dsp.SubbandAnalysisFilter
Methods
3-1478
clone
getNumInputs
getNumOutputs
isLocked
dsp.SubbandAnalysisFilter
Examples
release
reset
step
Algorithms
See Also
dsp.SubbandSynthesisFilter | dsp.DyadicAnalysisFilterBank
3-1479
dsp.SubbandAnalysisFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-1480
dsp.SubbandAnalysisFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1481
dsp.SubbandAnalysisFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1482
dsp.SubbandAnalysisFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1483
dsp.SubbandAnalysisFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1484
dsp.SubbandAnalysisFilter.reset
Purpose
Syntax
reset(H)
Description
3-1485
dsp.SubbandAnalysisFilter.step
Purpose
Syntax
[HI,LO] = step(H,SIG)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1486
dsp.SubbandSynthesisFilter
Purpose
Description
Construction
Properties
LowpassCoefficients
3-1487
dsp.SubbandSynthesisFilter
3-1488
dsp.SubbandSynthesisFilter
OverflowAction
3-1489
dsp.SubbandSynthesisFilter
Methods
3-1490
clone
getNumInputs
getNumOutputs
isLocked
dsp.SubbandSynthesisFilter
Examples
release
reset
step
load dspwlets;
Algorithms
3-1491
dsp.SubbandSynthesisFilter
See Also
3-1492
dsp.SubbandAnalysisFilter | dsp.DyadicSynthesisFilterBank
dsp.SubbandSynthesisFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-1493
dsp.SubbandSynthesisFilter.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1494
dsp.SubbandSynthesisFilter.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1495
dsp.SubbandSynthesisFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1496
dsp.SubbandSynthesisFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1497
dsp.SubbandSynthesisFilter.reset
Purpose
Syntax
reset(H)
Description
3-1498
dsp.SubbandSynthesisFilter.step
Purpose
Syntax
Y = step(H,HI,LO)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1499
dsp.TimeScope
Purpose
Description
3-1502.
2 Call step to display the signal in the Time Scope figure. The behavior
3-1500
dsp.TimeScope
See the following sections for information on the Time Scope System
object:
Construction on page 3-1502
Properties on page 3-1503
Methods on page 3-1513
See the following sections for information on the Time Scope Graphical
User Interface:
3-1501
dsp.TimeScope
Note If you own the MATLAB Coder product, you can generate C or
C++ code from MATLAB code in which an instance of this system object
is created. When you do so, the scope system object is automatically
declared as an extrinsic variable. In this manner, you are able to see
the scope display in the same way that you would see a figure using the
plot function, without directly generating code from it. For the full list
of system objects supporting code generation, see DSP System Toolbox
in the MATLAB Coder documentation.
Construction
3-1502
dsp.TimeScope
H =
dsp.TimeScope(NUMINPUTS,SAMPLERATE,'PropertyName',PropertyValue,
...) creates a Time Scope System object, H. This object has the
NumInputPorts property set to NUMINPUTS, the SampleRate property set
to SAMPLERATE, and other specified properties set to the specified
values. NUMINPUTS and SAMPLERATE are value-only arguments. You can
specify PropertyNamePropertyValue arguments in any order.
Properties
ActiveDisplay
3-1503
dsp.TimeScope
FrameBasedProcessing
3-1504
dsp.TimeScope
3-1505
dsp.TimeScope
3-1506
dsp.TimeScope
3-1507
dsp.TimeScope
When you set this property to true, the scope displays a legend
with automatic string labels for each input channel. When you set
this property to false, the scope does not display a legend. This
property applies only when you set the SpectrumType property to
'Power' or 'Power density'. This property is Tunable.
See FrameBasedProcessing for information on input channels.
When set, ActiveDisplay controls which display is updated.
Default: false
TimeAxisLabels
Time-axis labels
Specify how time-axis labels should appear in the scope displays
as one of 'All', 'Bottom, or 'None'.
When you set this property to 'All', time-axis labels appear
in all displays.
When you set this property to 'Bottom', time-axis labels
appear in the bottom display of each column.
When you set this property to 'None', there are no labels in
any displays.
This property is Tunable.
3-1508
dsp.TimeScope
Default: 'All'
TimeDisplayOffset
Time span
Specify the time span, in seconds, as a positive, numeric scalar
value. This property applies when FrameBasedProcessing is
false. This property also applies when FrameBasedProcessing
is true and TimeSpanSource is Property. The time-axis limits
are calculated as follows.
Minimum time-axis limit = min(TimeDisplayOffset)
Maximum time-axis limit = max(TimeDisplayOffset) +
TimeSpan
3-1509
dsp.TimeScope
Default: 10
TimeSpanOverrunAction
3-1510
dsp.TimeScope
Display title
3-1511
dsp.TimeScope
3-1512
dsp.TimeScope
Methods
Displaying
Multiple
Signals
clone
getNumInputs
getNumOutputs
hide
isLocked
release
reset
show
step
3-1513
dsp.TimeScope
Run the show method to open the scope window. In the scope menu,
select View > Configuration Properties and set the Number of
input ports on the Main tab.
An input signal may contain multiple channels, depending on
its dimensions. Multiple channels of data always appear as
different-colored lines on the same display.
Multiple Signal Names and Colors
By default, if the input signal has multiple channels, the scope uses an
index number to identify each channel of that signal. For example,
a 2-channel signal would have the following default names in the
channel legend: Channel 1, Channel 2. To show the legend, select
View > Configuration Properties, click the Display tab, and select
the Show Legend check box. If there are a total of 7 input channels,
the following legend appears in the display.
By default, the scope has a black axes background and chooses line
colors for each channel in a manner similar to the Simulink Scope block.
When the scope axes background is black, it assigns each channel of
each input signal a line color in the order shown in the above figure.
If there are more than 7 channels, then the scope repeats this order
to assign line colors to the remaining channels. To choose line colors
for each channel, change the axes background color to any color
except black. To change the axes background color to white, select
View > Style, click the Axes background color button (
), and
select white from the color palette. Run the simulation again. The
following legend appears in the display. This is the color order when the
background is not black.
3-1514
dsp.TimeScope
Multiple Displays
You can display multiple channels of data on different displays in the
scope window. In the scope toolbar, select View > Layout, or select
the Layout button (
).
Note The Layout menu item and button are not available when the
scope is in snapshot mode.
This feature allows you to tile the window into a number of separate
displays, up to a grid of 4 rows and 4 columns. For example, if there
are three inputs to the scope, you can display the signals in separate
displays by selecting row 3, column 1, as shown in the following figure.
3-1515
dsp.TimeScope
After you select row 3, column 1, the scope window is partitioned into
three separate displays, as shown in the following figure.
3-1516
dsp.TimeScope
When you use the Layout option to tile the window into multiple
displays, the display highlighted in blue is referred to as the active
display. The scope dialog boxes reference the active display.
Signal
Display
Time Scope uses the Time span and Time display offset parameters
in order to determine the time range. To change the signal display
settings, select View > Configuration Properties to bring up the
VisualsTime Domain Properties dialog box. Then, modify the values
for the Time span and Time display offset parameters on the Main
tab. For example, if you set the Time span to 25 seconds, the scope
displays 25 seconds worth of simulation data at a time. If you also set
the Time display offset to 5 seconds, the scope displays values on the
time axis from 5 to 30 seconds. The values on the time-axis of the Time
Scope display remain the same throughout simulation.
To communicate the simulation time that corresponds to the current
display, the scope uses the Time units, Time offset, and Simulation
time indicators on the scope window. The following figure highlights
these and other important aspects of the Time Scope window.
Time Indicators
Minimum time-axis limit The Time Scope sets the minimum
time-axis limit using the value of the Time display offset parameter
on the Main tab of the VisualsTime Domain Properties dialog
3-1517
dsp.TimeScope
box. If you specify a vector of values for the Time display offset
parameter, the scope uses the smallest of those values to set the
minimum time-axis limit.
Maximum time-axis limit The Time Scope sets the maximum
time-axis limit by summing the value of Time display offset
parameter with the value of the Time span parameter. If you specify
a vector of values for the Time display offset parameter, the scope
sets the maximum time-axis limit by summing the largest of those
values with the value of the Time span parameter.
Time units The units used to describe the time-axis. The
Time Scope sets the time units using the value of the Time
Units parameter on the Time tab of the Configuration Properties
dialog box. By default, this parameter is set to Metric (based
on Time Span) and displays in metric units such as milliseconds,
microseconds, minutes, days, etc. You can change it to Seconds to
always display the time-axis values in units of seconds. You can
change it to None to not display any units on the time-axis. When you
set this parameter to None, then Time Scope shows only the word
Time on the time-axis.
To hide both the word Time and the values on the time-axis, set
the Show time-axis labels parameter to None. To hide both the
word Time and the values on the time-axis in all displays except the
bottom ones in each column of displays, set this parameter to Bottom
Displays Only. This behavior differs from the Simulink Scope block,
which always shows the values but never shows a label on the x-axis.
For more information, see Visuals Time Domain Properties on page
3-1574.
Simulation Indicators
Simulation status Provides the current status of the model
simulation. The status can be either of the following conditions:
3-1518
Processing Occurs after you run the step method and before
you run the release method.
dsp.TimeScope
Stopped Occurs after you construct the scope object and before
you first run the step method. This status also occurs after you
run the release method.
length( x)
. You can set the sample rate using the
SampleRate
SampleRate property.
tsim tsim
The Simulation time is part of the Status Bar in the Time Scope
window. You can choose to hide or display the entire Status Bar.
From the Time Scope menu, select View > Status Bar .
Axes Maximization
When the scope is in maximized axes mode, the following figure
highlights the important indicators on the scope window.
3-1519
dsp.TimeScope
To toggle this mode, in the scope menu, select View > Configuration
Properties. In the Main pane, locate the Maximize axes parameter.
Specify whether to display the scope in maximized axes mode. In this
mode, each of the axes is expanded to fit into the entire display. To
conserve space, labels do not appear in each display. Instead, tick-mark
values appear on top of the plotted data. You can select one of the
following options:
Auto In this mode, the axes appear maximized in all displays only
if the Title and YLabel properties are empty for every display. If
you enter any value in any display for either of these properties, the
axes are not maximized.
On In this mode, the axes appear maximized in all displays. Any
values entered into the Title and YLabel properties are hidden.
Off In this mode, none of the axes appear maximized.
This property is Tunable.
The default setting is Auto.
3-1520
dsp.TimeScope
Toolbar
Print Button
ButtonMenu
Location
File >
Print
Shortcut Description
Keys
Ctrl+P Print the current scope window.
Printing is available only when the
scope display is not changing.
To print the current scope window to
a figure rather than sending it to your
printer, select File > Print to figure.
ShortcutDescription
Keys
Tools >
Zoom In
N/A
Tools >
Zoom X
N/A
3-1521
dsp.TimeScope
ButtonMenu
Location
ShortcutDescription
Keys
your cursor along the x-axis over your
area of interest.
Tools >
Zoom Y
N/A
Tools >
Pan
N/A
Tools >
Scale
Y-Axes
Limits
3-1522
dsp.TimeScope
ButtonMenu
Location
ShortcutDescription
Keys
Scale Axes Limits after 10
Updates When you select this
option, the scope scales the axes
after 10 updates. The scope does
not scale the axes again during the
simulation.
Scale Axes Limits at Stop
When you select this option, the
scope scales the axes each time the
simulation is stopped.
Tools >
Scale X-Axis
Limits
N/A
3-1523
dsp.TimeScope
ButtonMenu
Location
ShortcutDescription
Keys
Scale Axes Limits at Stop
When you select this option, the
scope scales the axes each time the
simulation is stopped.
Tools >
Scale X
and Y Axes
Limits
N/A
3-1524
dsp.TimeScope
Measurements Buttons
Tools >
Triggers
N/A
Tools >
N/A
Measurements >
Cursor
Measurements
Tools >
N/A
Measurements >
Signal
Statistics
3-1525
dsp.TimeScope
Tools >
N/A
Measurements >
Bilevel
Measurements
Tools >
N/A
Measurements >
Peak
Finder
Other Buttons
View > LayoutN/A
3-1526
dsp.TimeScope
You can control whether this toolbar appears in the Time Scope window.
From the Time Scope menu, select View > Toolbar.
Measurements The Measurements panels are the five panels that appear to the right
side of the Time Scope GUI. These panels are labeled Trace selection,
Panels
Cursor measurements, Signal statistics, Bilevel measurements,
and Peak finder.
3-1527
dsp.TimeScope
Button Description
Dock the current panel. This button appears only after you
click the undock button. Click this button to put the current
panel back into the right side of the Scope window. After
you click this button, it becomes the undock button
again.
Close the current panel. This button lets you remove the
current panel from the right side of the Scope window.
Some panels have their measurements separated by category into a
number of panes. Click the pane expand button
to show each pane
that is hidden in the current panel. Click the pane collapse button
to
hide each pane that is shown in the current panel.
You can choose to hide or display the Trace Selection panel. In the
Scope menu, select Tools > Measurements > Trace Selection.
Triggers Panel
The Triggers panel allows you to pause the display only when certain
events occur. You can use the Triggers panel when you want to align
or search for interesting events. You can configure triggers to both
select and align specific regions of interest in the display area of the
3-1528
dsp.TimeScope
scope. Triggers work across multiple displays. You can also choose
to hide or display the Triggers panel. In the scope toolbar, click
the Triggers button (
Tools > Triggers.
3-1529
dsp.TimeScope
Note The scope does not display an event until at least a full time
span is completely viewable inside the display. To prevent data from
being shown twice in the display, the scope suppresses the alignment of
recurring events until a full time span has elapsed since the previous
update.
Main Pane
The Main pane lets you choose how often the display updates and in
what position the trigger indicator appears.
Mode Define how often the display should update.
Auto The scope aligns and displays data from the latest trigger
event. If no event is found after a full time span has elapsed, then
the scope displays the last available data. Use this mode to see
your data and have it align whenever a trigger event occurs.
Normal The scope aligns and displays data only from the latest
trigger event. Use this mode to search for infrequently occurring
events in your data.
3-1530
dsp.TimeScope
3-1531
dsp.TimeScope
In the case of a falling edge, the scope enables the trigger event
when the signal value becomes greater than the level threshold
plus hysteresis. The scope disables the trigger event when the
signal becomes less than the level threshold for the first time. The
scope uses linear interpolation to generate a trigger event at the
time when the signal crosses the level threshold, as shown in the
following figure.
3-1532
dsp.TimeScope
3-1533
dsp.TimeScope
3-1534
dsp.TimeScope
scope encounters the trigger event when the signal crosses the
high threshold. The transition time is when the signal crosses
the middle threshold, located halfway between the high and low
thresholds, as shown in the following figure.
3-1535
dsp.TimeScope
following figure. The runt width is the Max Width Min Width.
Any runt pulse width that is less than the minimum width or
greater than the maximum width will not generate a trigger event.
3-1536
dsp.TimeScope
3-1537
dsp.TimeScope
3-1538
dsp.TimeScope
Alternatively, the scope can encounter the trigger event when the
signal stays within the boundaries defined by the hysteresis for
7.50 seconds after the signal crosses the level threshold, as shown
in the following figure.
3-1539
dsp.TimeScope
Polarity Select the polarity of the trigger type. The option you
choose for Type directly affects the options available for Polarity,
as shown in the following table.
3-1540
Trigger Type
Polarity Options
Edge
Pulse Width
Transition
Runt
dsp.TimeScope
Trigger Type
Polarity Options
Window
Timeout
3-1541
dsp.TimeScope
3-1542
Inside Trigger when the signal stays within the low and high
levels for a specified time duration.
Outside Trigger when the signal stays outside of the low and
high levels for a specified time duration.
dsp.TimeScope
Rising Trigger when the signal does not cross the reference
level from below.
Falling Trigger when the signal does not cross the reference
level from above.
Either Trigger when the signal does not cross the reference
level from either direction.
Level
Parameters
Auto-Level
Setting
Timing Parameters
Edge
Level,
Hysteresis
High, Low
Level = 50%
n/a
Transition
High, Low
Runt
High, Low
Window
High, Low
Timeout
Level,
Hysteresis
n/a
Timeout
Pulse
Width
3-1543
dsp.TimeScope
the Level parameter to 50% of the range of the source signal. If you
set the trigger type to Timeout, the Triggers panel does not show
this option. Setting the trigger type to other menu choices results in
High and Low parameter adjustment. Auto level sets the High
parameter to 90% of the range of the source signal and the Low
parameter to 10% of the range of the source signal.
Level (V) Specify, in volts, the trigger level. This parameter is
visible when you set Type to Edge or Timeout.
Hysteresis (V) Specify, in volts, the hysteresis or noise reject
value. This parameter is visible when you set Type to Edge or
Timeout. If the signal jitters inside this range and briefly crosses
the trigger level, the scope does not register an event. In the case
of an edge trigger with rising polarity, the scope ignores any times
that the signal crosses the trigger level within the hysteresis region,
as shown in the following figure.
3-1544
dsp.TimeScope
You can reduce the hysteresis region size by decreasing the hysteresis
value. If you set the hysteresis value to 0.07 in this example, then
the scope also considers the second rising edge to be a trigger event,
as shown in the following figure.
3-1545
dsp.TimeScope
3-1546
dsp.TimeScope
button.
3-1547
dsp.TimeScope
3-1548
dsp.TimeScope
button.
3-1549
dsp.TimeScope
3-1550
dsp.TimeScope
Name
Multiplier
atto
10^-18
femto
10^-15
pico
10^12
nano
10^-9
micro
10^-6
milli
10^-3
10^0
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
3-1551
dsp.TimeScope
Abbreviation
Name
Multiplier
peta
10^15
exa
10^18
button.
3-1552
dsp.TimeScope
Settings Pane
The Settings pane enables you to modify the properties used to
calculate various measurements involving transitions, overshoots,
undershoots, and cycles. You can modify the high-state level, low-state
level, state-level tolerance, upper-reference level, mid-reference level,
and lower-reference level, as shown in the following figure.
Auto State Level When this check box is selected, the Bilevel
measurements panel autodetects the high- and low- state levels of
a bilevel waveform. For more information on the algorithm this
option uses, see the Signal Processing Toolbox statelevels function
reference. When this check box is cleared, you may enter in values
for the high- and low- state levels manually.
3-1553
dsp.TimeScope
3-1554
dsp.TimeScope
3-1555
dsp.TimeScope
3-1556
dsp.TimeScope
Whenever there is a plus sign (+) next to a text label, this symbol refers
to measurement associated with a rising edge, a transition from a
low-state level to a high-state level.
A negative-going transition, or falling edge, in a bilevel waveform
is a transition from the high-state level to the low-state level. A
negative-going transition has a slope value less than zero. The following
figure shows a negative-going transition.
3-1557
dsp.TimeScope
3-1558
dsp.TimeScope
3-1559
dsp.TimeScope
Fall Time Average amount of time required for each falling edge
to cross from the upper-reference level to the lower-reference level.
For more information on the algorithm this measurement uses, see
the Signal Processing Toolbox falltime function reference.
Slew Rate Average slope of each falling edge transition line
within the upper- and lower-percent reference levels in the displayed
portion of the input signal. For more information on the algorithm
this measurement uses, see the Signal Processing Toolbox slewrate
function reference.
Overshoots/Undershoots
The Overshoots/Undershoots pane displays calculated measurements
involving the distortion and damping of the input signal. Overshoot and
undershoot refer to the amount that a signal respectively exceeds and
falls below its final steady-state value. Preshoot refers to the amount
prior to a transition that a signal varies from its initial steady-state
value. This figure shows preshoot, overshoot, and undershoot for a
rising-edge transition.
3-1560
dsp.TimeScope
3-1561
dsp.TimeScope
3-1562
dsp.TimeScope
You can modify the settle seek duration parameter in the Settings
pane. For more information on the algorithm this measurement uses,
see the Signal Processing Toolbox settlingtime function reference.
Preshoot Average highest aberration in the region immediately
preceding each falling transition.
Overshoot Average highest aberration in the region
immediately following each falling transition. For more information
on the algorithm this measurement uses, see the Signal Processing
Toolbox overshoot function reference.
3-1563
dsp.TimeScope
3-1564
dsp.TimeScope
3-1565
dsp.TimeScope
3-1566
button.
dsp.TimeScope
The Peak finder panel is separated into two panes, labeled Settings
and Peaks. You can expand each pane to see the available options.
Settings Pane
The Settings pane enables you to modify the parameters used to
calculate the peak values within the displayed portion of the input
signal. For more information on the algorithms this pane uses, see the
Signal Processing Toolbox findpeaks function reference.
Peak Threshold The level above which peaks are detected. This
setting is equivalent to the MINPEAKHEIGHT parameter, which you can
set when you run the findpeaks function.
Max Num of Peaks The maximum number of peaks to show. The
value you enter must be a scalar integer between 1 and 99. This
setting is equivalent to the NPEAKS parameter, which you can set
when you run the findpeaks function.
Min Peaks Distance The minimum number of samples between
adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE
parameter, which you can set when you run the findpeaks function.
Peak Excursion The minimum height difference between a peak
and its neighboring samples. Peak excursion is illustrated alongside
peak threshold in the following figure.
3-1567
dsp.TimeScope
3-1568
dsp.TimeScope
Peaks Pane
The Peaks pane displays all of the largest calculated peak values.
It also shows the coordinates at which the peaks occur, using the
parameters you define in the Settings pane. You set the Max Num of
Peaks parameter to specify the number of peaks shown in the list.
3-1569
dsp.TimeScope
Use the check boxes to control which peak values are shown on the
display. By default, all check boxes are cleared and the Peak Finder
panel hides all the peak values. To show all the peak values on the
display, select the check box in the top-left corner of the Peaks pane.
To hide all the peak values on the display, clear this check box. To
show an individual peak, select the check box directly to the left of its
Value listing. To hide an individual peak, clear the check box directly
to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the
value associated with each measurement indicates the abbreviation for
the appropriate International System of Units (SI) prefix, such as m for
milli-. For example, if the input signal is measured in volts, an m next
to a measurement value indicates that this value is in units of millivolts.
Abbreviation
Name
Multiplier
atto
10^18
femto
10^15
pico
10^12
nano
10^9
micro
10^6
milli
10^3
10^0
3-1570
kilo
10^3
mega
10^6
giga
10^9
tera
10^12
peta
10^15
exa
10^18
dsp.TimeScope
Style
Dialog
Box
In the Style dialog box, you can customize the style of displays. You can
change the color of the figure containing the displays, the background
and foreground colors of display axes, and properties of lines in a
display. From the scope menu, select View > Style or select the Style
button ( ) in the dropdown below the Configuration Properties button
to open this dialog box.
Properties
The Style dialog box allows you to modify the following properties of
the scope figure:
Figure color
Specify the color that you want to apply to the background of the scope
figure. By default, the figure color is gray.
3-1571
dsp.TimeScope
Plot type
Specify the type of plot to use. The default setting is Line. Valid values
for Plot type are:
Line Displays input signal as lines connecting each of the sampled
values. This approach is similar to the functionality of the MATLAB
line or plot function.
Stairs Displays input signal as a stairstep graph. A stairstep
graph is made up of only horizontal lines and vertical lines. Each
horizontal line represents the signal value for a discrete sample
period and is connected to two vertical lines. Each vertical line
represents a change in values occurring at a sample. This approach
is equivalent to the MATLAB stairs function. Stairstep graphs are
useful for drawing time history graphs of digitally sampled data.
Auto Displays input signal as a line graph if it is a continuous
signal and displays input signal as a stairstep graph if it is a discrete
signal.
This property is Tunable.
Active display
Specify the color that you want to apply to the background of the axes
for the active display.
Properties for line
Specify the signal for which you want to modify the visibility, line
properties, and marker properties.
3-1572
dsp.TimeScope
Visible
Specify the line style, line width, and line color for the selected signal
on the active display.
Marker
Specify marks for the selected signal on the active display to show at
data points. This property is similar to the Marker property for the
MATLAB Handle Graphics plot objects. You can choose any of the
marker symbols from the following table.
Specifier
Marker Type
none
No marker (default)
Circle
Square
Cross
Point
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
3-1573
dsp.TimeScope
Specifier
Marker Type
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)
Visuals
Time
Domain
Properties
The Visuals Time Domain Properties dialog box controls the visual
configuration settings of the Time Scope displays. From the Time Scope
menu, select View > Configuration Properties to open this dialog
box.
Main Pane
The Main pane of the Time Scope VisualsTime Domain Properties
dialog box appears as follows.
3-1574
dsp.TimeScope
Input processing
Specify whether the Time Scope should treat the input signal as
Columns as channels (frame based) or Elements as channels
(sample based).
Frame-based processing is only available for discrete input signals. For
more information about frame-based input channels, see the What
Is Frame-Based Processing? section in the DSP System Toolbox
documentation. For an example that uses the Time Scope block and
frame-based input signals, see the Display Time-Domain Data section
in the DSP System Toolbox documentation.
Time span
3-1575
dsp.TimeScope
Specify how the scope displays new data beyond the visible time span.
You can select one of the following options:
3-1576
dsp.TimeScope
Wrap In this mode, the scope displays new data until the data
reaches the maximum time-axis limit. When the data reaches the
maximum time-axis limit of the scope window, the scope clears the
display. The scope then updates the time offset value and begins
displaying subsequent data points starting from the minimum
time-axis limit.
Scroll In this mode, the scope scrolls old data to the left to make
room for new data on the right side of the scope display. This mode is
graphically intensive and can affect run-time performance. However,
it is beneficial for debugging and monitoring time-varying signals.
This property is Tunable.
The default setting is Wrap.
Time units
Specify the units used to describe the time-axis. The default setting is
Metric. You can select one of the following options:
Metric In this mode, Time Scope converts the times on the
time-axis to some metric units such as milliseconds, microseconds,
days, etc. Time Scope chooses the appropriate metric units, based on
the minimum time-axis limit and the maximum time-axis limit of
the scope window.
Seconds In this mode, Time Scope always displays the units on
the time-axis as seconds.
None In this mode, Time Scope displays no units on the time-axis.
Time Scope shows only the word Time on the time-axis.
This property is Tunable.
Time display offset
This property allows you to offset the values displayed on the time-axis
by a specified number of seconds. When you specify a scalar value, the
scope offsets all channels equally. When you specify a vector of offset
values, the scope offsets each channel independently. Tunable.
3-1577
dsp.TimeScope
When you specify a Time display offset vector of length N, the scope
offsets the input channels as follows:
When N is equal to the number of input channels, the scope offsets
each channel according to its corresponding value in the offset vector.
When N is less than the number of input channels, the scope applies
the values you specify in the offset vector to the first N input
channels. The scope does not offset the remaining channels.
When N is greater than the number of input channels, the scope
offsets each input channel according to the corresponding value in
the offset vector. The scope ignores all values in the offset vector that
do not correspond to a channel of the input.
The scope computes the time-axis range using the values of the Time
display offset and Time span properties. For example, if you set the
Time display offset to 5e-6 and the Time span to 25e-6, the scope
sets the time-axis limits as shown in the following figure.
Similarly, when you specify a vector of values, the scope sets the
minimum time-axis limit using the smallest value in the vector. To set
the maximum time-axis limit, the scope sums the largest value in the
vector with the value of the Time span property. For more information,
see Signal Display on page 3-1517.
3-1578
dsp.TimeScope
Time-axis labels
Specify how to display the time units used to describe the time-axis.
The default setting is All. You can select one of the following options:
All In this mode, the time-axis labels appear in all displays.
None In this mode, the time-axis labels do not appear in the
displays.
Bottom Displays Only In this mode, the time-axis labels appear
in only the bottom row of the displays.
Tunable.
Show time-axis label
3-1579
dsp.TimeScope
Display Pane
The Display pane of the VisualsTime Domain Properties dialog box
appears as follows.
Active display
3-1580
dsp.TimeScope
Title
Specify the active display title as a string. By default, the active display
has no title. Tunable.
Show legend
Select this check box to show the legend in the display. The channel
legend displays a name for each channel of each input signal. When
the legend appears, you can place it anywhere inside of the scope
window. To turn the legend off, clear the Show legend check box.
This parameter applies only when the Spectrum Type is Power or
Power density. Tunable
You can edit the name of any channel in the legend. To do so,
double-click the current name, and enter a new channel name. By
default, if the signal has multiple channels, the scope uses an index
number to identify each channel of that signal. To change the
appearance of any channel of any input signal in the scope window,
from the scope menu, select View > Style.
Show grid
When you select this check box, a grid appears in the display of the
scope figure. To hide the grid, clear this check box. Tunable
Plot signals as magnitude and phase
When you select this check box, the scope splits the display into a
magnitude plot and a phase plot. By default, this check box is cleared.
If the input signal is complex valued, the scope plots the real and
imaginary portions on the same axes. These real and imaginary
portions appear as different-colored lines on the same axes, as shown in
the following figure.
3-1581
dsp.TimeScope
Selecting this check box and clicking the Apply or OK button changes
the display. The magnitude of the input signal appears on the top
axes and its phase, in degrees, appears on the bottom axes. See the
following figure.
3-1582
dsp.TimeScope
absolute value of the signal for the magnitude. The phase is 0 degrees
for nonnegative input and 180 degrees for negative input. Tunable
Y-limits (Minimum)
Specify as a string the text for the scope to display to the left of the
y-axis. Tunable
This property becomes invisible when you select the Plot signal(s) as
magnitude and phase check box. When you enable that property, the
y-axis label always appears as Magnitude on the top axes and Phase
on the bottom axes.
Tools
Axes
Scaling
Properties
The Axes Scaling Properties: Time Scope dialog box provides you with
the ability to automatically zoom in on and zoom out of your data, and
to scale the axes of the Time Scope. In the Time Scope menu, select
Tools > Axes Scaling Options to open this dialog box.
Properties
The ToolsAxes Scaling Properties dialog box appears as follows.
3-1583
dsp.TimeScope
Axes scaling
Specify when the scope should automatically scale the axes. You can
select one of the following options:
Manual When you select this option, the scope does not
automatically scale the axes. You can manually scale the axes in
any of the following ways:
Auto When you select this option, the scope scales the axes as
needed, both during and after simulation. Selecting this option shows
the Do not allow Y-axis limits to shrink check box.
After N Updates Selecting this option causes the scope to scale
the axes after a specified number of updates. Selecting this option
shows the Number of updates edit box.
3-1584
dsp.TimeScope
When you select this property, the y-axis is allowed only to grow during
axes scaling operations. If you clear this check box, the y-axis or color
limits may shrink during axes scaling operations.
This property appears only when you select Auto for the Axis scaling
property. When you set the Axes scaling property to Manual or After
N Updates, the y-axis or color limits are allowed to shrink. Tunable.
Number of updates
Select this check box to scale the axes when the simulation stops. The
y-axis is always scaled. The x-axis limits are only scaled if you also
select the Scale X-axis limits check box.
Y-axis Data range (%)
Set the percentage of the y-axis that the scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the y-axis
limits such that your data uses the entire y-axis range. If you then set
this property to 30, the scope increases the y-axis range such that your
data uses only 30% of the y-axis range. Tunable.
Y-axis Align
Specify where the scope should align your data with respect to the y-axis
when it scales the axes. You can select Top, Center, or Bottom. Tunable.
Autoscale X-axis limits
Check this box to allow the scope to scale the x-axis limits when it scales
the axes. If Axes scaling is set to Auto, checking Scale X-axis limits
only scales the data currently within the axes, not the entire signal in
the data buffer. Tunable.
3-1585
dsp.TimeScope
Set the percentage of the x-axis that the Scope should use to display the
data when scaling the axes. Valid values are between 1 and 100. For
example, if you set this property to 100, the Scope scales the x-axis
limits such that your data uses the entirex-axis range. If you then set
this property to 30, the Scope increases the x-axis range such that your
data uses only 30% of the x-axis range. Use the x-axis Align property to
specify data placement with respect to the x-axis.
This property appears only when you select the Scale X-axis limits
check box. Tunable.
X-axis Align
Specify how the Scope should align your data with respect to the x-axis:
Left, Center, or Right. This property appears only when you select the
Scale X-axis limits check box. Tunable.
Sources
Streaming
Properties
The Sources Streaming Properties dialog box lets you control the
number of input signal samples that Time Scope holds in memory. In
the Time Scope menu, select View > Data History Properties to
open this dialog box.
Buffer length
Specify the size of the buffer that the scope holds in its memory cache.
If your signal has M rows of data and N data points in each row, M x
N is the number of data points per time step. Multiply this result by
the number of time steps for your model to obtain the required buffer
length. For example, if you have 10 rows of data with each row having
3-1586
dsp.TimeScope
100 data points and your run will be 10 time steps, you should enter
10,000 (which is 10 x 100 x 10) as the buffer length.
The default setting is 50000.
Examples
The first few examples illustrate how to use the Time Scope object to
view a variety of input signals in the time domain.
Example: Display Simple Sine Wave Input Signal on page 3-1587
Example: View Sine Wave Input Signals at Different Sample Rates
and Offsets on page 3-1588
Example: Display Complex-valued Input Signal on page 3-1589
Example: Display Input Signal of Changing Size on page 3-1591
The remaining examples demonstrate how to use the Measurements
Panels in the Time Scope GUI to glean information about the input
signals.
Example: Use Bilevel Measurements Panel with Clock Input Signal
on page 3-1592
Example: Find Heart Rate Using Peak Finder Panel with ECG
Input Signal on page 3-1596
3-1587
dsp.TimeScope
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(hts1)
Run the MATLAB clear function to close the Time Scope window.
clear hts1 hsin x;
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(hts2)
3-1588
dsp.TimeScope
Run the MATLAB clear function to close the Time Scope window.
clear hts2 Fs hsin1 hfilt ii xsine xdec;
% Plot magnitu
% Plot phase i
3-1589
dsp.TimeScope
Time Scope now plots the magnitude and phase of the input signal on
two separate axes within the same active display. The active display
changes to show the magnitude of the input signal on the top axes and
its phase, in degrees, on the bottom axes, as shown in the following
figure.
3-1590
dsp.TimeScope
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(h1);
Run the MATLAB clear function to close the Time Scope window, and
remove the variables you created from the workspace.
close(101);
clear h1 fs t CxSine CxSineSum
3-1591
dsp.TimeScope
fs = 10;
sigdim2 = [ones(5*fs,1), 1+ones(5*fs,1)];
% 2-dim 0-5s
sigdim3 = [2+ones(5*fs,1), 3+ones(5*fs,1), 4+ones(5*fs,1)]; % 3-dim 5-10s
h2 = dsp.TimeScope(2, fs, 'TimeSpanSource', 'Property');
set(h2,'PlotType','Stairs');
set(h2,'TimeSpanOverrunAction','Scroll');
set(h2,'TimeDisplayOffset',[0,0,5]);
step(h2,[sigdim2; sigdim3(:,1:2)], sigdim3(:,3));
In this example, the size of the input signal to the Time Scope block
changes as the simulation progresses. When the simulation time is less
than 5 seconds, Time Scope plots only the signal sigdim2, which has
two channels. After 5 seconds, Time Scope also plots the signal sigdim3,
which has three channels.
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(h2);
Run the MATLAB clear function to close the Time Scope window, and
remove the variables you created from the workspace.
clear h2 fs sigdim2 sigdim3
3-1592
dsp.TimeScope
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(h4);
3-1593
dsp.TimeScope
As you can see in the figure, the value for the rising edge Settling
Time parameter is initially not displayed. The reason for this is that
the default value for the Settle Seek parameter is too large for this
example. In this case, the settle seek time is longer than the entire
simulation duration. Enter a value for settle seek of 2e-6, and press
the Enter key. Time Scope now displays a rising edge settling time
value of 118.392 ns.
This settling time value displayed is actually the statistical average of
the settling times for all five rising edges. To show the settling time for
only one rising edge, you can zoom in on that transition. In the Time
3-1594
dsp.TimeScope
Run the MATLAB clear function to close the Time Scope window, and
remove the variables you created from the workspace.
clear h4 x t ts
3-1595
dsp.TimeScope
Example: Find Heart Rate Using Peak Finder Panel with ECG
Input Signal
First, create the electrocardiogram (ECG) signal.
x1 = 3.5*ecg(2700).';
y1 = sgolayfilt(kron(ones(1,13),x1),0,21);
n = (1:30000)';
del = round(2700*rand(1));
mhb = y1(n + del);
ts = 0.00025;
Run the release method to let property values and input characteristics
change. The scope automatically scales the axes.
release(h5);
To show the Peak Finder panel, in the Time Scope menu, select
Tools > Measurements > Peak Finder. To expand the Settings
pane, click the pane expand button ( ) next to that label. Enter a value
for Max Num of Peaks of 10, and press the Enter key. Time Scope
now displays in the Peaks pane a list of 10 peak amplitude values, and
the times at which they occur, as shown in the following figure.
3-1596
dsp.TimeScope
As you can see from the list of peak values, there is a constant time
difference of 0.675 seconds between each heartbeat. Therefore, the
heart rate of the ECG signal is given by the following equation.
sec
min 88.89 beats (bpm)
sec
min
0.675
beat
60
Run the MATLAB clear function to close the Time Scope window, and
remove the variables you created from the workspace.
3-1597
dsp.TimeScope
See Also
3-1598
dsp.TimeScope.clone
Purpose
Syntax
C = clone(H)
Description
uninitialized states.
3-1599
dsp.TimeScope.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1600
dsp.TimeScope.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
3-1601
dsp.TimeScope.hide
Purpose
Syntax
hide(H)
Description
hide(H) hides the time scope window, associated with System object, H.
See Also
dsp.TimeScope.show
3-1602
dsp.TimeScope.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1603
dsp.TimeScope.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
You should call the release method after calling the step method when
there is no new data for the simulation. When you call the release
method, the axes will automatically scale in the Time Scope figure
window. After calling the release method, any non-tunable properties
can be set once again.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
Examples
View a sine wave on the time scope. When you finish the simulation,
release system resources. Note that when you run the release method,
the axes automatically scale.
hsin = dsp.SineWave('Frequency',100, 'SampleRate', 1000);
hsin.SamplesPerFrame = 10;
hts1 = dsp.TimeScope('SampleRate', hsin.SampleRate,'TimeSpan', 0.1);
for ii = 1:10
x = step(hsin);
step(hts1, x);
end
release(hts1);
3-1604
dsp.TimeScope.release
View two sine waves with different sample rates and time offsets. When
you finish the simulation, release system resources. Note that when you
run the release method, the axes automatically scale.
Fs = 1000;
% Sampling frequency
hsin1 = dsp.SineWave('Frequency',50,...
'SampleRate',Fs, ...
'SamplesPerFrame', 100);
% Create FIRDecimator System object to decimate by 2
hfilt = dsp.FIRDecimator;
% Create TimeScope System object with 2 input
% ports (channels)
hts2 = dsp.TimeScope(2, [Fs Fs/2], ...
'TimeDisplayOffset', [0 38/Fs], ...
'TimeSpan', 0.25, ...
'YLimits',[-1 1], ...
'LegendSource', 'Auto');
for ii = 1:2
xsine = step(hsin1);
xdec = step(hfilt,xsine);
step(hts2, xsine, xdec);
end
release(hts2);
Algorithms
See Also
dsp.TimeScope.reset
3-1605
dsp.TimeScope.reset
Purpose
Syntax
reset(H)
Description
You should call the reset method after calling the step method when
you want to clear the Time Scope figure displays, prior to releasing
system resources. This action enables you to start a simulation from the
beginning. When you call the reset method, the displays will become
blank again. In this sense, its functionality is similar to that of the
MATLAB clf function. Do not call the reset method after calling the
release method.
Examples
View a sine wave on the time scope. When you finish the simulation,
pause for 5 seconds and then reset the screen. Then, view a different
sine wave on the same time scope.
3-1606
dsp.TimeScope.reset
release(hts1);
Algorithms
See Also
dsp.TimeScope | dsp.TimeScope.release
3-1607
dsp.TimeScope.show
Purpose
Syntax
show(H)
Description
show(H) makes the time scope window, associated with System object,
H, visible.
See Also
dsp.TimeScope.hide
3-1608
dsp.TimeScope.step
Purpose
Syntax
step(H,X)
step(H,X1,X2,...,XN)
Description
3-1609
dsp.TransferFunctionEstimator
Purpose
Description
Construction
System object, H, with each specified property set to the specified value.
You can specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN).
Properties
SpectralAverages
3-1610
dsp.TransferFunctionEstimator
FFT Length
Specify the length of the FFT that the Transfer Function
Estimator uses to compute spectral estimates as a positive, integer
scalar. This property applies when you set the FFTLengthSource
property to 'Property'. The default value is 128.
Window
Window function
Specify a window function for the Transfer Function estimator as
one of 'Rectangular' | 'Chebyshev' | 'Flat Top' | 'Hamming'
| 'Hann' | 'Kaiser'. The default value is 'Hann'.
SidelobeAttenuation
3-1611
dsp.TransferFunctionEstimator
Methods
3-1612
clone
getFrequencyVector
getRBW
isLocked
release
reset
step
dsp.TransferFunctionEstimator
Examples
Algorithms
Given two signals x and y as inputs. We first window the two inputs,
and scale them by the window power. We then take FFT of the signals,
calling them X and Y. This is followed by calculating Pxx which is the
square magnitude of the FFT, X, and Pyx which is X multiplied by the
conjugate of Y. The transfer function estimate is calculated by dividing
Pyx by Pxx.
For further information refer to the Algorithms on page 3-1416 section
in Spectrum Analyzer, which uses the same algorithm.
3-1613
dsp.TransferFunctionEstimator
References
[1] Hayes, Monson H. Statistical Digital Signal Processing and
Modeling. Hoboken, NJ: John Wiley & Sons, 1996
[2] Kay, Steven M. Modern Spectral Estimation: Theory and
Application. Englewood Cliffs, NJ: Prentice Hall, 1999
[3] Stoica, Petre and Randolph L. Moses. Spectral Analysis of Signals.
Englewood Cliffs, NJ: Prentice Hall, 2005
[4] Welch, P. D. The use of fast Fourier transforms for the estimation
of power spectra: A method based on time averaging over short modified
periodograms, IEEE Transactions on Audio and Electroacoustics, Vol.
15, pp. 7073, 1967.
See Also
3-1614
dsp.SpectrumAnalyzer | dsp.SpectrumEstimator |
dsp.CrossSpectrumEstimator
dsp.TransferFunctionEstimator.clone
Purpose
Syntax
C = clone(H)
Description
the same property values. The clone method creates a new unlocked
object with uninitialized states.
3-1615
dsp.TransferFunctionEstimator.getFrequencyVector
Purpose
Syntax
getFrequencyVector(H)
Description
3-1616
dsp.TransferFunctionEstimator.getRBW
Purpose
Syntax
getRBW(H)
Description
3-1617
dsp.TransferFunctionEstimator.isLocked
Purpose
Syntax
isLocked(H)
Description
estimator.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1618
dsp.TransferFunctionEstimator.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1619
dsp.TransferFunctionEstimator.reset
Purpose
Syntax
reset(H)
Description
3-1620
dsp.TransferFunctionEstimator.step
Purpose
Syntax
Txy = step(H,x,y)
Y = step(H,x)
[Y1,...,YN] = step(H,x)
Description
with input x and output y. This computation uses the Welchs averaged
periodogram method. Txy is the ratio of the Cross Power Spectral
Density of x and y, and the Power Spectral Density of x. The columns of
x and y are treated as independent channels.
Y = step(H,x) processes the input data, x, to produce the output, Y,
from the System object, H. [Y1,...,YN] = step(H,x) produces N
outputs.
Every System object has a step method. The step method processes the
input data according to the object algorithm. The number of input and
output arguments depends on the algorithm, and may depend also on
one or more property settings. The step method for some objects accepts
fixed-point (fi) inputs.
Calling step on an object puts that object into a locked state. When
locked, you cannot change nontunable properties or any input
characteristics (size, data type and complexity) without reinitializing
(unlocking and relocking) the object.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1621
dsp.TransitionMetrics
Purpose
Description
page 3-1622.
2 Call step to calculate the transition metrics according to the
Construction
Properties
MaximumRecordLength
3-1622
dsp.TransitionMetrics
3-1623
dsp.TransitionMetrics
3-1624
dsp.TransitionMetrics
3-1625
dsp.TransitionMetrics
3-1626
dsp.TransitionMetrics
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
plot
reset
step
3-1627
dsp.TransitionMetrics
References
See Also
dsp.StateLevels | dsp.PulseMetrics
3-1628
dsp.TransitionMetrics.clone
Purpose
Syntax
clone(H)
Description
3-1629
dsp.TransitionMetrics.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1630
dsp.TransitionMetrics.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1631
dsp.TransitionMetrics.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1632
dsp.TransitionMetrics.plot
Purpose
Syntax
plot(H)
Description
plot(H) plots the signal and metrics resulting from the last call of the
step method.
3-1633
dsp.TransitionMetrics.reset
Purpose
Syntax
reset(H)
Description
reset(H) clears information from previous calls to step.
3-1634
dsp.TransitionMetrics.step
Purpose
Syntax
PULSE = step(H,X)
[PULSE,CYCLE] = step(H,X)
[PULSE,TRANSITION] = step(H,X)
[PULSE,PRESHOOT] = step(H,X)
[PULSE,POSTSHOOT] = step(H,X)
[PULSE,SETTLING] = step(H,X)
[...] = step(H,X,T)
Description
whose fields contain real-valued column vectors when you set the
CycleOutputPort property to true. The number of rows of each field
3-1635
dsp.TransitionMetrics.step
two columns which correspond to the metrics of the first and second
transitions. The number of rows corresponds to the number of pulses
found in the input waveform.
TRANSITION fields:
3-1636
dsp.TransitionMetrics.step
3-1637
dsp.TransitionMetrics.step
output ports. However, the output arguments are defined in the order
shown here.
= step(H,X,T) performs the above metrics with respect to a
sampled signal, whose sample values, X, and sample instants, T, are
real-valued column vectors of the same length. The additional input T
applies only when you set the TimeInputPort property to true.
[...]
3-1638
dsp.UDPReceiver
Purpose
Description
3-1639.
2 Call step to receive the UDP packets according to the properties of
in the toolbox.
Construction
Properties
LocalIPPort
3-1639
dsp.UDPReceiver
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1640
dsp.UDPReceiver
for k = 1:20
dataSent = uint8(255*rand(1,dataLength));
bytesSent = bytesSent + dataLength;
step(hudps, dataSent);
dataReceived = step(hudpr);
bytesReceived = bytesReceived + length(dataReceived);
end
release(hudps);
release(hudpr);
fprintf('Bytes sent:
%d\n', bytesSent);
fprintf('Bytes received: %d\n', bytesReceived);
Algorithms
See Also
dsp.UDPSender
3-1641
dsp.UDPReceiver.clone
Purpose
Syntax
C = clone(H)
Description
3-1642
dsp.UDPReceiver.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1643
dsp.UDPReceiver.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1644
dsp.UDPReceiver.isLocked
Purpose
Syntax
Y = isLocked(H)
Description
3-1645
dsp.UDPReceiver.release
Purpose
Syntax
release(H)
Description
and hardware connections. This method lets you change any properties
or input characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1646
dsp.UDPReceiver.step
Purpose
Syntax
P = step (H)
Description
P = step (H) receives one UDP packet, P, from the network.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
The first time you call the step method on a UDPReceiver object, the
object also allocates resources and begins listening for data. As a result,
the first step call may not receive data.
3-1647
dsp.UDPSender
Purpose
Description
3-1648.
2 Call step to send the packets according to the properties of
the toolbox.
Construction
Properties
RemoteIPAddress
3-1648
dsp.UDPSender
LocalIPPort
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1649
dsp.UDPSender
Algorithms
See Also
dsp.UDPReceiver
3-1650
dsp.UDPSender.clone
Purpose
Syntax
C = clone(H)
Description
3-1651
dsp.UDPSender.getNumInputs
Purpose
Syntax
getNumInputs(H)
Description
method.
The getNumInputs method returns a positive integer that is the number
of expected inputs (not counting the object itself) to the step method.
This value will change if you alter any properties that turn inputs on or
off. You must call the step method with the number of input arguments
equal to the result of getNumInputs(H).
3-1652
dsp.UDPSender.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1653
dsp.UDPSender.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1654
dsp.UDPSender.release
Purpose
Syntax
Y = release(H)
Description
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1655
dsp.UDPSender.step
Purpose
Syntax
Y = step(H,PACKET)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1656
dsp.UniformDecoder
Purpose
Description
3-1657.
2 Call step to decode the input according to the properties of
in the toolbox.
Construction
specified value.
H = dsp.UniformDecoder(peakvalue,numbits,
'PropertyName',PropertyValue,...) returns a uniform decoder, H,
with the PeakValue property set to peakvalue, the NumBits property
set to numbits, and other specified properties set to the specified values.
Properties
PeakValue
3-1657
dsp.UniformDecoder
NumBits
Methods
3-1658
clone
getNumInputs
getNumOutputs
isLocked
dsp.UniformDecoder
Examples
release
step
Algorithms
See Also
dsp.UniformEncoder
3-1659
dsp.UniformDecoder.clone
Purpose
Syntax
C = clone(H)
Description
3-1660
dsp.UniformDecoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1661
dsp.UniformDecoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1662
dsp.UniformDecoder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1663
dsp.UniformDecoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1664
dsp.UniformDecoder.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1665
dsp.UniformEncoder
Purpose
Description
3-1666.
2 Call step to encode the input according to the properties of
in the toolbox.
Construction
specified value.
H = dsp.UniformEncoder(peakvalue,numbits,
'PropertyName',PropertyValue,...) returns a uniform encoder, H,
with the PeakValue property set to peakvalue, the NumBits property
set to numbits, and other specified properties set to the specified values.
Properties
PeakValue
3-1666
dsp.UniformEncoder
Methods
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1667
dsp.UniformEncoder
Examples
Encode a sequence:
hue = dsp.UniformEncoder;
hue.PeakValue = 2;
hue.NumBits = 4;
hue.OutputDataType = 'Signed integer';
x = [-1:0.01:1]'; % Create an input sequence
x_encoded = step(hue, x);
plot(x, x_encoded,'.');
xlabel('Input'); ylabel('Encoded Output'); grid
Algorithms
See Also
dsp.UniformDecoder
3-1668
dsp.UniformEncoder.clone
Purpose
Syntax
C = clone(H)
Description
3-1669
dsp.UniformEncoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1670
dsp.UniformEncoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1671
dsp.UniformEncoder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1672
dsp.UniformEncoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1673
dsp.UniformEncoder.step
Purpose
Syntax
Y = step(H,X)
Description
Unsigned Integer
Signed Integer
2 to 8
uint8
int8
9 to 16
uint16
int16
17 to 32
uint32
int32
The row corresponds to the value of the NumBits property, and the
column corresponds to the value of the OutputDataType property.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1674
dsp.UpperTriangularSolver
Purpose
Description
page 3-1675.
2 Call step to solve the equation according to the properties of
Construction
Properties
OverwriteDiagonal
3-1675
dsp.UpperTriangularSolver
Fixed-Point Properties
RoundingMethod
3-1676
dsp.UpperTriangularSolver
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
3-1677
dsp.UpperTriangularSolver
u = triu(rand(4, 4));
b = rand(4, 1);
% Check that result is the solution to the linear
% equations.
x1 = inv(u)*b
x = step(huptriang, u, b)
Algorithms
See Also
dsp.LowerTriangularSolver
3-1678
dsp.UpperTriangularSolver.clone
Purpose
Syntax
C = clone(H)
Description
3-1679
dsp.UpperTriangularSolver.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1680
dsp.UpperTriangularSolver.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1681
dsp.UpperTriangularSolver.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1682
dsp.UpperTriangularSolver.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1683
dsp.UpperTriangularSolver.step
Purpose
Syntax
X = step(H,U,B)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1684
dsp.VariableBandwidthFIRFilter
Purpose
Description
Construction
Properties
SampleRate
Filter type
3-1685
dsp.VariableBandwidthFIRFilter
Window function
Specify the window function used to design the FIR filter as one of
'Hann' | 'Hamming' | 'Chebyshev' | 'Kaiser'. The default is
'Hann'. This property is nontunable.
KaiserWindowParameter
3-1686
dsp.VariableBandwidthFIRFilter
Bandwidth
Filter bandwidth
Specify the filter bandwidth in Hertz as a real, positive scalar,
smaller than SampleRate/2. This property applies if you set the
FilterType property to 'Bandpass' or 'Bandstop'. The default
is 7680 Hz. This property is tunable.
SidelobeAttenuation
Methods
clone
isLocked
release
reset
step
Examples
3-1687
dsp.VariableBandwidthFIRFilter
3-1688
dsp.VariableBandwidthFIRFilter
Algorithms
FIR Transformations
All transformations assume a lowpass filter of length 2N+1.
3-1689
dsp.VariableBandwidthFIRFilter
Lowpass to Lowpass
hLP (n)
c
.w(0)
for 1 |n| N
sin(c n)
.w(n)
n
where w(n) is the window vector. The lowpass filter coefficients are
tuned to a new cutoff frequency c2 as follows:
hLP (n)
for n 0
hLP (n)
c2
. (0)
for 1 | n | N
hLP (n)
sin(c2 n)
. (n)
There is no need to recompute the window every time you tune the
cutoff frequency.
Lowpass to Highpass
3-1690
dsp.VariableBandwidthFIRFilter
for n 0
hhp (n) 1 hLP (n)
for 1 | n| N
hhp (n) hLP (n)
Lowpass to Bandpass
for n 0
hBS (n) 1 2 cos(0 n)hLP (n)
for 1 | n| N
hBS (n) 2 cos(0 n)hLP (n)
3-1691
dsp.VariableBandwidthFIRFilter
Generalized Transformation
References
[1] P.Jarske, Y. Neuvo, and S. K. Mitra, "A simple approach to the
design of linear phase FIR digital filters with variable characteristics",
Signal Process. (Elsevier), vol. 14, pp. 313
See Also
3-1692
dsp.VariableBandwidthFIRFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-1693
dsp.VariableBandwidthFIRFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
filter.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1694
dsp.VariableBandwidthFIRFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1695
dsp.VariableBandwidthFIRFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the variable bandwidth FIR filter
object, H, to their initial values of 0. The initial filter state values
correspond to the initial conditions for the difference equation defining
the filter. After the step method applies the variable bandwidth FIR
filter object to nonzero input data, the states may be nonzero. Invoking
the step method again without first invoking the reset method may
produce different outputs for an identical input.
3-1696
dsp.VariableBandwidthFIRFilter.step
Purpose
Syntax
Y = step(H,x)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1697
dsp.VariableBandwidthIIRFilter
Purpose
Description
Construction
Properties
SampleRate
3-1698
dsp.VariableBandwidthIIRFilter
Filter type
Specify the type of the filter as one of 'Lowpass' | 'Highpass'
| 'Bandpass' | 'Bandstop'. The default is 'Lowpass'. This
property is nontunable.
FilterOrder
Filter bandwidth
Specify the filter bandwidth in Hertz as a real, positive scalar,
smaller than SampleRate/2. This property applies when you set
the FilterType property to 'Bandpass' or 'Bandstop'. The
default is 7680 Hz. This property is tunable.
PassbandRipple
3-1699
dsp.VariableBandwidthIIRFilter
Methods
clone
isLocked
release
reset
step
Examples
3-1700
dsp.VariableBandwidthIIRFilter
hplot = dsp.ArrayPlot('PlotType','Line',...
'XOffset',0,...
'YLimits',[-120 5], ...
'SampleIncrement', 44100/1024,...
'YLabel','Frequency Response (dB)',...
'XLabel','Frequency (Hz)',...
'Title','System Transfer Function');
FrameLength = 1024;
hsin = dsp.SineWave('SamplesPerFrame',FrameLength);
for i=1:500
% Generate input
x = step(hsin) + randn(FrameLength,1);
% Pass input through the filter
y = step(hiir,x);
% Transfer function estimation
h = step(htfe,x,y);
% plot transfer function
step(hplot,20*log10(abs(h)))
% Tune bandwidth and center frequency of the IIR filter
if (i==250)
hiir.CenterFrequency = 5000;
hiir.Bandwidth = 2000;
end
end
3-1701
dsp.VariableBandwidthIIRFilter
Algorithms
3-1702
dsp.VariableBandwidthIIRFilter
References
[1] A. G. Constantinides, Spectral transformations for digital filters,
Proc. Inst. Elect. Eng., vol. 117, no. 8, pp.1585 1590, 1970.
See Also
3-1703
dsp.VariableBandwidthIIRFilter.clone
Purpose
Syntax
C = clone(H)
Description
3-1704
dsp.VariableBandwidthIIRFilter.isLocked
Purpose
Syntax
isLocked(H)
Description
filter.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1705
dsp.VariableBandwidthIIRFilter.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1706
dsp.VariableBandwidthIIRFilter.reset
Purpose
Syntax
reset(H)
Description
reset(H) resets the filter states of the variable bandwidth IIR filter
object, H, to their initial values of 0. The initial filter state values
3-1707
dsp.VariableBandwidthIIRFilter.step
Purpose
Syntax
Y = step(H,x)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1708
dsp.VariableFractionalDelay
Purpose
Description
Construction
Properties
InterpolationMethod
Interpolation method
Specify the method by which the block interpolates between
adjacent stored samples to obtain a value for the sample indexed
by the input. You can set this property to one of | Linear | FIR |
Farrow |. When you set this property to FIR, the object uses the
Signal Processing Toolbox intfilt function to compute an FIR
filter for interpolation. The default is Linear.
FilterHalfLength
3-1709
dsp.VariableFractionalDelay
3-1710
dsp.VariableFractionalDelay
InitialConditions
3-1711
dsp.VariableFractionalDelay
MaximumDelay
Maximum delay
Specify the maximum delay the object can produce for any sample.
The maximum delay must be a positive scalar integer value. The
object clips input delay values greater than the MaximumDelay to
the MaximumDelay. The default is 100.
DirectFeedthrough
3-1712
dsp.VariableFractionalDelay
FIRSmallDelayAction
3-1713
dsp.VariableFractionalDelay
3-1714
dsp.VariableFractionalDelay
3-1715
dsp.VariableFractionalDelay
3-1716
dsp.VariableFractionalDelay
Methods
Examples
clone
getNumInputs
getNumOutputs
info
isLocked
release
reset
step
3-1717
dsp.VariableFractionalDelay
end
sigd = hLog.Buffer;
%
%
%
%
%
Algorithms
See Also
3-1718
dsp.VariableFractionalDelay.clone
Purpose
Syntax
C = clone(H)
Description
3-1719
dsp.VariableFractionalDelay.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1720
dsp.VariableFractionalDelay.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1721
dsp.VariableFractionalDelay.info
Purpose
Syntax
S = info(H)
Description
3-1722
dsp.VariableFractionalDelay.isLocked
Purpose
Syntax
isLocked(H)
Description
System object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1723
dsp.VariableFractionalDelay.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1724
dsp.VariableFractionalDelay.reset
Purpose
Syntax
reset(H)
Description
3-1725
dsp.VariableFractionalDelay.step
Purpose
Syntax
Y = step(H,X,D)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1726
dsp.VariableIntegerDelay
Purpose
Description
Construction
Properties
MaximumDelay
Maximum delay
Specify the maximum delay the object can produce for any sample.
The maximum delay must be a positive scalar integer value. The
object clips input delay values greater than the MaximumDelay to
the MaximumDelay. The default is 100.
InitialConditions
3-1727
dsp.VariableIntegerDelay
3-1728
dsp.VariableIntegerDelay
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
3-1729
dsp.VariableIntegerDelay
y = step(h, x(ii+1:ii+10)',k*ones(10,1));
yout = [yout;y];
ii = ii+10;
k = k+1;
end
stem(x,'b');
hold on; stem(yout,'r');
legend('Original Signal', 'Variable Integer Delayed Signal')
Algorithms
See Also
3-1730
dsp.VariableIntegerDelay.clone
Purpose
Syntax
C = clone(H)
Description
3-1731
dsp.VariableIntegerDelay.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1732
dsp.VariableIntegerDelay.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1733
dsp.VariableIntegerDelay.isLocked
Purpose
Syntax
isLocked(H)
Description
System object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1734
dsp.VariableIntegerDelay.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1735
dsp.VariableIntegerDelay.reset
Purpose
Syntax
reset(H)
Description
3-1736
dsp.VariableIntegerDelay.step
Purpose
Syntax
Y = step(H,X,D)
Description
zero to zero. If you enter a noninteger delay value, the object rounds
that value to the nearest integer value.
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1737
dsp.Variance
Purpose
Description
on page 3-1738.
2 Call step to compute the variance according to the properties of
toolbox.
Construction
Properties
RunningVariance
3-1738
dsp.Variance
3-1739
dsp.Variance
3-1740
dsp.Variance
Fixed-Point Properties
RoundingMethod
3-1741
dsp.Variance
3-1742
dsp.Variance
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
reset
step
Variance of input
Algorithms
Both this object and its corresponding block let you specify whether to
process inputs as individual samples or as frames of data. The object
3-1743
dsp.Variance
See Also
3-1744
dsp.Variance.clone
Purpose
Syntax
C = clone(H)
Description
3-1745
dsp.Variance.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1746
dsp.Variance.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1747
dsp.Variance.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1748
dsp.Variance.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1749
dsp.Variance.reset
Purpose
Syntax
reset(H)
Description
3-1750
dsp.Variance.step
Purpose
Variance of input
Syntax
Y = step(H,X)
Y = step(H,X,R)
VAR2D = step(H,X,ROI)
VAR2D = step(H,X,LABEL,LABELNUMBERS)
[VAR2D,FLAG] = step(H,X,ROI)
[VAR2D,FLAG] = step(H,X,LABEL,LABELNUMBERS)
Description
System Toolbox license. With only the DSP System Toolbox license, the
ROIForm property only supports Rectangles.
VAR2D = step(H,X,LABEL,LABELNUMBERS) computes the variance of
input image, X, for region labels contained in vector LABELNUMBERS ,
with matrix LABEL marking pixels of different regions. This option is
available when the ROIProcessing property is true and the ROIForm
property is Label matrix.
[VAR2D,FLAG] = step(H,X,ROI) returns FLAG which indicates whether
the given region of interest is within the image bounds when both the
ROIProcessing and ValidityOutputPort properties are true and the
ROIForm property is set to Lines, Rectangles or Binary mask.
[VAR2D,FLAG] = step(H,X,LABEL,LABELNUMBERS) returns FLAG which
indicates whether the input label numbers are valid when both the
ROIProcessing and ValidityOutputPort properties are true and the
ROIForm property is set to Label matrix.
3-1751
dsp.Variance.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1752
dsp.VectorQuantizerDecoder
Purpose
Description
on page 3-1753.
2 Call step to get the vector quantizer codeword according to the
Construction
Properties
CodebookSource
codebook
3-1753
dsp.VectorQuantizerDecoder
Methods
3-1754
clone
getNumInputs
getNumOutputs
dsp.VectorQuantizerDecoder
Examples
isLocked
release
step
Algorithms
See Also
dsp.VectorQuantizerEncoder | dsp.ScalarQuantizerDecoder
3-1755
dsp.VectorQuantizerDecoder.clone
Purpose
Syntax
Description
3-1756
dsp.VectorQuantizerDecoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1757
dsp.VectorQuantizerDecoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1758
dsp.VectorQuantizerDecoder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1759
dsp.VectorQuantizerDecoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1760
dsp.VectorQuantizerDecoder.step
Purpose
Syntax
Q = step(H,I)
Q = step(H,I,C)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1761
dsp.VectorQuantizerEncoder
Purpose
Description
on page 3-1762.
2 Call step to perform the quantization encoding according to the
Construction
Properties
CodebookSource
Codebook
Specify the codebook to which the input column vector or matrix
is compared, as a k-by-N matrix. Each column of the codebook
matrix is a codeword, and each codeword corresponds to an index
value. The codeword vectors must have the same number of rows
as the input. The first codeword vector corresponds to an index
3-1762
dsp.VectorQuantizerEncoder
Weighting factor
Specify the weighting factor as a vector of length equal to the
number of rows of the input. This property applies when you set
the DistortionMeasure property to Weighted squared error
and WeightsSource property is Property. The default is [1 1 1].
This property is tunable.
3-1763
dsp.VectorQuantizerEncoder
TiebreakerRule
3-1764
dsp.VectorQuantizerEncoder
Methods
clone
getNumInputs
getNumOutputs
3-1765
dsp.VectorQuantizerEncoder
Examples
isLocked
release
step
Algorithms
See Also
dsp.VectorQuantizerDecoder | dsp.ScalarQuantizerEncoder
3-1766
dsp.VectorQuantizerEncoder.clone
Purpose
Syntax
Description
object.
3-1767
dsp.VectorQuantizerEncoder.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1768
dsp.VectorQuantizerEncoder.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1769
dsp.VectorQuantizerEncoder.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1770
dsp.VectorQuantizerEncoder.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1771
dsp.VectorQuantizerEncoder.step
Purpose
Syntax
INDEX
INDEX
INDEX
[...,
[...,
Description
= step(H,INPUT)
= step(H,...,CODEBOOK)
= step(H,...,WEIGHTS)
CODEWORD] = step(H, ...)
QERR] = step(H, ...)
3-1772
dsp.VectorQuantizerEncoder.step
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
.
3-1773
dsp.Window
Purpose
Window object
Description
toolbox.
Construction
Properties
WindowFunction
Type of window
Specify the type of window to apply as Bartlett, Blackman,
Boxcar, Chebyshev, Hamming , Hann, Hanning, Kaiser, Taylor,
Triang. This property is tunable. The default is Hamming.
WeightsOutputPort
3-1774
dsp.Window
3-1775
dsp.Window
Fixed-Point Properties
FullPrecisionOverride
3-1776
dsp.Window
3-1777
dsp.Window
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
3-1778
dsp.Window
See Also
3-1779
dsp.Window.clone
Purpose
Syntax
C = clone(H)
Description
3-1780
dsp.Window.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1781
dsp.Window.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1782
dsp.Window.isLocked
Purpose
Syntax
isLocked(H)
Description
3-1783
dsp.Window.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1784
dsp.Window.step
Purpose
Syntax
Y = step(H,X)
[Y, W] = step(H,X)
Description
3-1785
dsp.ZeroCrossingDetector
Purpose
Description
on page 3-1786.
2 Call step to count the number of times according to the properties
Construction
Properties
FrameBasedProcessing
3-1786
dsp.ZeroCrossingDetector
Methods
Examples
clone
getNumInputs
getNumOutputs
isLocked
release
step
Algorithms
3-1787
dsp.ZeroCrossingDetector.clone
Purpose
Syntax
C = clone(H)
Description
3-1788
dsp.ZeroCrossingDetector.getNumInputs
Purpose
Syntax
N = getNumInputs(H)
Description
3-1789
dsp.ZeroCrossingDetector.getNumOutputs
Purpose
Syntax
N = getNumOutputs(H)
Description
method.
The getNumOutputs method returns a positive integer that is the
number of outputs from the step method. This value will change if you
alter any properties that turn outputs on or off.
3-1790
dsp.ZeroCrossingDetector.isLocked
Purpose
Syntax
isLocked(H)
Description
object.
The isLocked method returns a logical value that indicates whether
input attributes and nontunable properties for the object are locked. The
object performs an internal initialization the first time the step method
is executed. This initialization locks nontunable properties and input
specifications, such as dimensions, complexity, and data type of the
input data. After locking, the isLocked method returns a true value.
3-1791
dsp.ZeroCrossingDetector.release
Purpose
Syntax
release(H)
Description
and hardware connections, and lets you change any properties or input
characteristics.
Note You can use the release method on a System object in code
generated from MATLAB, but once you release its resources, you cannot
use that System object again.
3-1792
dsp.ZeroCrossingDetector.step
Purpose
Syntax
Y = step(H,X)
Description
Note The object performs an initialization the first time the step
method is executed. This initialization locks nontunable properties and
input specifications, such as dimensions, complexity, and data type
of the input data. If you change a nontunable property or an input
specification, the System object issues an error. To change nontunable
properties or inputs, you must first call the release method to unlock
the object.
3-1793
matlab.System
Purpose
Description
definition file, you must subclass your object from this base class (or
from another class that derives from this base class). Subclassing
allows you to use the implementation and service methods provided by
this base class to build your object. Type this syntax as the first line
of your class definition file to directly inherit from the matlab.System
base class, where ObjectName is the name of your object:
classdef ObjectName < matlab.System
Methods
3-1794
cloneImpl
getDiscreteStateImpl
getInputNamesImpl
getNumInputsImpl
getNumOutputsImpl
getOutputNamesImpl
infoImpl
isInactivePropertyImpl
loadObjectImpl
matlab.System
Attributes
processTunedPropertiesImpl
releaseImpl
Release resources
resetImpl
saveObjectImpl
setProperties
setupImpl
stepImpl
validateInputsImpl
validatePropertiesImpl
Logical
3-1795
matlab.System
PositiveInteger
DiscreteState
Examples
3-1796
matlab.System
end
See Also
matlab.system.StringSet | matlab.system.mixin.FiniteSource
How To
Object-Oriented Programming
Class Attributes
Property Attributes
Method Attributes
Define Basic System Objects
Define Property Attributes
3-1797
matlab.System.cloneImpl
Purpose
Syntax
cloneImpl(obj)
Description
object and its current state but does not copy any private or protected
properties. If the object you clone is locked and you use the default
cloneImpl, the new object will also be locked. If you define your own
cloneImpl and the associated saveObjectImpl and loadObjectImpl,
you can specify whether to clone the objects state and whether to clone
the objects private and protected properties.
cloneImpl is called by the clone method.
Input
Arguments
obj
Examples
Use the cloneImpl method in your class definition file to copy a System
object
methods (Access=protected)
function obj2 = cloneImpl(obj1)
s = saveObject (obj1);
obj2 = loadObject(s);
end
end
See Also
3-1798
saveObjectImpl | loadObjectImpl
matlab.System.cloneImpl
How To
3-1799
matlab.System.getDiscreteStateImpl
Purpose
Syntax
s = getDiscreteStateImpl(obj)
Description
Input
Arguments
obj
Output
Arguments
Examples
See Also
3-1800
setupImpl
matlab.System.getDiscreteStateImpl
How To
3-1801
matlab.System.getInputNamesImpl
Purpose
Syntax
[name1,name2,...] = getInputNamesImpl(obj)
Description
Input
Arguments
obj
Output
Arguments
name1,name2,...
Examples
3-1802
matlab.System.getInputNamesImpl
if numInputs > 1
varargout{2} = 'lower';
end
end
end
See Also
getNumInputsImpl | getOutputNamesImpl
How To
3-1803
matlab.System.getNumInputsImpl
Purpose
Syntax
num = getNumInputsImpl(obj)
Description
Input
Arguments
obj
Output
Arguments
num
Examples
3-1804
matlab.System.getNumInputsImpl
methods (Access=protected)
function num = getNumInputsImpl(obj)
num = 2;
end
end
See Also
How To
3-1805
matlab.System.getNumOutputsImpl
Purpose
Syntax
Description
Input
Arguments
obj
Output
Arguments
num
Examples
Specify the number of outputs (2, in this case) returned from the step
method.
methods (Access=protected)
function num = getNumOutputsImpl(obj)
num = 2;
end
end
3-1806
matlab.System.getNumOutputsImpl
See Also
How To
3-1807
matlab.System.getOutputNamesImpl
Purpose
Syntax
[name1,name2,...] = getOutputNamesImpl(obj)
Description
Input
Arguments
obj
Output
Arguments
name1,name2,...
Examples
3-1808
matlab.System.getOutputNamesImpl
See Also
getNumOutputsImpl | getInputNamesImpl
How To
3-1809
matlab.System.infoImpl
Purpose
Syntax
s = infoImpl(obj,varargin)
Description
Input
Arguments
obj
Examples
How To
3-1810
matlab.System.isInactivePropertyImpl
Purpose
Syntax
flag = isInactivePropertyImpl(obj,prop)
Description
Input
Arguments
obj
Output
Arguments
flag
Examples
3-1811
matlab.System.isInactivePropertyImpl
if strcmp(propertyName,'InitialValue')
flag = obj.UseRandomInitialValue;
else
flag = false;
end
end
end
See Also
setProperties
How To
3-1812
matlab.System.loadObjectImpl
Purpose
Syntax
loadObjectImpl(obj)
Description
are loaded.
Note You must set Access=protected for this method.
Input
Arguments
obj
Examples
Load a saved System object. In this case, the object contains a child
object, protected and private properties, and a discrete state.
methods(Access=protected)
function loadObjectImpl(obj, s, wasLocked)
% Load child System objects
obj.child = matlab.System.loadObject(s.child);
% Save protected & private properties
obj.protected = s.protected;
obj.pdependentprop = s.pdependentprop;
% Save state only if locked when saved
if wasLocked
obj.state = s.state;
end
% Call base class method
3-1813
matlab.System.loadObjectImpl
[email protected](obj,s,wasLocked);
end
end
See Also
saveObjectImpl
How To
3-1814
matlab.System.processTunedPropertiesImpl
Purpose
Syntax
processTunedPropertiesImpl(obj)
Description
Tips
Input
Arguments
obj
Examples
methods (Access=protected)
function processTunedPropertiesImpl(obj)
% Generate a lookup table of note frequencies
obj.pLookupTable = obj.MiddleC * (1+log(1:obj.NumNotes)/log(12))
3-1815
matlab.System.processTunedPropertiesImpl
end
end
See Also
validatePropertiesImpl | setProperties
How To
3-1816
matlab.System.releaseImpl
Purpose
Release resources
Syntax
releaseImpl(obj)
Description
Input
Arguments
obj
Examples
See Also
resetImpl
How To
3-1817
matlab.System.resetImpl
Purpose
Syntax
resetImpl(obj)
Description
resetImpl(obj) defines the state reset equations for the System object.
Typically you reset the states to a set of initial values. This is useful for
initialization at the start of simulation.
resetImpl is called by the reset method. It is also called by the setup
method, after the setupImpl method.
Input
Arguments
obj
Examples
Use the reset method to reset the counter pCount property to zero.
methods (Access=protected)
function resetImpl(obj)
obj.pCount = 0;
end
end
See Also
releaseImpl
How To
3-1818
matlab.System.saveObjectImpl
Purpose
Syntax
saveObjectImpl(obj)
Description
You should save the state of an object only if the object is locked. When
the user loads that saved object, it loads in that locked state.
To save child object information, you use the associated saveObject
method within the saveObjectImpl method.
End users can use load, which calls loadObjectImpl to load a System
object into their workspace.
Note You must set Access=protected for this method.
Input
Arguments
obj
Examples
Define what is saved for the System object. Call the base class version
of saveObjectImpl to save public properties. Then, save any child
System objects and any protected and private properties. Finally, save
the state, if the object is locked.
methods(Access=protected)
function s = saveObjectImpl(obj)
3-1819
matlab.System.saveObjectImpl
s = [email protected](obj);
s.child = matlab.System.saveObject(obj.child);
s.protected = obj.protected;
s.pdependentprop = obj.pdependentprop;
if isLocked(obj)
s.state = obj.state;
end
end
end
See Also
loadObjectImpl
How To
3-1820
matlab.System.setProperties
Purpose
Syntax
setProperties(obj,numargs,name1,value1,name2,value2,...)
setProperties(obj,numargs,arg1,...,argm,name1,value1,name2,value2,...,
'ValueOnlyPropName1','ValueOnlyPropName2',...,
'ValueOnlyPropNamem')
Description
setProperties(obj,numargs,name1,value1,name2,value2,...)
setProperties(obj,numargs,arg1,...,argm,name1,value1,name2,value2,...,
'ValueOnlyPropName1','ValueOnlyPropName2',...,
'ValueOnlyPropNamem') provides the value-only inputs, followed by
Input
Arguments
obj
Name of property
value1,value2,...
3-1821
matlab.System.setProperties
Examples
How To
3-1822
matlab.System.setupImpl
Purpose
Syntax
setupImpl(obj)
setupImpl(obj,input1,input2,...)
Description
Note You can omit this method from your class definition file if your
System object does not require any setup tasks.
You must set Access=protected for this method.
Do not use setupImpl to initialize or reset states. For states, use the
resetImpl method.
You cannot modify any tunable properties in this method if its System
object will be used in the Simulink MATLAB System block.
3-1823
matlab.System.setupImpl
Tips
Input
Arguments
obj
Examples
3-1824
matlab.System.setupImpl
end
function y = stepImpl(obj,u)
y = obj.myState;
obj.myState = u;
end
end
end
See Also
How To
3-1825
matlab.System.stepImpl
Purpose
Syntax
[output1,output2,...] = stepImpl(obj,input1,input2,...)
Description
[output1,output2,...]
= stepImpl(obj,input1,input2,...)
defines the algorithm to execute when you call the step method on
the specified object obj. The step method calculates the outputs and
updates the objects state values using the inputs, properties, and state
update equations.
stepImpl is called by the step method.
Tips
The number of input arguments and output arguments must match the
values returned by the getNumInputsImpl and getNumOutputsImpl
methods, respectively
Input
Arguments
obj
Output
Arguments
output
Examples
3-1826
matlab.System.stepImpl
y2 = x2 + 1;
end
end
See Also
How To
3-1827
matlab.System.validateInputsImpl
Purpose
Syntax
validateInputsImpl(obj,input1,input2,...)
Description
properties.
Input
Arguments
obj
Examples
3-1828
matlab.System.validateInputsImpl
See Also
validatePropertiesImpl | setupImpl
How To
3-1829
matlab.System.validatePropertiesImpl
Purpose
Syntax
validatePropertiesImpl(obj)
Description
properties.
Input
Arguments
obj
Examples
Validate a Property
Validate that the useIncrement property is true and that the value of
the increment property is greater than zero.
methods (Access=protected)
function validatePropertiesImpl(obj)
if obj.useIncrement && obj.increment < 0
error('The increment value must be positive');
end
end
end
See Also
3-1830
matlab.System.validatePropertiesImpl
How To
3-1831
matlab.system.display.Header
Purpose
Syntax
matlab.system.display.Header(N1,V1,...Nn,Vn)
matlab.system.display.Header(Obj,...)
Description
for the System object, with the header properties defined in Name-Value
(N,V) pairs. You use matlab.system.display.Header within the
getHeaderImpl method. The available header properties are
Title Header title string. The default value is an empty string.
Text Header description text string. The default value is an empty
string.
ShowSourceLink Show link to source code for the object.
matlab.system.display.Header(Obj,...) creates a header for the
specified System object (Obj) and sets the following property values:
Methods
Examples
getHeaderImpl
3-1832
matlab.system.display.Header
methods(Static,Access=protected)
function header = getHeaderImpl
header = matlab.system.display.Header(mfilename('class'), ...
'Title','AlternativeTitle',...
'Text','An alternative class description');
end
end
See Also
matlab.system.display.Section |
matlab.system.display.SectionGroup
How To
Object-Oriented Programming
Class Attributes
Property Attributes
Add Header to System Block Dialog
3-1833
matlab.system.display.Header.getHeaderImpl
Purpose
Syntax
header = getHeaderImpl
Description
Note You must set Access=protected and Static for this method.
Output
Arguments
header
Examples
Header text
See Also
getPropertyGroupsImpl
How To
3-1834
matlab.system.display.Section
Purpose
Syntax
matlab.system.display.Section(N1,V1,...Nn,Vn)
matlab.system.display.Section(Obj,...)
Description
matlab.system.display.Section(N1,V1,...Nn,Vn) creates a
property group section for displaying System object properties,
which you define using property Name-Value pairs (N,V). You use
matlab.system.display.Section to define property groups using the
getPropertyGroupsImpl method. The available Section properties are
3-1835
matlab.system.display.Section
Methods
Examples
When you specify the System object in the MATLAB System block, the
resulting dialog box appears as follows.
3-1836
matlab.system.display.Section
See Also
matlab.system.display.Header |
matlab.system.display.SectionGroup
How To
Object-Oriented Programming
Class Attributes
Property Attributes
Add Property Groups to System Object and Block Dialog
3-1837
matlab.system.display.Section.getPropertyGroupsImpl
Purpose
Syntax
group = getPropertyGroupsImpl
Description
Output
Arguments
group
Examples
3-1838
matlab.system.display.Section.getPropertyGroupsImpl
valueGroup = matlab.system.display.Section(...
'Title','Value parameters',...
'PropertyList',{'StartValue','EndValue'});
thresholdGroup = matlab.system.display.Section(...
'Title','Threshold parameters',...
'PropertyList',{'Threshold','UseThreshold'});
mainGroup = matlab.system.display.SectionGroup(...
'Title','Main', ...
'Sections',[valueGroup,thresholdGroup]);
initGroup = matlab.system.display.SectionGroup(...
'Title','Initial conditions', ...
'PropertyList',{'IC1','IC2','IC3'});
groups = [mainGroup,initGroup];
end
end
3-1839
matlab.system.display.Section.getPropertyGroupsImpl
3-1840
matlab.system.display.Section.getPropertyGroupsImpl
See Also
matlab.system.display.Header | matlab.system.display.Section
| matlab.system.display.SectionGroup
How To
3-1841
matlab.system.display.SectionGroup
Purpose
Syntax
matlab.system.display.SectionGroup(N1,V1,...Nn,Vn)
matlab.system.display.SectionGroup(Obj,...)
Description
matlab.system.display.SectionGroup(N1,V1,...Nn,Vn) creates
property values:
TitleSource Set to 'Auto'.
Sections Set to matlab.system.display.Section object for Obj.
3-1842
matlab.system.display.SectionGroup
You can use mfilename('class') from within this method to get the
name of the System object. If you set any Name-Value pairs, those
property values override the default settings.
Methods
Examples
3-1843
matlab.system.display.SectionGroup
The resulting dialog appears as follows when you add the object to
Simulink with the MATLAB System block.
3-1844
matlab.system.display.SectionGroup
See Also
matlab.system.display.Header | matlab.system.display.Section
How To
Object-Oriented Programming
Class Attributes
Property Attributes
Add Property Groups to System Object and Block Dialog
3-1845
matlab.system.mixin.CustomIcon
Purpose
Description
method. This method customizes the name of the icon used for the
System object implemented through a MATLAB System block.
To use this method, you must subclass from this class in addition to the
matlab.System base class. Type the following syntax as the first line of
your class definition file, where ObjectName is the name of your object:
classdef ObjectName < matlab.system &...
matlab.system.mixin.CustomIcon
Methods
getIconImpl
See Also
matlab.System
Tutorials
How To
Object-Oriented Programming
Class Attributes
Property Attributes
3-1846
matlab.system.mixin.CustomIcon.getIconImpl
Purpose
Syntax
icon = getIconImpl(obj)
Description
Input
Arguments
obj
Output
Arguments
icon
Examples
Specify in your class definition file the name of the block icon as
'Enhanced Counter' using two lines.
methods (Access=protected)
function icon = getIconImpl(~)
icon = {'Enhanced','Counter'};
end
end
3-1847
matlab.system.mixin.CustomIcon.getIconImpl
See Also
matlab.system.mixin.CustomIcon
How To
3-1848
matlab.system.mixin.FiniteSource
Purpose
Description
method, which reports the state of a finite data source, such as an audio
file.
To use this method, you must subclass from this class in addition to the
matlab.System base class. Type the following syntax as the first line of
your class definition file, where ObjectName is the name of your object:
classdef ObjectName < matlab.System &...
matlab.system.mixin.FiniteSource
Methods
isDoneImpl
See Also
matlab.System
Tutorials
How To
Object-Oriented Programming
End-of-data flag
Class Attributes
Property Attributes
3-1849
matlab.system.mixin.FiniteSource.isDoneImpl
Purpose
End-of-data flag
Syntax
status = isDoneImpl(obj)
Description
finite source has been exhausted, typically by having read and output
all data from the source. You should also define the result of future
reads from an exhausted source in the isDoneImpl method.
isDoneImpl is called by the isDone method.
Input
Arguments
obj
Output
Arguments
status
Examples
Set up the isDoneImpl method in your class definition file so the isDone
method checks whether the object has completed eight iterations.
methods (Access=protected)
function bdone = isDoneImpl(obj)
bdone = obj.NumIters==8;
end
end
See Also
3-1850
matlab.system.mixin.FiniteSource
matlab.system.mixin.FiniteSource.isDoneImpl
How To
3-1851
matlab.system.mixin.Nondirect
Purpose
Description
System object.
For System objects that use direct feedthrough, the objects input is
needed to generate the output at that time. For these direct feedthrough
objects, the step method calculates the output and updates the state
values. For nondirect feedthrough, however, the objects output
depends only on the internal states at that time. The inputs are used
to update the object states. For these objects, calculating the output
with outputImpl is separated from updating the state values with
updateImpl. If you use the matlab.system.mixin.Nondirect mixin
and include the stepImpl method in your class definition file, an error
occurs. In this case, you must include the updateImpl and outputImpl
methods instead.
The following cases describe when System objects in Simulink use
direct or nondirect feedthrough.
System object supports code generation and does not inherit from
the Propagates mixin Simulink automatically infers the direct
feedthrough settings from the System object code.
System object supports code generation and inherits from the
Propagates mixin Simulink does not automatically infer the
direct feedthrough settings. Instead, it uses the value returned by
the isInputDirectFeedthroughImpl method.
System object does not support code generation Default
isInputDirectFeedthrough method returns false, indicating that
direct feedthrough is not enabled. To override the default behavior,
implement the isInputDirectFeedthroughImpl method in your
class definition file.
Use the Nondirect mixin to allow a System object to be used in a
Simulink feedback loop. A delay object is an example of a nondirect
feedthrough object.
3-1852
matlab.system.mixin.Nondirect
To use this mixin, you must subclass from this class in addition to
subclassing from the matlab.System base class. Type the following
syntax as the first line of your class definition file, where ObjectName
is the name of your object:
classdef ObjectName < matlab.system &...
matlab.system.mixin.Nondirect
Methods
isInputDirectFeedthroughImpl
outputImpl
updateImpl
See Also
matlab.system
Tutorials
How To
Object-Oriented Programming
Class Attributes
Property Attributes
3-1853
matlab.system.mixin.Nondirect.isInputDirectFeedthroughImpl
Purpose
Syntax
[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj,u1,u2,...,uN)
Description
[flag1,...,flagN] =
isInputDirectFeedthroughImpl(obj,u1,u2,...,uN) indicates
3-1854
matlab.system.mixin.Nondirect.isInputDirectFeedthroughI
Input
Arguments
obj
Output
Arguments
flag1,...,flagN
Examples
See Also
matlab.system.mixin.Nondirect
How To
3-1855
matlab.system.mixin.Nondirect.outputImpl
Purpose
Syntax
[y1,y2,...,yN] = outputImpl(obj,u1,u2,...,uN)
Description
the output equations for the System object. The output values are
calculated from the states and property values. Any inputs that you set
to nondirect feedthrough are ignored during output calculation.
outputImpl is called by the output method. It is also called before
the updateImpl method in the step method. For sink objects, calling
updateImpl before outputImpl locks the object. For all other types of
objects, calling updateImpl before outputImpl causes an error.
Input
Arguments
obj
Output
Arguments
3-1856
y1,y2,...yN
matlab.system.mixin.Nondirect.outputImpl
Examples
See Also
matlab.system.mixin.Nondirect
How To
3-1857
matlab.system.mixin.Nondirect.updateImpl
Purpose
Syntax
updateImpl(obj,u1,u2,...,uN)
Description
Input
Arguments
obj
Examples
3-1858
matlab.system.mixin.Nondirect.updateImpl
function updateImpl(obj,u)
obj.PreviousInput = [u obj.PreviousInput(1:end-1)];
end
end
See Also
matlab.system.mixin.Nondirect
How To
3-1859
matlab.system.mixin.Propagates
Purpose
Description
objects output size, data type, and complexity. You implement the
methods of this class when the output specifications cannot be inferred
directly from the inputs during Simulink model compilation. If you do
not include this mixin and the output specifications cannot be inferred,
an error occurs. You use this mixin class and its methods when your
System object will be used in the MATLAB System block.
To use this mixin, you must subclass from this class in addition to
subclassing from the matlab.System base class. Type the following
syntax as the first line of your class definition file, where ObjectName is
the name of your System object:
classdef ObjectName < matlab.System &...
matlab.system.mixin.Propagates
Methods
3-1860
getOutputSizeImpl
isOutputComplexImpl
isOutputFixedSizeImpl
propagatedInputComplexity
propagatedInputDataType
matlab.system.mixin.Propagates
propagatedInputFixedSize
propagatedInputSize
Note If your System object has exactly one input and one output
and no discrete property states, you do not have to implement any of
these methods. Default values are used when you subclass from the
matlab.system.mixin.Propagates mixin.
See Also
matlab.System
Tutorials
How To
Object-Oriented Programming
Class Attributes
Property Attributes
3-1861
matlab.system.mixin.Propagates.getDiscreteStateSpecificationI
Purpose
Syntax
[sz,dt,cp] = getDiscreteStateSpecificationImpl(obj,name)
Description
[sz,dt,cp] = getDiscreteStateSpecificationImpl(obj,name)
returns the size, data type, and complexity of the property, name. This
property must be a discrete state property. You must define this method
if your System object has discrete state properties and is used in the
MATLAB System block. If you define this method for a property that is
not discrete state, an error occurs during model compilation.
You always set the getDiscreteStateSpecificationImpl method
access to protected because it is an internal method that users do not
directly call or run.
getDiscreteStateSpecificationImpl is called by the MATLAB
Input
Arguments
obj
Output
Arguments
sz
3-1862
matlab.system.mixin.Propagates.getDiscreteStateSpecifica
Examples
See Also
matlab.system.mixin.Propagates
How To
3-1863
matlab.system.mixin.Propagates.getOutputDataTypeImpl
Purpose
Syntax
[dt_1,dt_2,...,dt_n] = getOutputDataTypeImpl(obj)
Description
data types of each output port. The number of outputs must match
the value returned from the getNumOutputs method or the number of
output arguments listed in the step method.
For System objects with one input and one output and where you want
the input and output data types to be the same, you do not need to
implement this method. In this case getOutputDataTypeImpl assumes
the input and output data types are the same and returns the data
type of the input.
If your System object has more than one input or output or you need
the output and input data types to be different, you must implement
the getOutputDataTypeImpl method to define the output data type if
the output data type differs from the input data type. You also must
implement the propagatedInputDataType method.
During Simulink model compilation and propagation, the MATLAB
System block calls the getOutputDataType method, which then calls
the getOutputDataTypeImpl method to determine the output data type.
Note You must set Access=protected for this method.
You cannot modify any properties in this method.
Input
Arguments
obj
Output
Arguments
dt_1,dt_2,...
3-1864
matlab.system.mixin.Propagates.getOutputDataTypeImpl
Examples
See Also
matlab.system.mixin.Propagates | propagatedInputDataType
How To
3-1865
matlab.system.mixin.Propagates.getOutputSizeImpl
Purpose
Syntax
[sz_1,sz_2,...,sz_n] = getOutputSizeImpl(obj)
Description
For System objects with one input and one output and where you
want the input and output sizes to be the same, you do not need to
implement this method. In this case getOutputSizeImpl assumes the
input and output sizes are the same and returns the size of the input.
For variable-size inputs, the output size is the maximum input size.
If your System object has more than one input or output or you need
the output and input sizes to be different, you must implement the
getOutputSizeImpl method to define the output size. You also must
use the propagatedInputSize method if the output size differs from
the input size.
During Simulink model compilation and propagation, the MATLAB
System block calls the getOutputSize method, which then calls the
getOutputSizeImpl method to determine the output size.
Note You must set Access=protected for this method.
You cannot modify any properties in this method.
Input
Arguments
obj
Output
Arguments
sz_1,sz_2,...
3-1866
matlab.system.mixin.Propagates.getOutputSizeImpl
Examples
See Also
matlab.system.mixin.Propagates | propagatedInputSize
How To
3-1867
matlab.system.mixin.Propagates.isOutputComplexImpl
Purpose
Syntax
[cp_1,cp_2,...,cp_n] = isOutputComplexImpl(obj)
Description
For System objects with one input and one output and where you
want the input and output complexities to be the same, you do not
need to implement this method. In this case isOutputComplexImpl
assumes the input and output complexities are the same and returns
the complexity of the input.
If your System object has more than one input or output or you need
the output and input complexities to be different, you must implement
the isOutputComplexImpl method to define the output complexity. You
also must use the propagatedInputComplexity method if the output
complexity differs from the input complexity.
During Simulink model compilation and propagation, the MATLAB
System block calls the isOutputComplex method, which then calls the
isOutputComplexImpl method to determine the output complexity.
Note You must set Access=protected for this method.
You cannot modify any properties in this method.
Input
Arguments
obj
Output
Arguments
cp_1,cp_2,...
3-1868
matlab.system.mixin.Propagates.isOutputComplexImpl
Examples
See Also
matlab.system.mixin.Propagates | propagatedInputComplexity
How To
3-1869
matlab.system.mixin.Propagates.isOutputFixedSizeImpl
Purpose
Syntax
[flag_1,flag_2,...flag_n] = isOutputFixedSizeImpl(obj)
Description
[flag_1,flag_2,...flag_n] = isOutputFixedSizeImpl(obj)
indicates whether each output port is fixed size. The number of outputs
must match the value returned from the getNumOutputs method or the
number of output arguments listed in the step method.
For System objects with one input and one output and where you want
the input and output fixed sizes to be the same, you do not need to
implement this method. In this case isOutputFixedSizeImpl assumes
the input and output fixed sizes are the same and returns the fixed
size of the input.
If your System object has more than one input or output or you need the
output and input fixed sizes to be different, you must implement the
isOutputFixedSizeImpl method to define the output data type. You
also must use the propagatedInputFixedSize method if the output
fixed size status differs from the input fixed size status.
During Simulink model compilation and propagation, the MATLAB
System block calls the isOutputFixedSize method, which then calls
the isOutputFixedSizeImpl method to determine the output fixed size.
Note You must set Access=protected for this method.
You cannot modify any properties in this method.
Input
Arguments
obj
Output
Arguments
flag_1,flag2,...
3-1870
matlab.system.mixin.Propagates.isOutputFixedSizeImpl
Examples
See Also
matlab.system.mixin.Propagates | propagatedInputFixedSize
How To
3-1871
matlab.system.mixin.Propagates.propagatedInputComplexity
Purpose
Syntax
flag = propagatedInputComplexity(obj,index)
Description
Input
Arguments
obj
Output
Arguments
flag
Examples
3-1872
matlab.system.mixin.Propagates.propagatedInputComple
methods (Access=protected)
function outcomplx = isOutputComplexImpl(obj)
outcomplx = propagatedInputComplexity(obj,2);
end
end
See Also
matlab.system.mixin.Propagates | isOutputComplexImpl
How To
3-1873
matlab.system.mixin.Propagates.propagatedInputDataType
Purpose
Syntax
dt = propagatedInputDataType(obj,index)
Description
Input
Arguments
obj
Output
Arguments
dt
Examples
3-1874
matlab.system.mixin.Propagates.propagatedInputDataTy
methods (Access=protected)
function dt = getOutputDataTypeImpl(obj)
if strcmpi(propagatedInputDataType(obj,2),'double')
dt = 'int32';
else
dt = propagatedInputDataType(obj,2);
end
end
end
See Also
How To
Type Propagation
Set Output Data Type
3-1875
matlab.system.mixin.Propagates.propagatedInputFixedSize
Purpose
Syntax
flag = propagatedInputFixedSize(obj,index)
Description
Input
Arguments
obj
Output
Arguments
flag
Examples
3-1876
matlab.system.mixin.Propagates.propagatedInputFixedSi
methods (Access=protected)
function outtype = isOutputFixedSizeImpl(obj)
outtype = propagatedInputFixedSize(obj,3)
end
end
See Also
matlab.system.mixin.Propagates | isOutputFixedSizeImpl
How To
3-1877
matlab.system.mixin.Propagates.propagatedInputSize
Purpose
Syntax
sz = propagatedInputSize(obj,index)
Description
Input
Arguments
obj
Output
Arguments
sz
Examples
3-1878
matlab.system.mixin.Propagates.propagatedInputSize
See Also
matlab.system.mixin.Propagates | getOutputSizeImpl
How To
3-1879
matlab.system.StringSet
Purpose
Description
A StringSet uses two linked properties, which you must define in the
same class. One is a public property that contains the current string
value. This public property is displayed to the user. The other property
is a hidden property that contains the list of all possible string values.
This hidden property should also have the transient attribute so its
value is not saved to disk when you save the System object.
The following considerations apply when using StringSets:
The string property that holds the current string can have any name.
The property that holds the StringSet must use the same name as
the string property with the suffix Set appended to it. The string
set property is an instance of the matlab.system.StringSet class.
Valid strings, defined in the StringSet, must be declared using a cell
array. The cell array cannot be empty nor can it have any empty
strings. Valid strings must be unique and are case-insensitive.
The string property must be set to a valid StringSet value.
Examples
3-1880
matlab.system.StringSet
end
See Also
matlab.System
How To
Object-Oriented Programming
Class Attributes
Property Attributes
Limit Property Values to Finite String Set
3-1881
spbscopes.SpectrumAnalyzerConfiguration
Purpose
Description
Construction
Properties
CenterFrequency
SampleRate SampleRate
,
is
FrequencyOffset hertz.
2
2
the PlotAsTwoSidedSpectrum
When
property is set to false, the
SampleRate
interval is 0,
FrequencyOffset hertz.
2
FFT length
Specify as a positive, scalar integer the length of the FFT
that the Spectrum Analyzer uses to compute spectral
3-1882
spbscopes.SpectrumAnalyzerConfiguration
Frequency offset
3-1883
spbscopes.SpectrumAnalyzerConfiguration
SampleRate SampleRate
,
interval is
FrequencyOffset
2
you set2the PlotAsTwoSidedSpectrum
hertz. When
property to
SampleRate
FrequencyOffset
span2in different
Default: 0
FrequencyResolutionMethod
NENBW * Fs
where NENBW is the normalized effective
as
noiseNbandwidth
of the window currently specified in the Window
window
property. You can control the number of FFT points only when
the FrequencyResolutionMethod property is 'WindowLength'.
When the FrequencyResolutionMethod property is 'RBW', the
FFT length is the window length that results from achieving the
specified RBW value or 1024, whichever is larger.
This property is Tunable.
3-1884
spbscopes.SpectrumAnalyzerConfiguration
Default: 'RBW'
FrequencyScale
Frequency scale
Specify the frequency scale as either 'Linear' or 'Log'. This
property applies only when you set the SpectrumType property to
'Power' or 'Power density'. When you set the FrequencyScale
property to 'Log', the Spectrum Analyzer displays the frequencies
on the x-axis on a logarithmic scale. To use the 'Log' setting, you
must also set the PlotAsTwoSidedSpectrum property to false.
When the PlotAsTwoSidedSpectrum property is true, you must
set this property to 'Linear'.
This property is Tunable.
Default: 'Linear'
FrequencySpan
SampleRate SampleRate
,
FrequencyOffset hertz. If
2 PlotAsTwoSidedSpectrum
2
you
set the
property to false, the
SampleRate
Nyquist interval is 0,
FrequencyOffset hertz.
2
3-1885
spbscopes.SpectrumAnalyzerConfiguration
Overlap percentage
Specify as a real, scalar value, the percentage overlap between the
previous and current buffered data segments. The overlap creates
a window segment that is used to compute a spectral estimate.
The value must be greater than or equal to zero and less than
100. This property is Tunable.
3-1886
spbscopes.SpectrumAnalyzerConfiguration
Default: 0
PlotAsTwoSidedSpectrum
3-1887
spbscopes.SpectrumAnalyzerConfiguration
3-1888
spbscopes.SpectrumAnalyzerConfiguration
Power units
Specify the units in which the Spectrum Analyzer displays power
values as either 'dBm', 'dBW', or 'Watts'.
This property is Tunable.
Default: 'dBm'
RBW
Resolution bandwidth
Specify as a real, positive scalar the resolution bandwidth
(RBW), in hertz. RBW controls the spectral resolution of
Spectrum Analyzer. This property applies only when you set
the FrequencyResolutionMethod property to 'RBW' and the
RBWSource property to 'Property'. You must specify a value
to ensure that there are at least two RBW intervals over the
specified frequency span. Thus, the ratio of the overall span to
span
2 . You can specify
RBW must be greater than two:
the overall span in different waysRBW
based on how you set the
FrequencySpan property.
This property is Tunable.
See also: RBWSource.
Default: 9.76
3-1889
spbscopes.SpectrumAnalyzerConfiguration
RBWSource
Reference load
3-1890
spbscopes.SpectrumAnalyzerConfiguration
3-1891
spbscopes.SpectrumAnalyzerConfiguration
SampleRate SampleRate
,
interval is
FrequencyOffset
2
you set2the PlotAsTwoSidedSpectrum
hertz. When
property to
hertz.
SampleRate
FrequencyOffset
2
3-1892
spbscopes.SpectrumAnalyzerConfiguration
Spectrum type
Specify the spectrum type as one of 'Power', 'Power density',
or 'Spectrogram'.
When you set this property to 'Power', the Spectrum Analyzer
shows the power spectrum.
When you set this property to 'Power density', the Spectrum
Analyzer shows the power spectral density. The power spectral
density is the magnitude squared of the spectrum normalized
to a bandwidth of 1 hertz.
When you set this property to 'Spectrogram', the Spectrum
Analyzer open a spectrogram view, which shows frequency
content over time. Each line of the spectrogram is one
periodogram. Time scrolls from the bottom to the top of the
display. The most recent spectrogram update is at the bottom
of the display.
This property is Tunable.
Default: 'Power'
StartFrequency
3-1893
spbscopes.SpectrumAnalyzerConfiguration
SampleRate SampleRate
,
interval is
FrequencyOffset
2
set the2PlotAsTwoSidedSpectrum
hertz. If you
property to
hertz.
SampleRate
FrequencyOffset
2
SampleRate SampleRate
,
is
FrequencyOffset hertz.
2
2
the PlotAsTwoSidedSpectrum
When
property is set to false,
SampleRate
the interval is 0,
FrequencyOffset hertz.
2
3-1894
spbscopes.SpectrumAnalyzerConfiguration
Default: 5e3
Title
Display title
Specify the display title as a string. Enter %<SignalLabel> to use
the signal labels in the Simulink Model as the axes titles. This
property is Tunable.
Default: ''
TreatMby1SignalsAsOneChannel
Window function
Specify a window function for the spectral estimator as one of the
options in the following table. For information on any window
function, follow the link to the corresponding function reference in
the Signal Processing Toolbox documentation.
Window
Option
'Rectangular'
rectwin
'Chebyshev'
chebwin
'Flat Top'
flattopwin
'Hamming'
hamming
3-1895
spbscopes.SpectrumAnalyzerConfiguration
Window
Option
'Hann'
hann
'Kaiser'
kaiser
NENBW * Fs
N window
where Nwindow is
3-1896
spbscopes.SpectrumAnalyzerConfiguration
Examples
3-1897
spbscopes.SpectrumAnalyzerConfiguration
Name:
OpenAtSimulationStart:
Visible:
Position:
SampleRate:
SpectrumType:
FrequencySpan:
Span:
CenterFrequency:
StartFrequency:
StopFrequency:
FrequencyResolutionMethod:
RBWSource:
RBW:
WindowLength:
FFTLengthSource:
FFTLength:
OverlapPercent:
Window:
SidelobeAttenuation:
TimeResolutionSource:
TimeResolution:
TimeSpanSource:
TimeSpan:
SpectralAverages:
PowerUnits:
ReferenceLoad:
PlotMaxHoldTrace:
PlotMinHoldTrace:
PlotNormalTrace:
PlotAsTwoSidedSpectrum:
FrequencyScale:
FrequencyOffset:
Title:
YLimits:
YLabel:
3-1898
'SpectrumAnalyzer'
1
0
[680 390 560 420]
'10e3'
'Power'
'Full'
'10e3'
'0'
'-5e3'
'5e3'
'RBW'
'Auto'
'9.76'
'1024'
'Auto'
'1024'
'0'
'Hann'
'60'
'Auto'
'1e-3'
'Auto'
'100e-3'
'1'
'dBm'
'1'
0
0
1
1
'Linear'
'0'
''
[-80 20]
''
spbscopes.SpectrumAnalyzerConfiguration
ShowLegend:
ShowGrid:
ReducePlotRate:
TreatMby1SignalsAsOneChannel:
See Also
0
1
1
1
3-1899
spbscopes.SpectrumAnalyzerConfiguration
3-1900
4
Functions Alphabetical
List
adaptfilt
Purpose
Adaptive filter
Syntax
ha = adaptfilt.algorithm('input1',input2,...)
Description
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Algorithms
For adaptive filter (adaptfilt) objects, the algorithm string
determines which adaptive filter algorithm your adaptfilt object
implements. Each available algorithm entry appears in one of the tables
along with a brief description of the algorithm. Click on the algorithm in
the first column to get more information about the associated adaptive
filter technique.
Least Mean Squares (LMS) Based FIR Adaptive Filters on page 4-3
Recursive Least Squares (RLS) Based FIR Adaptive Filters on
page 4-4
Affine Projection (AP) FIR Adaptive Filters on page 4-4
FIR Adaptive Filters in the Frequency Domain (FD) on page 4-5
Lattice Based (L) FIR Adaptive Filters on page 4-5
4-2
adaptfilt
adaptfilt.adjlms
adaptfilt.blms
adaptfilt.blmsfft
adaptfilt.dlms
adaptfilt.filtxlms
adaptfilt.lms
adaptfilt.nlms
adaptfilt.sd
adaptfilt.se
adaptfilt.ss
4-3
adaptfilt
adaptfilt.ftf
adaptfilt.qrdrls
adaptfilt.hrls
adaptfilt.hswrls
adaptfilt.rls
adaptfilt.swrls
adaptfilt.swftf
4-4
adaptfilt.ap
adaptfilt.apru
adaptfilt.bap
adaptfilt
adaptfilt.pbfdaf
adaptfilt.pbufdaf
adaptfilt.tdafdct
adaptfilt.tdafdft
adaptfilt.ufdaf
adaptfilt.lsl
adaptfilt.qrdlsl
4-5
adaptfilt
4-6
adaptfilt
Method
Description
adaptfilt/coefficients
adaptfilt/filter
adaptfilt/freqz
adaptfilt/grpdelay
adaptfilt/impz
adaptfilt/info
adaptfilt/isfir
adaptfilt/islinphase
adaptfilt/ismaxphase
adaptfilt/isminphase
adaptfilt/isreal
adaptfilt/isstable
adaptfilt/maxstep
adaptfilt/msepred
adaptfilt/msesim
4-7
adaptfilt
Method
Description
adaptfilt/phasez
adaptfilt/reset
adaptfilt/stepz
adaptfilt/tf
adaptfilt/zerophase
adaptfilt/zpk
adaptfilt/zplane
4-8
adaptfilt
You must use single quotation marks around the property name so
MATLAB treats them as strings.
Copying an Object
To create a copy of an object, use copy.
ha2 = copy(ha)
Note Using the syntax ha2 = ha copies only the object handle and does
not create a new object ha and ha2 are not independent. When you
change the characteristics of ha2, those of ha change as well.
Examples
4-9
adaptfilt
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
mu = 0.008;
% Desired signal
% LMS step size.
ha = adaptfilt.lms(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
See Also
4-10
grid on;
adaptfilt.adjlms
Purpose
Syntax
ha = adaptfilt.adjlms(l,step,leakage,pathcoeffs,pathest,...
errstates,pstates,coeffs,states)
Description
ha = adaptfilt.adjlms(l,step,leakage,pathcoeffs,pathest,...
errstates,pstates,coeffs,states) constructs object ha, an FIR
adjoint LMS adaptive filter. l is the adaptive filter length (the number
of coefficients or taps) and must be a positive integer. l defaults to
10 when you omit the argument. step is the adjoint LMS step size.
It must be a nonnegative scalar. When you omit the step argument,
step defaults to 0.1.
leakage is the adjoint LMS leakage factor. It must be a scalar between
0 and 1. When leakage is less than one, you implement a leaky version
of the adjlms algorithm to determine the filter coefficients. leakage
a length equal to the filter order of the secondary path model estimate.
errstates defaults to a vector of zeros of appropriate length. pstates
4-11
adaptfilt.adjlms
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Properties
4-12
In the syntax for creating the adaptfilt object, the input options are
properties of the object created. This table lists the properties for the
adjoint LMS object, their default values, and a brief description of the
property.
Property
Default Value
Description
Algorithm
None
Coefficients
ErrorStates
[0,...,0]
FilterLength
10
Leakage
adaptfilt.adjlms
Property
Default Value
Description
SecondaryPathCoeffs
No default
SecondaryPathEstimate
pathcoeffs values
SecondaryPathStates
Length of the
secondary path filter.
All elements are
zeros.
States
l+ne+1, where ne is
length(errstates)
Stepsize
0.1
PersistentMemory
false or true
4-13
adaptfilt.adjlms
Examples
Demonstrate active noise control of a random noise signal that runs for
1000 samples.
x
= randn(1,1000);
% Noise source
= fir1(47,0.4);
= 0.1*randn(1,1000);
= filter(g,1,x)+n;
= fir1(31,0.5);
mu = 0.008;
ha = adaptfilt.adjlms(32,mu,1,b);
[y,e] = filter(ha,x,d);
plot(1:1000,d,'b',1:1000,e,'r');
title('Active Noise Control of a Random Noise Signal');
legend('Original','Attenuated');
xlabel('Time Index'); ylabel('Signal Value');
grid on;
Reviewing the figure shows that the adaptive filter attenuates the
original noise signal as you expect.
4-14
adaptfilt.adjlms
References
See Also
adaptfilt.dlms | adaptfilt.filtxlms
4-15
adaptfilt.ap
Purpose
Syntax
ha = adaptfilt.ap(l,step,projectord,offset,coeffs,states,...
errstates,epsstates)
Description
ha =
adaptfilt.ap(l,step,projectord,offset,coeffs,states,...
errstates,epsstates) constructs an affine projection FIR adaptive
filter ha using direct matrix inversion.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.ap.
Input
Argument
4-16
Description
step
projectord
offset
adaptfilt.ap
Input
Argument
Properties
Description
coeffs
states
errstates
epsstates
Range
Description
Algorithm
None
FilterLength
Any positive
integer
4-17
adaptfilt.ap
4-18
Name
Range
Description
ProjectionOrder
1 to as large
as needed.
OffsetCov
Matrix of
values
Coefficients
Vector of
elements
States
Vector of
elements,
data type
double
ErrorStates
Vector of
elements
EpsilonStates
Vector of
elements
adaptfilt.ap
Examples
Name
Range
Description
StepSize
Any scalar
from zero to
one, inclusive
= 16;
= exp(j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
% Number of iterations
= 0.1*(randn(1,ntr+D) + j*randn(1,ntr+D));
= filter(b,a,s)+n;
= r(1+D:ntr+D);
= s(1:ntr);
mu = 0.1;
% Noise signal
% Received signal
% Step size
po = 4;
% Projection order
offset = 0.05;
ha = adaptfilt.ap(32,mu,po,offset);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');
4-19
adaptfilt.ap
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.');
axis([-3 3 -3 3]); title('Received Signal Scatter Plot');
axis('square');
References
4-20
adaptfilt.ap
See Also
msesim
4-21
adaptfilt.apru
Purpose
Syntax
ha = adaptfilt.apru(l,step,projectord,offset,coeffs,states,
...errstates,epsstates)
Description
ha = adaptfilt.apru(l,step,projectord,offset,coeffs,states,
...errstates,epsstates) constructs an affine projection FIR adaptive
filter ha using recursive matrix updating.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.apru.
Input
Argument
4-22
Description
step
projectord
offset
adaptfilt.apru
Input
Argument
Properties
Description
coeffs
states
errstates
epsstates
Range
Description
Algorithm
None
FilterLength
Any positive
integer
4-23
adaptfilt.apru
4-24
Name
Range
Description
ProjectionOrder
1 to as large
as needed.
OffsetCov
Matrix of
values
Coefficients
Vector of
elements
States
Vector of
elements,
data type
double
ErrorStates
Vector of
elements
EpsilonStates
Vector of
elements
adaptfilt.apru
Examples
Name
Range
Description
StepSize
Any scalar
from zero to
one, inclusive
PersistentMemory
false or true
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
% Number of iterations
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= filter(b,a,s)+n;
= s(1:ntr);
% Noise signal
% Received signal
mu = 0.1;
% Step size
po = 4;
% Projection order
offset = 0.05;
% Offset
4-25
adaptfilt.apru
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot');
axis('square');
In the following component and scatter plots, you see the results of
QPSK equalization.
References
4-26
adaptfilt.apru
See Also
4-27
adaptfilt.bap
Purpose
Syntax
ha = adaptfilt.bap(l,step,projectord,offset,coeffs,states)
Description
ha = adaptfilt.bap(l,step,projectord,offset,coeffs,states)
constructs a block affine projection FIR adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.bap.
Input
Argument
4-28
Description
step
projectord
offset
adaptfilt.bap
Input
Argument
Properties
Description
coeffs
states
Range
Description
Algorithm
None
FilterLength
Any positive
integer
ProjectionOrder
1 to as large as
needed.
OffsetCov
Matrix of values
4-29
adaptfilt.bap
Examples
Range
Description
Coefficients
Vector of
elements
States
Vector of
elements, data
type double
StepSize
PersistentMemory
false or true
4-30
Name
= 16;
% delay
adaptfilt.bap
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
% Numerator coefficients
% Denominator coefficients
ntr= 1000;
% Number of iterations
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= filter(b,a,s)+n;
= r(1+D:ntr+D);
= s(1:ntr);
% Noise signal
% Received signal
% Input signal (received signal)
% Desired signal (delayed QPSK signal)
mu = 0.5;
% Step size
po = 4;
% Projection order
offset = 1.0;
ha = adaptfilt.bap(32,mu,po,offset);
[y,e] = filter(ha,x,d); subplot(2,2,1);
plot(1:ntr,real([d;y;e]));
title('In-Phase Components'); legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
Using the block affine projection object in QPSK results in the plots
shown here.
4-31
adaptfilt.bap
References
See Also
4-32
adaptfilt.blms
Purpose
Syntax
ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states)
Description
ha = adaptfilt.blms(l,step,leakage,blocklen,coeffs,states)
constructs an FIR block LMS adaptive filter ha, where l is the adaptive
and 1. If you set leakage to be less than one, you implement the leaky
block LMS algorithm. leakage defaults to 1 specifying no leakage in
the adapting algorithm.
blocklen is the block length used. It must be a positive integer and
the signal vectors d and x should be divisible by blocklen. Larger
Properties
In the syntax for creating the adaptfilt object, the input options are
properties of the object created. This table lists the properties for the
4-33
adaptfilt.blms
adjoint LMS object, their default values, and a brief description of the
property.
Property
Default
Value
Algorithm
None
FilterLength
Any
positive
integer
Coefficients
Vector of
elements
States
Vector of
elements
4-34
Leakage
BlockLength
Description
Vector of
length l
adaptfilt.blms
Property
Default
Value
StepSize
0.1
PersistentMemory false or
true
Examples
Description
Sets the block LMS algorithm step
size used for each iteration of the
adapting algorithm. Determines
both how quickly and how closely the
adaptive filter converges to the filter
solution. Use maxstep to determine
the maximum usable step size.
Determine whether the filter states
get restored to their starting values
for each filtering operation. The
starting values are the values in
place when you create the filter.
PersistentMemory returns to zero
any state that the filter changes
during processing. States that
the filter does not change are not
affected. Defaults to false.
4-35
adaptfilt.blms
4-36
References
See Also
adaptfilt.blmsfft
Purpose
Syntax
ha = adaptfilt.blmsfft(l,step,leakage,blocklen,coeffs,
states)
Description
ha = adaptfilt.blmsfft(l,step,leakage,blocklen,coeffs,
states) constructs an FIR block LMS adaptive filter object ha where
l is the adaptive filter length (the number of coefficients or taps) and
must be a positive integer. l defaults to 10. step is the block LMS
step size. It must be a nonnegative scalar. The function maxstep may
Properties
In the syntax for creating the adaptfilt object, the input options
are properties of the object you create. This table lists the properties
for the block LMS object, their default values, and a brief description
of the property.
4-37
adaptfilt.blmsfft
Property
Default
Value
Algorithm
None
FilterLength
Any
positive
integer
Coefficients
Vector of
elements
States
Vector of
elements
of length
Description
4-38
Leakage
BlockLength
Vector of
length l
adaptfilt.blmsfft
Examples
Property
Default
Value
StepSize
0.1
PersistentMemory
false or
true
Description
4-39
adaptfilt.blmsfft
ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('actual','estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');
4-40
References
See Also
adaptfilt.dlms
Purpose
Syntax
ha = adaptfilt.dlms(l,step,leakage,delay,errstates,coeffs,
...states)
Description
ha = adaptfilt.dlms(l,step,leakage,delay,errstates,coeffs,
...states) constructs an FIR delayed LMS adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.dlms.
Input
Argument
Description
step
leakage
delay
4-41
adaptfilt.dlms
Input
Argument
Properties
4-42
Description
errstates
coeffs
states
In the syntax for creating the adaptfilt object, the input options
are properties of the object you create. This table lists the properties
for the block LMS object, their default values, and a brief description
of the property.
Property
Default
Value
Algorithm
None
Coefficients
Vector of
elements
Description
adaptfilt.dlms
Property
Default
Value
Description
prior to adapting. You need l
entries in coeffs.
Delay
ErrorStates
Vector of
zeros with
the number
of elements
equal to
delay
FilterLength
Any positive
integer
Leakage
4-43
adaptfilt.dlms
Property
Default
Value
Description
PersistentMemory false or
true
Examples
StepSize
0.1
States
Vector of
elements,
data type
double
4-44
=
=
=
=
=
randn(1,500);
fir1(31,0.5);
0.1*randn(1,500);
filter(b,1,x)+n;
0.008;
%
%
%
%
%
adaptfilt.dlms
delay = 1;
% Update delay
ha = adaptfilt.dlms(32,mu,1,delay);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('Actual','Estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');
References
See Also
4-45
adaptfilt.fdaf
Purpose
FIR adaptive filter that uses frequency-domain with bin step size
normalization
Syntax
ha = adaptfilt.fdaf(l,step,leakage,delta,lambda,blocklen,
offset,...coeffs,states)
Description
ha = adaptfilt.fdaf(l,step,leakage,delta,lambda,blocklen,
offset,...coeffs,states) constructs a frequency-domain FIR
adaptive filter ha with bin step size normalization. If you omit all the
input arguments you create a default object with l = 10 and step = 1.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.fdaf.
Input
Argument
4-46
Description
step
leakage
delta
adaptfilt.fdaf
Input
Argument
Properties
Description
lambda
blocklen
offset
coeffs
states
4-47
adaptfilt.fdaf
Name
Range
Description
Algorithm
None
AvgFactor
(0, 1]
BlockLength
Any integer
FFTCoefficients
FFTStates
FilterLength
Leakage
4-48
Any
positive
integer
adaptfilt.fdaf
Name
Range
Description
Offset
Any
positive real
value
PersistentMemory
false or
true
Power
StepSize
Examples
Any scalar
from zero
to one,
inclusive
4-49
adaptfilt.fdaf
D = 16;
b
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1024;
= sign(randn(1,ntr+D))+1j*sign(randn(1,ntr+D));
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
%QPSK signal
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
% Noise signal
del = 1;
mu
% Step size
= 0.1;
lam = 0.9;
% Averaging factor
ha = adaptfilt.fdaf(32,mu,1,del,lam);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('signal value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e])); title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('signal value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
4-50
adaptfilt.fdaf
References
See Also
4-51
adaptfilt.filtxlms
Purpose
Syntax
ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,
pathest,...errstates,pstates,coeffs,states)
Description
ha = adaptfilt.filtxlms(l,step,leakage,pathcoeffs,
pathest,...errstates,pstates,coeffs,states) constructs an
filtered-x LMS adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.filtxlms.
Input
Argument
4-52
Description
step
leakage
pathcoeffs
pathest
adaptfilt.filtxlms
Input
Argument
Properties
Description
fstates
pstates
coeffs
states
In the syntax for creating the adaptfilt object, the input options are
properties of the object created. This table lists the properties for the
adjoint LMS object, their default values, and a brief description of the
property.
Property
Default
Value
Algorithm
None
Coefficients
Vector of
elements
Description
4-53
adaptfilt.filtxlms
Property
Default
Value
Description
provide the argument for
input.
FilteredInputStates
l-1
FilterLength
Any positive
integer
States
Vector of
elements
SecondaryPathCoeffs
No default
SecondaryPathEstimate pathcoeffs
values
4-54
An estimate of the
secondary path filter
model
adaptfilt.filtxlms
Default
Value
Property
Examples
Description
SecondaryPathStates
Vector of
size (length
(pathcoeffs)
-1) with all
elements
equal to zero.
StepSize
0.1
= randn(1,1000);
% Noise source
= fir1(47,0.4);
= 0.1*randn(1,1000);
= filter(g,1,x)+n;
% Signal to be cancelled
= fir1(31,0.5);
mu = 0.008;
ha = adaptfilt.filtxlms(32,mu,1,b);
[y,e] = filter(ha,x,d); plot(1:1000,d,'b',1:1000,e,'r');
title('Active Noise Control of a Random Noise Signal');
legend('Original','Attenuated');
xlabel('Time Index'); ylabel('Signal Value');
grid on;
4-55
adaptfilt.filtxlms
See also
adaptfilt.dlms, adaptfilt.lms
References
Kuo, S.M., and Morgan, D.R. Active Noise Control Systems: Algorithms
and DSP Implementations, New York, N.Y: John Wiley & Sons, 1996.
Widrow, B., and Stearns, S.D. Adaptive Signal Processing, Upper
Saddle River, N.J: Prentice Hall, 1985.
4-56
adaptfilt.ftf
Purpose
Syntax
ha = adaptfilt.ftf(l,lambda,delta,gamma,gstates,coeffs,
states)
Description
ha = adaptfilt.ftf(l,lambda,delta,gamma,gstates,coeffs,
states) constructs a fast transversal least squares adaptive filter
object ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.ftf.
Input
Argument
Description
lambda
delta
gamma
gstates
4-57
adaptfilt.ftf
Input
Argument
Properties
Description
coeffs
states
Range
Description
Algorithm
None
BkwdPrediction
Coefficients
4-58
Vector of
elements
adaptfilt.ftf
Name
Range
ConversionFactor
FilterLength
Description
Any
positive
integer
ForgettingFactor
FwdPrediction
InitFactor
Soft-constrained initialization
factor. This scalar should be
positive and sufficiently large
to prevent an excessive number
of Kalman gain rescues. delta
defaults to one.
KalmanGain
4-59
adaptfilt.ftf
Examples
Name
Range
Description
PersistentMemory
false or
true
States
Vector of
elements,
data type
double
= randn(1,500);
= fir1(31,0.5);
= 31;
lam = 0.99;
del = 0.1;
ha = adaptfilt.ftf(32,lam,del);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
4-60
adaptfilt.ftf
References
See Also
4-61
adaptfilt.gal
Purpose
Syntax
ha = adaptfilt.gal(l,step,leakage,offset,rstep,delta,
lambda,...rcoeffs,coeffs,states)
Description
ha = adaptfilt.gal(l,step,leakage,offset,rstep,delta,
lambda,...rcoeffs,coeffs,states) constructs a gradient adaptive
lattice FIR filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.gal.
Input
Argument
4-62
Description
step
leakage
adaptfilt.gal
Input
Argument
Properties
Description
offset
rstep
delta
lambda
rcoeffs
coeffs
states
4-63
adaptfilt.gal
the properties that apply, this table lists and describes each property
for the affine projection filter object.
Name
Range
Description
Algorithm
None
AvgFactor
BkwdPredErrorPower
Coefficients
FilterLength
Any
positive
integer
FwdPredErrorPower
4-64
adaptfilt.gal
Name
Range
Description
Leakage
0 to 1
Offset
PersistentMemory
ReflectionCoeffs
false or
true
4-65
adaptfilt.gal
Name
Range
ReflectionCoeffsStep
Examples
Description
States
StepSize
0 to 1
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
L = 32;
% filter length
mu = 0.007;
% Step size
ha = adaptfilt.gal(L,mu);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('signal value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
4-66
% Noise signal
adaptfilt.gal
subplot(2,2,3); plot(x(ntr-100:ntr),'.');
title('Received Signal Scatter Plot');
xlabel('Real[x]'); ylabel('Imag[x]');
axis([-3 3 -3 3]);
axis('square');
grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.');
axis([-3 3 -3 3]); title('Equalized Signal Scatter Plot');
axis('square'); xlabel('Real[y]'); ylabel('Imag[y]');
grid on;
References
See Also
4-67
adaptfilt.hrls
Purpose
Syntax
ha = adaptfilt.hrls(l,lambda,sqrtinvcov,coeffs,states)
Description
ha = adaptfilt.hrls(l,lambda,sqrtinvcov,coeffs,states)
constructs an FIR householder RLS adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.hrls.
Input
Argument
4-68
Description
lambda
sqrtinvcov
coeffs
states
adaptfilt.hrls
Properties
Range
Description
Algorithm
None
Coefficients
Vector of
elements
FilterLength
Any
positive
integer
ForgettingFactor
Scalar
KalmanGain
Vector of
size (l,1)
4-69
adaptfilt.hrls
Examples
Name
Range
Description
PersistentMemory
false or
true
SqrtInvCov
Matrix of
doubles
States
Vector of
elements,
data type
double
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
ha = adaptfilt.hrls(32,lam,G0);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
4-70
adaptfilt.hrls
See Also
4-71
adaptfilt.hswrls
Purpose
Syntax
ha = adaptfilt.hswrls(l,lambda,sqrtinvcov,swblocklen,
dstates,coeffs,states)
Description
ha = adaptfilt.hswrls(l,lambda,sqrtinvcov,swblocklen,
dstates,coeffs,states) constructs an FIR householder sliding
window recursive-least-square adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.hswrls.
Input
Argument
4-72
Description
lambda
sqrtinvcov
swblocklen
adaptfilt.hswrls
Input
Argument
Properties
Description
dstates
coeffs
states
Range
Description
Algorithm
None
Coefficients
Vector of
elements
4-73
adaptfilt.hswrls
4-74
Name
Range
Description
DesiredSignalStates
Vector
FilterLength
Any
positive
integer
ForgettingFactor
Scalar
Root-least-square (RLS)
forgetting factor. This is
a scalar and should lie in
the range (0, 1]. Same as
input argument lambda. It
defaults to 1 meaning the
adaptation process retains
infinite memory.
KalmanGain
(l,1) vector
PersistentMemory
false or
true
adaptfilt.hswrls
Name
Range
Description
SqrtInvCov
l-by-l
Matrix
Examples
States
Vector of
elements,
data type
double
SwBlockLength
Integer
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
% block length
= 64;
ha = adaptfilt.hswrls(32,lam,G0,N);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');
4-75
adaptfilt.hswrls
In the pair of plots shown in the figure you see the comparison of the
desired and actual output for the adapting filter and the coefficients of
both filters, the unknown and the adapted.
See Also
4-76
adaptfilt.lms
Purpose
Syntax
ha = adaptfilt.lms(l,step,leakage,coeffs,states)
Description
ha = adaptfilt.lms(l,step,leakage,coeffs,states) constructs an
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.lms.
Input
Argument
Description
step
leakage
4-77
adaptfilt.lms
Input
Argument
Properties
4-78
Description
coeffs
states
In the syntax for creating the adaptfilt object, the input options are
properties of the object created. This table lists the properties for the
adaptfilt.lms object, their default values, and a brief description of
the property.
Property
Range
Property Description
Algorithm
None
Coefficients
Vector of
elements
FilterLength
Any positive
integer
adaptfilt.lms
Examples
Property
Range
Property Description
Leakage
0 to 1
PersistentMemory
false or true
States
Vector of
elements,
data type
double
StepSize
0 to 1
= randn(1,500);
4-79
adaptfilt.lms
= fir1(31,0.5);
= filter(b,1,x)+n;
mu = 0.008;
ha = adaptfilt.lms(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;
4-80
adaptfilt.lms
References
See Also
4-81
adaptfilt.lsl
Purpose
Syntax
ha = adaptfilt.lsl(l,lambda,delta,coeffs,states)
Description
ha = adaptfilt.lsl(l,lambda,delta,coeffs,states) constructs a
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.lsl.
Input
Argument
4-82
Description
lambda
delta
coeffs
states
adaptfilt.lsl
Properties
Range
Description
Algorithm
None
BkwdPrediction
Coefficients
Vector of
elements
FilterLength
Any positive
integer
4-83
adaptfilt.lsl
Name
Range
Description
Forgetting factor of the
adaptive filter. This is
a scalar and should lie
in the range (0, 1]. It
defaults to 1. Setting
ForgettingFactor
forgetting factor = 1
denotes infinite memory
while adapting to find the
new filter. Note that this is
the lambda input argument.
FwdPrediction
InitFactor
Soft-constrained
initialization factor. This
scalar should be positive and
sufficiently large to prevent
an excessive number of
Kalman gain rescues. delta
defaults to one.
PersistentMemory
4-84
false or true
adaptfilt.lsl
Name
Range
Description
States that the filter does
not change are not affected.
Defaults to false.
States
Examples
Vector of
elements, data
type double
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
= sign(randn(1,ntr+D))+1j*sign(randn(1,ntr+D));
% QPSK signal
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
% Noise signal
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
lam = 0.995;
% Forgetting factor
del = 1;
% initialization factor
ha = adaptfilt.lsl(32,lam,del);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
4-85
adaptfilt.lsl
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.');
title('Received Signal Scatter Plot');
xlabel('Real[x]'); ylabel('Imag[x]');
grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.');
title('Equalized Signal Scatter Plot');
axis([-3 3 -3 3]);
axis('square');
axis([-3 3 -3 3]);
grid on;
4-86
References
Haykin, S., Adaptive Filter Theory, 2nd Edition, Prentice Hall, N.J.,
1991
See Also
adaptfilt.nlms
Purpose
Syntax
ha = adaptfilt.nlms(l,step,leakage,offset,coeffs,states)
Description
ha = adaptfilt.nlms(l,step,leakage,offset,coeffs,states)
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.nlms.
Input
Argument
Description
step
leakage
4-87
adaptfilt.nlms
Input
Argument
Properties
4-88
Description
offset
coeffs
states
In the syntax for creating the adaptfilt object, the input options are
properties of the object you create. This table lists the properties for
normalized LMS objects, their default values, and a brief description
of the property.
adaptfilt.nlms
Property
Range
Property Description
Algorithm
None
Coefficients
Vector of
elements
FilterLength
Any positive
integer
Leakage
0 to 1
Offset
0 or greater
4-89
adaptfilt.nlms
Property
Range
Examples
4-90
Property Description
Determine whether the filter
states and coefficients get
restored to their starting values
for each filtering operation. The
starting values are the values in
place when you create the filter.
PersistentMemory returns to
zero any property value that the
filter changes during processing.
Property values that the filter
does not change are not affected.
Defaults to false.
States
Vector of
elements,
data type
double
StepSize
0 to 1
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
mu = 1;
offset = 50;
% NLMS offset
adaptfilt.nlms
ha = adaptfilt.nlms(32,mu,1,offset);
[y,e] = filter(ha,x,d);
subplot(2,1,1);
plot(1:500,[d;y;e]);
legend('Desired','Output','Error');
title('System Identification of FIR Filter');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2);
stem([b', ha.coefficients']);
legend('Actual','Estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');
As you see from the figure, the nlms variant again closely matches the
actual filter coefficients in the unknown FIR filter.
See Also
4-91
adaptfilt.pbfdaf
Purpose
Syntax
ha = adaptfilt.pbfdaf(l,step,leakage,delta,lambda,blocklen,
offset,coeffs,states)
Description
ha = adaptfilt.pbfdaf(l,step,leakage,delta,lambda,blocklen,
offset,coeffs,states) constructs a partitioned block
frequency-domain FIR adaptive filter ha that uses bin step size
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.pbfdaf.
Input
Argument
4-92
Description
step
leakage
delta
adaptfilt.pbfdaf
Input
Argument
Properties
Description
lambda
blocklen
offset
coeffs
states
4-93
adaptfilt.pbfdaf
Name
Range
Description
Algorithm
None
AvgFactor
BlockLength
FilterLength
4-94
Any positive
integer
FFTCoefficients
FFTStates
adaptfilt.pbfdaf
Name
Range
Description
Leakage
0 to 1
Offset
PersistentMemory
false or
true
4-95
adaptfilt.pbfdaf
Name
Range
Power
StepSize
Examples
Description
0 to 1
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr = 1000;
% Number of iterations
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= filter(b,a,s)+n;
= r(1+D:ntr+D);
= s(1:ntr);
% Noise signal
% Received signal
% Input signal (received signal)
% Desired signal (delayed QPSK signal)
del = 1;
mu
% Step size
= 0.1;
lam = 0.9;
% Averaging factor
% Block size
= 8;
ha = adaptfilt.pbfdaf(32,mu,1,del,lam,N);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e])); title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
4-96
adaptfilt.pbfdaf
axis([-3 3 -3 3]);
xlabel('Real[x]'); ylabel('Imag[x]');
subplot(2,2,4); plot(y(ntr-100:ntr),'.');
grid on;
axis([-3 3 -3 3]);
grid on;
In the figure shown, the four subplots provide the details of the results
of the QPSK process used in the equalization for this example.
References
So, J.S. and K.K. Pang, Multidelay Block Frequency Domain Adaptive
Filter, IEEE Trans. Acoustics, Speech, and Signal Processing, vol. 38,
no. 2, pp. 373-376, February 1990
Paez Borrallo, J.M.and M.G. Otero, On The Implementation of a
Partitioned Block Frequency Domain Adaptive Filter (PBFDAF) For
Long Acoustic Echo Cancellation, Signal Processing, vol. 27, no. 3, pp.
301-315, June 1992
4-97
adaptfilt.pbfdaf
See Also
4-98
adaptfilt.pbufdaf
Purpose
Syntax
ha = adaptfilt.pbufdaf(l,step,leakage,delta,lambda,
blocklen,...offset,coeffs,states)
Description
ha = adaptfilt.pbufdaf(l,step,leakage,delta,lambda,
blocklen,...offset,coeffs,states) constructs a partitioned block
unconstrained frequency-domain FIR adaptive filter ha with bin step
size normalization.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.pbufdaf.
Input
Argument
Description
step
leakage
delta
4-99
adaptfilt.pbufdaf
Input
Argument
Properties
4-100
Description
lambda
blocklen
offset
coeffs
states
adaptfilt.pbufdaf
Name
Range
Description
Algorithm
None
AvgFactor
BlockLength
FilterLength
Any positive
integer
FFTCoefficients
FFTStates
4-101
adaptfilt.pbufdaf
Name
Range
Description
Leakage
0 to 1
Offset
PersistentMemory
4-102
false or
true
adaptfilt.pbufdaf
Examples
Name
Range
Description
Power
2*l element
vector
StepSize
0 to 1
= 16;
= [1 -0.7];
ntr= 1000;
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
del = 1;
mu
% Step size
= 0.1;
lam = 0.9;
% Averaging factor
% Block size
= 8;
ha = adaptfilt.pbufdaf(32,mu,1,del,lam,N);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components'); legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
4-103
adaptfilt.pbufdaf
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
You can compare this algorithm to another, such as the pbfdaf version.
Use the same example of QPSK adaptation. The following figure shows
the results.
References
So, J.S. and K.K. Pang, Multidelay Block Frequency Domain Adaptive
Filter, IEEE Trans. Acoustics, Speech, and Signal Processing, vol. 38,
no. 2, pp. 373-376, February 1990
Paez Borrallo, J.M. and M.G. Otero, On The Implementation of a
Partitioned Block Frequency Domain Adaptive Filter (PBFDAF) for
Long Acoustic Echo Cancellation, Signal Processing, vol. 27, no. 3, pp.
301-315, June 1992
4-104
adaptfilt.pbufdaf
See Also
4-105
adaptfilt.qrdlsl
Purpose
Syntax
ha = adaptfilt.qrdlsl(l,lambda,delta,coeffs,states)
Description
ha = adaptfilt.qrdlsl(l,lambda,delta,coeffs,states) returns a
QR-decomposition-based least squares lattice adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.qrdlsl.
Input
Argument
4-106
Description
lambda
delta
coeffs
states
adaptfilt.qrdlsl
Properties
Range
Description
Algorithm
None
BkwdPrediction
Coefficients
Vector of
elements
FilterLength
Any
positive
integer
ForgettingFactor
4-107
adaptfilt.qrdlsl
Name
Examples
4-108
Range
Description
FwdPrediction
InitFactor
Soft-constrained initialization
factor. This scalar should be
positive and sufficiently large
to prevent an excessive number
of Kalman gain rescues. delta
defaults to one.
PersistentMemory
false or
true
States
Vector of
elements,
data type
double
adaptfilt.qrdlsl
the equalization process in this example, look at the figure that follows
the example code.
D
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
= sign(randn(1,ntr+D))+1j*sign(randn(1,ntr+D)); % Baseband
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
QPSK signal
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
% Noise signal
lam = 0.995;
% Forgetting factor
del = 1;
ha = adaptfilt.qrdlsl(32,lam,del);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components'); legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components'); legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
4-109
adaptfilt.qrdlsl
References
See Also
4-110
adaptfilt.qrdrls
Purpose
Syntax
ha = adaptfilt.qrdrls(l,lambda,sqrtcov,coeffs,states)
Description
ha = adaptfilt.qrdrls(l,lambda,sqrtcov,coeffs,states)
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.qrdrls.
Input
Argument
Properties
Description
lambda
sqrtcov
coeffs
states
4-111
adaptfilt.qrdrls
show you the properties that apply, this table lists and describes each
property for the filter object.
Name
Range
Description
Algorithm
None
Coefficients
Vector of length
4-112
FilterLength
Any positive
integer
ForgettingFactor
Scalar
adaptfilt.qrdrls
Examples
Name
Range
Description
PersistentMemory
false or true
SqrtCov
Square matrix
with each
dimension equal
to the filter
length l
Upper-triangular Cholesky
(square root) factor of the
input covariance matrix.
Initialize this matrix with
a positive definite upper
triangular matrix.
States
Vector of
elements
= randn(1,500);
= fir1(31,0.5);
= 0.1*randn(1,500);
= filter(b,1,x)+n;
G0 = sqrt(.1)*eye(32);
% Desired signal
% Initial sqrt correlation matrix
4-113
adaptfilt.qrdrls
lam = 0.99;
ha = adaptfilt.qrdrls(32,lam,G0);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated'); grid on;
xlabel('Coefficient #'); ylabel('Coefficient Value');
See Also
4-114
adaptfilt.rls
Purpose
Syntax
ha = adaptfilt.rls(l,lambda,invcov,coeffs,states)
Description
ha = adaptfilt.rls(l,lambda,invcov,coeffs,states) constructs
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.rls.
Input
Argument
Properties
Description
lambda
invcov
coeffs
states
4-115
adaptfilt.rls
Range
Description
Algorithm
None
Coefficients
Vector
containing
l elements
FilterLength
Any
positive
integer
ForgettingFactor Scalar
InvCov
4-116
Matrix of
size l-by-l
adaptfilt.rls
Name
Range
Description
KalmanGain
Vector of
size (l,1)
PersistentMemory false or
true
States
Double
array
Examples
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
ha = adaptfilt.rls(32,lam,P0);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
4-117
adaptfilt.rls
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient valUe');
grid on;
See Also
4-118
adaptfilt.sd
Purpose
Syntax
ha = adaptfilt.sd(l,step,leakage,coeffs,states)
Description
ha = adaptfilt.sd(l,step,leakage,coeffs,states) constructs an
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.sd.
Input
Argument
Description
step
leakage
coeffs
states
4-119
adaptfilt.sd
Properties
4-120
In the syntax for creating the adaptfilt object, the input options are
properties of the object you create. This table lists the properties for
sign-data objects, their default values, and a brief description of the
property.
Property
Default
Value
Al gorithm
Sign-data
Coefficients
zeros(1,l)
FilterLength
10
Leakage
Description
adaptfilt.sd
Examples
Property
Default
Value
PersistentMemory
false or true
States
zeros(l-1,1)
StepSize
0.1
Description
= 1;
ntr= 5000;
% Number of iterations
= sin(2*pi*0.05*[1:ntr+d]);
% Sinusoidal signal
= randn(1,ntr+d);
% Noise signal
4-121
adaptfilt.sd
= v(1:ntr)+n(1:ntr);
mu = 0.0001;
% Input signal
% Sign-data step size.
ha = adaptfilt.sd(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:ntr,[d;y;v(1:end-1)]);
axis([ntr-100 ntr -3 3]);
title('Adaptive Line Enhancement of a Noisy Sinusoidal Signal');
legend('Observed','Enhanced','Original');
xlabel('Time Index'); ylabel('Signal Value');
[pxx,om] = pwelch(x(ntr-1000:ntr));
pyy = pwelch(y(ntr-1000:ntr));
subplot(2,1,2);
plot(om/pi,10*log10([pxx/max(pxx),pyy/max(pyy)]));
axis([0 1 -60 20]); legend('Observed','Enhanced');
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Power Spectral Density'); grid on;
4-122
adaptfilt.sd
References
Moschner, J.L., Adaptive Filter with Clipped Input Data, Ph.D. thesis,
Stanford Univ., Stanford, CA, June 1970.
Hayes, M., Statistical Digital Signal Processing and Modeling, New
York Wiley, 1996.
See Also
4-123
adaptfilt.se
Purpose
Syntax
ha = adaptfilt.se(l,step,leakage,coeffs,states)
Description
ha = adaptfilt.se(l,step,leakage,coeffs,states) constructs an
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.se.
Input
Argument
4-124
Description
step
leakage
adaptfilt.se
Input
Argument
Properties
Description
coeffs
states
In the syntax for creating the adaptfilt object, the input options are
properties of the object you create. This table lists the properties for
the sign-error SD object, their default values, and a brief description
of the property.
Property
Default
Value
Algorithm
Sign-error
Coefficients
zeros(1,l)
FilterLength
10
Description
4-125
adaptfilt.se
4-126
Property
Default
Value
Leakage
PersistentMemory
false or true
States
zeros(l-1,1)
StepSize
0.1
Description
adaptfilt.se
Examples
ntr= 5000;
% Number of iterations
v = sin(2*pi*0.05*(1:ntr+d));
% Sinusoidal signal
n = randn(1,ntr+d);
% Noise signal
x = v(1:ntr)+n(1:ntr);
d = v(1+d:ntr+d)+n(1+d:ntr+d);
% Desired signal
mu = 0.0001;
ha = adaptfilt.se(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1);
plot(1:ntr,[d;y;v(1:end-1)]);
axis([ntr-100 ntr -3 3]);
title('Adaptive Line Enhancement of Noisy Sinusoid');
legend('Observed','Enhanced','Original');
xlabel('Time Index'); ylabel('Signal Value');
HWelch = spectrum.welch;
InputPsd = psd(HWelch,x(ntr-1000:ntr));
OutputPsd = psd(HWelch,y(ntr-1000:ntr));
CompPsdEst = [InputPsd.Data/max(InputPsd.Data), OutputPsd.Data/max(OutputPsd.Data)];
subplot(2,1,2); plot(InputPsd.Frequencies/pi,10*log10(CompPsdEst));
axis([0 1 -60 20]); legend('Observed','Enhanced');
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Power Spectral Density'); grid on;
Compare the figure shown here to the ones for adaptfilt.sd and
adaptfilt.ss to see how the variants perform on the same example.
4-127
adaptfilt.se
References
See Also
4-128
adaptfilt.ss
Purpose
Syntax
ha = adaptfilt.ss(l,step,leakage,coeffs,states)
Description
ha = adaptfilt.ss(l,step,leakage,coeffs,states) constructs an
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.ss.
Input
Argument
Description
step
leakage
coeffs
states
4-129
adaptfilt.ss
adaptfilt.ss can be called for a block of data, when x and d are vectors,
or in sample by sample mode using a For-loop with the method filter:
for n = 1:length(x)
ha = adaptfilt.ss(25,0.9);
[y(n),e(n)] = filter(ha,(x(n),d(n),s));
end
Properties
4-130
In the syntax for creating the adaptfilt object, most of the input
options are properties of the object you create. This table lists the
properties for sign-sign objects, their default values, and a brief
description of the property.
Property
Default
Value
Algorithm
Sign-sign
Coefficients
zeros(1,l)
FilterLength
10
Description
adaptfilt.ss
Property
Default
Value
Leakage
PersistentMemory
false or true
States
zeros(l-1,1)
StepSize
0.1
Description
4-131
adaptfilt.ss
Examples
ntr= 5000;
% Number of iterations
v = sin(2*pi*0.05*(1:ntr+d));
% Sinusoidal signal
n = randn(1,ntr+d);
% Noise signal
x = v(1:ntr)+n(1:ntr);
d = v(1+d:ntr+d)+n(1+d:ntr+d);
% Desired signal
mu = 0.0001;
ha = adaptfilt.ss(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1);
plot(1:ntr,[d;y;v(1:end-1)]);
axis([ntr-100 ntr -3 3]);
title('Adaptive Line Enhancement of Noisy Sinusoid');
legend('Observed','Enhanced','Original');
xlabel('Time Index'); ylabel('Signal Value');
[InputPsd,wi] = pwelch(x(ntr-1000:ntr));
[OutputPsd,wo] = pwelch(y(ntr-1000:ntr));
CompPsdEst = [InputPsd/max(InputPsd), OutputPsd/max(OutputPsd)];
subplot(2,1,2); plot(wi/pi,10*log10(CompPsdEst));
axis([0 1 -60 20]); legend('Observed','Enhanced');
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Power Spectral Density'); grid on;
This example is the same as the ones used for the sign-data and
sign-error examples. Comparing the figures shown for each of the
others lets you assess the performance of each for the same task.
4-132
adaptfilt.ss
References
See Also
4-133
adaptfilt.swftf
Purpose
FIR adaptive filter that uses sliding window fast transversal least
squares
Syntax
ha = adaptfilt.swftf(l,delta,blocklen,gamma,gstates,
dstates,...coeffs,states)
Description
ha = adaptfilt.swftf(l,delta,blocklen,gamma,gstates,
dstates,...coeffs,states) constructs a sliding window fast
transversal least squares adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.swftf.
Input
Argument
4-134
Description
delta
blocklen
gamma
gstates
adaptfilt.swftf
Input
Argument
Properties
Description
dstates
coeffs
states
Range
Description
Algorithm
None
BkwdPredictions
BlockLength
4-135
adaptfilt.swftf
Name
Range
Description
Coefficients
Vector of
elements
ConversionFactor
DesiredSignal
States
FilterLength
4-136
Any
positive
integer
FwdPrediction
InitFactor
Soft-constrained initialization
factor. This scalar should be
positive and sufficiently large
to prevent an excessive number
of Kalman gain rescues. delta
defaults to one.
adaptfilt.swftf
Name
Examples
Range
Description
KalmanGain
KalmanGainStates
PersistentMemory
false or
true
States
Vector of
elements,
data type
double
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
= 32;
4-137
adaptfilt.swftf
del = 0.1;
% block length
= 64;
ha = adaptfilt.swftf(L,del,N);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;
Review the figure for the results of the example. When you evaluate
the example you should get the same results, within the differences in
the random noise signal you use.
References
4-138
adaptfilt.swftf
See Also
4-139
adaptfilt.swrls
Purpose
FIR adaptive filter that uses window recursive least squares (RLS)
Syntax
ha = adaptfilt.swrls(l,lambda,invcov,swblocklen,
dstates,...coeffs,states)
Description
ha = adaptfilt.swrls(l,lambda,invcov,swblocklen,
dstates,...coeffs,states) constructs an FIR sliding window RLS
adaptive filter ha.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.swrls.
Input
Argument
4-140
Description
lambda
invcov
swblocklen
dstates
adaptfilt.swrls
Input
Argument
Properties
Description
coeffs
states
Range
Description
Algorithm
None
Coefficients
Any vector of
l elements
DesiredSignalStates
Vector
4-141
adaptfilt.swrls
4-142
Name
Range
Description
FilterLength
Any positive
integer
ForgettingFactor
Scalar
InvCov
Matrix
KalmanGain
Vector with
dimensions
(l,1)
PersistentMemory
false or
true
adaptfilt.swrls
Examples
Name
Range
Description
States
Vector of
elements,
data type
double
SwBlockLength
Integer
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
% Desired signal
P0 = 10*eye(32);
lam = 0.99;
% Block length
= 64;
ha = adaptfilt.swrls(32,lam,P0,N);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.Coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;
In the figure you see clearly that the adaptive filter process successfully
identified the coefficients of the unknown FIR filter. You knew it
4-143
adaptfilt.swrls
had to or many things that you take for granted, such as modems on
computers, would not work.
See Also
4-144
adaptfilt.tdafdct
Purpose
Syntax
ha = adaptfilt.tdafdct(l,step,leakage,offset,delta,lambda,
coeffs,states)
Description
ha = adaptfilt.tdafdct(l,step,leakage,offset,delta,lambda,
coeffs,states) constructs a transform-domain adaptive filter ha object
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.tdafdct.
Input
Argument
Description
step
leakage
4-145
adaptfilt.tdafdct
Input
Argument
Properties
4-146
Description
offset
delta
lambda
coeffs
states
adaptfilt.tdafdct
Name
Range
Description
Algorithm
None
AvgFactor
Coefficients
Vector of
elements
FilterLength
Any positive
integer
Leakage
0 to 1
4-147
adaptfilt.tdafdct
Name
Description
Offset
Power
4-148
Range
2*l element
vector
adaptfilt.tdafdct
Name
Range
Description
States
Vector of
elements, data
type double
StepSize
0 to 1
For checking the values of properties for an adaptive filter object, use
get(ha) or enter the object name, without a trailing semicolon, at the
MATLAB prompt.
Examples
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
= 32;
mu = 0.01;
% filter length
% Step size
ha = adaptfilt.tdafdct(L,mu);
[y,e] = filter(ha,x,d);
subplot(2,2,1);
plot(1:ntr,real([d;y;e])); title('In-Phase Components');
4-149
adaptfilt.tdafdct
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.');
axis([-3 3 -3 3]); title('Received Signal Scatter Plot');
axis('square');
Compare the plots shown in this figure to those in the other time
domain filter variations. The comparison should help you select and
understand how the variants differ.
References
4-150
adaptfilt.tdafdct
See Also
4-151
adaptfilt.tdafdft
Purpose
Syntax
ha = adaptfilt.tdafdft(l,step,leakage,offset,
delta,lambda,...coeffs,states)
Description
ha = adaptfilt.tdafdft(l,step,leakage,offset,
delta,lambda,...coeffs,states) constructs a transform-domain
adaptive filter object ha using a discrete Fourier transform.
For information on how to run data through your adaptive filter object,
see the Adaptive Filter Syntaxes section of the reference page for
filter.
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.tdafdft.
Input
Argument
4-152
Description
step
leakage
adaptfilt.tdafdft
Input
Argument
Properties
Description
offset
delta
lambda
coeffs
states
4-153
adaptfilt.tdafdft
Name
Range
Description
Algorithm
None
AvgFactor
4-154
Coefficients
Vector of
elements
FilterLength
Any positive
integer
Leakage
0 to 1
adaptfilt.tdafdft
Name
Range
Description
Offset for the normalization
terms in the coefficient updates.
You can use this argument to
avoid dividing by zeros or by
very small numbers when any
of the FFT input signal powers
become very small. offset
defaults to zero.
Offset
PersistentMemory
false or true
Power
2*l element
vector
States
Vector of
elements,
data type
double
StepSize
0 to 1
4-155
adaptfilt.tdafdft
Examples
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1000;
% Number of iterations
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= filter(b,a,s)+n;
% Received signal
= r(1+D:ntr+D);
= s(1:ntr);
= 32;
% Noise signal
mu = 0.01;
% Step size
ha = adaptfilt.tdafdft(L,mu);
[y,e] = filter(ha,x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.');
axis([-3 3 -3 3]); title('Received Signal Scatter Plot');
axis('square');
subplot(2,2,4); plot(y(ntr-100:ntr),'.');
axis([-3 3 -3 3]); title('Equalized Signal Scatter Plot');
axis('square'); xlabel('Real[y]'); ylabel('Imag[y]'); grid on;
All of the time domain adaptive filter reference pages use this QPSK
example. By comparing the results for each variation you get an idea of
the differences in the way each one performs.
This figure demonstrates the results of running the example code
shown.
4-156
adaptfilt.tdafdft
References
Haykin, S.,Adaptive Filter Theory, 3rd Edition, Prentice Hall, N.J., 1996
See Also
4-157
adaptfilt.ufdaf
Purpose
Syntax
ha = adaptfilt.ufdaf(l,step,leakage,delta,lambda,blocklen,
offset,coeffs,states)
Description
ha = adaptfilt.ufdaf(l,step,leakage,delta,lambda,blocklen,
offset,coeffs,states)
Input Arguments
Entries in the following table describe the input arguments for
adaptfilt.ufdaf.
Input
Argument
4-158
Description
step
leakage
delta
adaptfilt.ufdaf
Input
Argument
Properties
Description
lambda
blocklen
offset
coeffs
states
4-159
adaptfilt.ufdaf
Name
Range
Description
Algorithm
None
AvgFactor
BlockLength
FFTCoefficients
FFTStates
FilterLength
4-160
Any positive
integer
adaptfilt.ufdaf
Name
Range
Description
Leakage
0 to 1
Offset
PersistentMemory
false or true
4-161
adaptfilt.ufdaf
Examples
Name
Range
Description
Power
2*l element
vector
StepSize
0 to 1
= 16;
= exp(1j*pi/4)*[-0.7 1];
= [1 -0.7];
ntr= 1024;
% Number of iterations
= 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D));
= r(1+D:ntr+D);
= s(1:ntr);
del = 1;
mu
= 0.1;
lam = 0.9;
ha = adaptfilt.ufdaf(32,mu,1,del,lam);
[y,e] = filter(ha,x,d);
subplot(2,2,1);
4-162
plot(1:1000,real([d(1:1000);y(1:1000);e(1:1000)]));
adaptfilt.ufdaf
References
See Also
4-163
allpass2wdf
Purpose
Syntax
w = allpass2wdf(a)
W = allpass2wdf(A)
Description
Input
Arguments
Data Types
double | single
A - allpass filter coefficients
4-164
allpass2wdf
4, the first and third components must both be zero. A can be a row
or column vector of cells.
Example: {0.7, [0.1, 0.2]}
Data Types
double | single
Output
Arguments
Examples
Allpass coefficients
This example illustrates the use of allpass2wdf to enable Wave Digital
Filter as Structure of dsp.AllpassFilter.
% Original 2nd order allpass coefficients
a = [0 0.5];
smm = dsp.AllpassFilter('AllpassCoefficients', a);
4-165
allpass2wdf
Algorithms
a a1
represents the first order transfer function:
H1 ( z)
z1 a1
1 a1 z1
a a1 , a2
represents the second order transfer function:
H2 ( z)
z2 a1 z1 a2
1 a1 z1 a2 z2
.
The allpass transfer functions H1 and H2 can also have the following
alternative representations, using decoupled coefficients in vector w1 or
w2 respectively.
4-166
allpass2wdf
H 1 ( z)
H 2 ( z)
z1 w1
1 w1 z1
z2 w2 (1 w1 ) z1 w1
1 w2 (1 w1 ) z1 w1 z2
H i ( z) Hi ( z)
This results in using the following formulas:
for order 1 :
w1 a1
for order 2 :
w1 a2
w2
a1
1 a2
for order 4 :
w1 a4
w3
a2
1 a4
w2 w4 0
4-167
allpass2wdf
References
[1] M. Lutovac, D. Tosic, B. Evans, Filter Design for Signal Processing
using MATLAB and Mathematica. Prentice Hall, 2001.
See Also
4-168
allpassbpc2bpc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpassbpc2bpc(Wo,Wt)
Description
Examples
4-169
allpassbpc2bpc
Arguments
4-170
Variable
Description
Wo
Wt
allpassbpc2bpc
Variable
Description
AllpassNum
AllpassDen
See Also
iirbpc2bpc | zpkbpc2bpc
4-171
allpasslp2bp
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2bp(Wo,Wt)
Description
Examples
Design the allpass mapping filter changing the lowpass filter with
cutoff frequency at Wo=0.5 to the realvalued bandpass filter with cutoff
frequencies at Wt10.25 and Wt2=0.375.
Compute the frequency response and plot the phase response
normalized to , which is in effect the mapping function Wo(Wt). Please
note that the transformation works in the same way for both positive
and negative frequencies:
4-172
allpasslp2bp
0.9
0.8
Old Frequency, Wo
0.7
0.6
0.5
0.4
0.3
0.2
0.1
Arguments
0.2
0.4
0.6
0.8
1
1.2
New Frequency, Wt
1.4
1.6
1.8
Variable
Description
Wo
Wt
4-173
allpasslp2bp
Variable
Description
AllpassNum
AllpassDen
References
See Also
4-174
iirlp2bp | zpklp2bp
allpasslp2bpc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2bpc(Wo,Wt)
Description
Examples
Design the allpass mapping filter changing the real lowpass filter with
the cutoff frequency of Wo=0.5 into a complex bandpass filter with band
edges of Wt1=0.2 and Wt2=0.4 precisely defined. Calculate the frequency
response of the mapping filter in the full range:
Wo = 0.5; Wt = [0.2,0.4];
[AllpassNum, AllpassDen] = allpasslp2bpc(Wo, Wt);
4-175
allpasslp2bpc
Arguments
See Also
4-176
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
iirlp2bpc | zpklp2bpc
allpasslp2bs
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2bs(Wo,Wt)
Description
Examples
Design the allpass filter changing the lowpass filter with cutoff
frequency at Wo=0.5 to the real bandstop filter with cutoff frequencies
at Wt1=0.25 and Wt2=0.375:
Wo = 0.5; Wt = [0.25, 0.375];
[AllpassNum, AllpassDen] = allpasslp2bs(Wo, Wt);
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
plot(f/pi, abs(angle(h))/pi, Wt, Wo, 'ro');
title('Mapping Function Wo(Wt)');
xlabel('New Frequency, Wt'); ylabel('Old Frequency, Wo');
4-177
allpasslp2bs
In the figure, you find the mapping filter function as determined by the
example. Note the response is normalized to :
Mapping Function Wo(Wt)
1
0.9
0.8
Old Frequency, Wo
0.7
0.6
0.5
0.4
0.3
0.2
0.1
Arguments
4-178
0.2
0.4
0.6
0.8
1
1.2
New Frequency, Wt
1.4
1.6
1.8
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
allpasslp2bs
References
See Also
iirlp2bs | zpklp2bs
4-179
allpasslp2bsc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2bsc(Wo,Wt)
Description
Examples
Design the allpass filter changing the real lowpass filter with the cutoff
frequency of Wo=0.5 into a complex bandstop filter with band edges of
Wt1=0.2 and Wt2=0.4 precisely defined:
Wo = 0.5; Wt = [0.2,0.4];
4-180
allpasslp2bsc
Arguments
See Also
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
iirlp2bsc | zpklp2bsc
4-181
allpasslp2hp
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2hp(Wo,Wt)
Description
Examples
Design the allpass filter changing the lowpass filter to the highpass
filter with its cutoff frequency moved from Wo=0.5 to Wt=0.25.
Plot the phase response normalized to , which is in effect the mapping
function Wo(Wt). Please note that the transformation works in the same
way for both positive and negative frequencies:
Wo = 0.5; Wt = 0.25;
[AllpassNum, AllpassDen] = allpasslp2hp(Wo, Wt);
4-182
allpasslp2hp
Arguments
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
References
See Also
iirlp2hp | zpklp2hp
4-183
allpasslp2lp
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2lp(Wo,Wt)
Description
Examples
Design the allpass filter changing the lowpass filter cutoff frequency
originally at Wo=0.5 to Wt=0.25. Plot the phase response normalized to
, which is in effect the mapping function Wo(Wt). Please note that the
transformation works in the same way for both positive and negative
frequencies:
Wo = 0.5; Wt = 0.25;
[AllpassNum, AllpassDen] = allpasslp2lp(Wo, Wt);
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
plot(f/pi, abs(angle(h))/pi, Wt, Wo, 'ro');
title('Mapping Function Wo(Wt)');
4-184
allpasslp2lp
0.9
0.8
Old Frequency, Wo
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.2
0.4
0.6
0.8
1
1.2
New Frequency, Wt
1.4
1.6
1.8
Arguments
Variable
Description
Wo
Wt
4-185
allpasslp2lp
Variable
Description
AllpassNum
AllpassDen
References
See Also
4-186
iirlp2lp | zpklp2lp
allpasslp2mb
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2mb(Wo,Wt)
[AllpassNum,AllpassDen] = allpasslp2mb(Wo,Wt,Pass)
Description
4-187
allpasslp2mb
Examples
Design the allpass filter changing the real lowpass filter with the cutoff
frequency of Wo=0.5 into a real multiband filter with band edges of
Wt=[1:2:9]/10 precisely defined. Plot the phase response normalized to
, which is in effect the mapping function Wo(Wt). Please note that the
transformation works in the same way for both positive and negative
frequencies:
Wo = 0.5; Wt = [1:2:9]/10;
[AllpassNum, AllpassDen] = allpasslp2mb(Wo, Wt);
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
plot(f/pi, abs(angle(h))/pi, Wt, Wo, 'ro');
title('Mapping Function Wo(Wt)');
xlabel('New Frequency, Wt'); ylabel('Old Frequency, Wo');
Mapping Function Wo(Wt)
1
0.9
0.8
Old Frequency, Wo
0.7
0.6
0.5
0.4
0.3
0.2
0.1
4-188
0.2
0.4
0.6
0.8
1
1.2
New Frequency, Wt
1.4
1.6
1.8
allpasslp2mb
Arguments
Variable
Description
Wo
Wt
Pass
AllpassNum
AllpassDen
References
See Also
iirlp2mb | zpklp2mb
4-189
allpasslp2mbc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2mbc(Wo,Wt)
Description
Examples
Design the allpass filter changing the real lowpass filter with the cutoff
frequency of Wo=0.5 into a complex multiband filter with band edges of
Wt=[-3+1:2:9]/10 precisely defined:
Wo = 0.5; Wt = [-3+1:2:9]/10;
[AllpassNum, AllpassDen] = allpasslp2mbc(Wo, Wt);
Calculate the frequency response of the mapping filter in the full range:
4-190
allpasslp2mbc
0.8
0.6
Old Frequency, Wo
0.4
0.2
0.2
0.4
0.6
0.8
1
0.5
0.5
1
New Frequency, Wt
1.5
4-191
allpasslp2mbc
Arguments
See Also
4-192
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
iirlp2mbc | zpklp2mbc
allpasslp2xc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2xc(Wo,Wt)
Description
Examples
4-193
allpasslp2xc
Arguments
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
See Also
4-194
iirlp2xc | zpklp2xc
allpasslp2xn
Purpose
Syntax
[AllpassNum,AllpassDen] = allpasslp2xn(Wo,Wt)
[AllpassNum,AllpassDen] = allpasslp2xn(Wo,Wt,Pass)
Description
4-195
allpasslp2xn
Arguments
Variable
Description
Wo
Wt
Pass
AllpassNum
AllpassDen
References
See Also
4-196
iirlp2xn | zpklp2xn
allpassrateup
Purpose
Syntax
[AllpassNum,AllpassDen] = allpassrateup(N)
Description
frequency response.
Relative positions of other features of an original filter do not change in
the target filter. This means that it is possible to select two features of
an original filter, F1 and F2, with F1 preceding F2. Feature F1 will still
precede F2 after the transformation. However, the distance between F1
and F2 will not be the same before and after the transformation.
Examples
Design the allpass filter creating the effect of upsampling the digital
filter four times:
Choose any feature from an original filter, say at Wo=0.2:
N = 4;
Wo = 0.2; Wt = Wo/N + 2*[0:N-1]/N;
[AllpassNum, AllpassDen] = allpassrateup(N);
Calculate the frequency response of the mapping filter in the full range:
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
Arguments
See Also
Variable
Description
AllpassNum
AllpassDen
iirrateup | zpkrateup
4-197
allpassshift
Purpose
Syntax
[AllpassNum,AllpassDen] = allpassshift(Wo,Wt)
Description
Examples
Design the allpass filter precisely shifting one feature of the lowpass
filter originally at Wo=0.5 to the new frequencies of Wt=0.25:
Wo = 0.5; Wt = 0.25;
[AllpassNum, AllpassDen] = allpassshift(Wo, Wt);
Calculate the frequency response of the mapping filter in the full range:
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
4-198
allpassshift
0.9
0.8
Old Frequency, Wo
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.2
0.4
0.6
0.8
1
1.2
New Frequency, Wt
1.4
1.6
1.8
4-199
allpassshift
Arguments
Variable
Description
Wo
Wt
AllpassNum
AllpassDen
See Also
4-200
iirshift | zpkshift
allpassshiftc
Purpose
Syntax
[AllpassNum,AllpassDen] = allpassshiftc(Wo,Wt)
[AllpassNum,AllpassDen] = allpassshiftc(0,0.5)
[AllpassNum,AllpassDen] = allpassshiftc(0,-0.5)
Description
Examples
Design the allpass filter precisely rotating the whole filter by the
amount defined by the location of the selected feature from an original
filter, Wo=0.5, and its required position in the target filter, Wt=0.25:
Wo = 0.5; Wt = 0.25;
[AllpassNum, AllpassDen] = allpassshiftc(Wo, Wt);
Calculate the frequency response of the mapping filter in the full range:
[h, f] = freqz(AllpassNum, AllpassDen, 'whole');
Arguments
Variable
Description
Wo
Wt
4-201
allpassshiftc
Variable
Description
AllpassNum
AllpassDen
References
See Also
4-202
iirshiftc | zpkshiftc
autoscale
Purpose
Syntax
autoscale(hd,x)
hnew = autoscale(hd,x)
Description
obtained from that simulation at each filter node to set fraction lengths
to cover the simulation full range and maximize the precision. Word
lengths are not changed during autoscaling.
hnew = autoscale(hd,x) If you request an output, autoscale returns
a new filter with the scaled fraction lengths. The original filter is not
changed.
Examples
4-203
autoscale
See Also
4-204
qreport
block
Purpose
Syntax
block(hm)
block(hm,'propertyname1',propertyvalue1,'propertyname2',
propertyvalue2,...)
Description
Property Values
Destination
'current'
(default), 'new',
or Subsystemname.
4-205
block
Property
Name
OverwriteBlock
'off' (default), or
'on'.
'off' (default), or
'on'.
Link2Obj
4-206
Property Values
block
Property
Name
Property Values
MapCoeffstoPorts
'off' (default) or
'on'
FIR)
{'Num','Den'}
{'Num','Den','g'}
RateOption'enforce single
rate' (default) or
'allow multirate'
4-207
block
Examples
In this second example, define the block name to meet your needs by
using the property name/property value pair input arguments.
block(hm, 'blockname', 'firdecim');
The figure below shows the blocks in a Simulink model. When you try
these examples, you see that the second block writes over the first
block location. You can avoid this by moving the first block before you
generate the second, always naming your block with the blockname
property, or setting the Destination property to new which puts the
filter block in a new Simulink model.
4-208
block
See Also
realizemdl
How To
4-209
butter
Purpose
Syntax
hd = design(d,'butter')
hd = design(d,'butter',designoption,value...)
Description
For complete help about using butter, refer to the command line help
system. For example, to get specific information about using butter
with d, the specification object, enter the following at the MATLAB
prompt.
help(d,'butter')
Examples
4-210
butter
See Also
4-211
ca2tf
Purpose
Syntax
[b,a]=ca2tf(d1,d2)
[b,a]=ca2tf(d1,d2,beta)
[b,a,bp]=ca2tf(d1,d2)
[b,a,bp]=ca2tf(d1,d2,beta)
Description
H ( z) = B( z) / A( z) =
1
[ H1( z) + H 2( z)]
2
H ( z) = B( z) / A( z) =
1
( ) H1( z) + H 2( z)
2
G( z) = Bp( z) / A( z) =
1
[ H1( z) H 2( z)]
2
G( z) = Bp( z) / A( z) =
4-212
1
( ) H1( z) + H 2( z)
2j
ca2tf
Examples
Create a filter, convert the filter to coupled allpass form, and convert the
result back to the original structure (create the power complementary
filter as well).
[b,a]=cheby1(10,.5,.4);
[d1,d2,beta]=tf2ca(b,a);
[num,den,numpc]=ca2tf(d1,
d2,beta);
[h,w,s]=freqz(num,den);
hpc = freqz(numpc,den);
s.plot = 'mag';
s.yunits = 'sq';
freqzplot([h hpc],w,s);
See Also
4-213
cheby1
Purpose
Syntax
hd = design(d,'cheby1')
hd = design(d,'cheby1',designoption,value,designoption,
value,...)
Description
For complete help about using cheby1, refer to the command line help
system. For example, to get specific information about using cheby1
with d, the specification object, enter the following at the MATLAB
prompt.
help(d,'cheby1')
Examples
Specify the filter order, passband edge frequency, and the passband
ripple to get the filter exactly as required.
4-214
cheby1
d = fdesign.highpass('n,fp,ap',7,20,.4,50);
hd = design(d,'cheby1');
See Also
4-215
cheby2
Purpose
Syntax
hd = design(d,'cheby2')
hd = design(d,'cheby2',designoption,value,designoption,
value,...)
Description
For complete help about using cheby1, refer to the command line help
system. For example, to get specific information about using cheby2
with d, the specification object, enter the following at the MATLAB
prompt.
help(d,'cheby2')
Examples
a highpass filter where you specify the filter order, the stopband edge
frequency. and the stopband attenuation to get the filter exactly as
required.
d = fdesign.highpass('n,fst,ast',5,20,55,50);
4-216
cheby2
hd=design(d,'cheby2');
The Filter Visualization Tool shows the highpass filter meets the
specifications.
fvtool(hd)
See Also
4-217
cl2tf
Purpose
Syntax
[b,a] = cl2tf(k1,k2)
[b,a] = cl2tf(k1,k2,beta)
[b,a,bp] = cl2tf(k1,k2)
[b,a,bp] = cl2tf(k1,k2,beta)
Description
H ( z) = B( z) / A( z) =
1
[ H1( z) + H 2( z)]
2
where H1(z) and H2(z) are the transfer functions of the allpass filters
determined by k1 and k2, and k1 and k2 are real vectors of reflection
coefficients corresponding to allpass lattice structures.
[b,a] = cl2tf(k1,k2,beta) where k1, k2 and beta are complex,
H ( z) = B( z) / A( z) =
1
( ) H1( z) + H 2( z)
2
G( z) = Bp( z) / A( z) =
1
[ H1( z) H 2( z)]
2
4-218
cl2tf
G( z) = Bp( z) / A( z) =
Examples
[b,a]=cheby1(10,.5,.4);
1
( ) H1( z) + H 2( z)
2j
%TF2CL returns the reflection coeffs
4-219
cl2tf
See Also
4-220
coeffs
Purpose
Syntax
s
s
s
s
s
Description
=
=
=
=
=
coeffs(ha)
coeffs(hd)
coeffs(hm)
coeffs(hs)
coeffs(hs,Name,Value)
Input
Arguments
ha
4-221
coeffs
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
4-222
coeffs
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
4-223
coeffs
System Object
State
Coefficient Data
Type
Rule
property.
When you do not specify the arithmetic, the function uses
double-precision arithmetic if the filter System object is in an unlocked
state. If the System object is locked, the function performs analysis
based on the locked input data type.
Output
Arguments
Examples
4-224
coeffs
See Also
4-225
coeread
Purpose
Syntax
hd = coeread(filename)
Description
See Also
4-226
coewrite
Purpose
Syntax
coewrite(hd)
coewrite(hd,radix)
coewrite(...,filename)
Description
Examples
coefficients in a format the XILINX CORE Generator can read and load.
In this example, you create a 30th-order fixed-point filter and generate
the .coe file that includes the filter coefficients as well as associated
information about the filter.
b = firceqrip(30,0.4,[0.05 0.03]); hq = dfilt.dffir(b);
set(hq,'arithmetic','fixed'); coewrite(hq,10,'mycoefile');
4-227
coewrite
See Also
4-228
constraincoeffwl
Purpose
Syntax
Hq
Hq
Hq
Hq
Hq
Description
=
=
=
=
=
constraincoeffwl(Hd,wordlength)
constraincoeffwl(Hd,wordlength,'Ntrials',N)
constraincoeffwl(Hd,wordlength,...,'NoiseShaping',NSFlag)
constraincoeffwl(Hd,wordlength,...,'Apasstol',Apasstol)
constraincoeffwl(Hd,wordlength,...,'Astoptol',Astoptol)
4-229
constraincoeffwl
You must have the Fixed-Point Designer software installed to use this
function.
Examples
See Also
Tutorials
4-230
convert
Purpose
Syntax
hq = convert(hq,newstruct)
hm = convert(hm,newstruct)
Description
Discrete-Time Filters
hq = convert(hq,newstruct) returns a quantized filter whose
structure has been transformed to the filter structure specified by string
newstruct. You can enter any one of the following quantized filter
structures:
4-231
convert
possible.
Multirate Filters
hm = convert(hm,newstruct) returns a multirate filter whose
4-232
convert
Examples
[b,a]=ellip(5,3,40,.7); hq = dfilt.df2t(b,a);
hq2 = convert(hq,'df1');
4-233
convert
Since CIC interpolators only use fixed-point arithmetic, the user may
disregard this warning. The fixed-point structure will not be lost on
conversion.
See Also
4-234
mfilt | dfilt
cost
Purpose
Syntax
c
c
c
c
Description
=
=
=
=
cost(hd)
cost(hm)
cost(hs)
cost(hs,Name,Value)
Input
Arguments
hd
4-235
cost
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-236
cost
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-237
cost
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
Examples
Field Name
Description
Number of
Multiplications
nmult
Number of
multiplications
during the filter
run. nmult ignores
multiplications by -1,
0, and 1 in the total
multiple.
Number of
Additions
nadd
Number of additions
during the filter run.
Number of States
nstates
Multiplications
per Input Sample
multperinputsample
Number of
multiplication
operations performed
for each input sample
Additions per
Input Sample
addperinputsample
Number of addition
operations performed
for each input sample
These examples show you the cost method applied to dfilt and mfilt
objects.
hd = design(fdesign.lowpass);
c = cost(hd);
4-238
cost
When you are using a multirate filter object, cost works the same way.
d = fdesign.decimator(4,'cic');
hm = design(d,'multisection');
See Also
qreport
4-239
cumsec
Purpose
Syntax
h = cumsec(hd)
h = cumsec(hd,indices)
h = cumsec(hd,indices,secondary)
cumsec(hd,...)
h = cumsec(hs)
h = cumsec(hs,Name,Value)
Description
should be split.
cumsec(hd,...) uses FVTool to plot the magnitude response of the
cumulative sections.
h = cumsec(hs) returns the cumulative sections of the
dsp.BiquadFilter filter System object hs. You can also use the
optional input arguments indices and secondary with this syntax.
You can also omit the output argument h to use FVTool to plot the
4-240
cumsec
Input
Arguments
hd
Filter indices. Use indices to specify the filter sections cumsec uses to
compute the cumulative responses.
secondary
This option applies only when hd is a df2sos and df1tsos filter. For
these second-order section structures, the secondary scaling points refer
to the scaling locations between the recursive and the nonrecursive
parts of the section (the "middle" of the section). Argument secondary
accepts either true or false. By default, secondary is false.
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-241
cumsec
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-242
cumsec
Examples
See Also
Filter');
scale | scalecheck
4-243
denormalize
Purpose
Syntax
denormalize(hq)
Description
more than once on a filter does not change the coefficients after the
first denormalize call.
Examples
See Also
4-244
normalize
design
Purpose
Syntax
H = design(D)
H = design(D,METHOD)
H = design(D,METHOD,PARAM1,VALUE1,PARAM2,VALUE2,...)
H = design(D,METHOD,OPTS)
Hs = design(D,...,'SystemObject',sysobjflag)
Description
used by default.
The design method you provide as the designmethod input argument
must be one of the methods returned by
designmethods(d)
To help you design filters more quickly, the input argument METHOD
accepts a variety of special keywords that force design to behave in
different ways. The following table presents the keywords you can use
for METHOD and how design responds to the keyword.
Designmethod
Keyword
'FIR'
'IIR'
4-245
design
Designmethod
Keyword
'ALLFIR'
'ALLIIR'
'ALL'
4-246
design
Design methods and design options for filter System objects are not
necessarily the same as those for dfilt and mfilt objects. To check
design methods for System objects, use designmethods with the
'SystemObject',sysobjflag syntax.
If you are specifying design-method-specific options using OPTS, you can
also set OPTS.SystemObject to true instead of calling design with the
'SystemObject',sysobjflag syntax.
Examples
If you have the DSP System Toolbox software installed, you can design
a minimum-phase FIR equripple filter. Design a minimumphase filter
and compare the pole-zero plots of the original and minimum-phase
designs.
Hmin = design(D,'equiripple','MinPhase',true);
hfvt = fvtool([H Hmin],'analysis','polezero');
legend(hfvt,'Original Design','Minimum Phase Design');
4-247
design
help(D,'butter')
% Match passband exactly
H = design(D,'butter','MatchExactly','passband');
If you have the DSP System Toolbox software, you can specify the P-th
norm scaling on the second-order sections. Use L-infinity norm scaling
in the time domain.
H = design(D,'butter','MatchExactly','passband','SOSScaleNorm','linf');
If you have the DSP System Toolbox software, you can create a filter
System object.
Hs = design(D,'SystemObject',true);
See Also
4-248
designmethods | designopts
designmethods
Purpose
Syntax
M = designmethods(D)
M = designmethods(D,'default')
M = designmethods(D,TYPE)
M = designmethods(D,'full')
Ms = designmethods(D,...,'SystemObject',sysobjflag)
Description
property.
M = designmethods(D,'default') returns the default design method
for the filter specification object D and the current value of the
Specification property.
M = designmethods(D,TYPE) returns either the TYPE design methods
that apply to D. TYPE can be either 'FIR' or 'IIR'.
M = designmethods(D,'full') returns the full name for each of
the available design methods. For example, designmethods with the
'full' argument returns Butterworth for the butter method.
Ms = designmethods(D,...,'SystemObject',sysobjflag) returns
the available design methods for designing filter System objects when
sysobjflag is true. To use System objects, you must have the DSP
System Toolbox product installed. When sysobjflag is false, the
function checks methods for creating dfilt and mfilt objects, as
described previously. Design methods and design options for filter
System objects are not necessarily the same as those for dfilt and
mfilt objects.
Examples
4-249
designmethods
See Also
4-250
designopts
Purpose
Valid input arguments and values for specification object and method
Syntax
OPTS = designopts(D,METHOD)
Description
Examples
If you have DSP System Toolbox software installed, OPTS has the
SystemObject property.
See Also
4-251
dfilt
Purpose
Discrete-time filter
Syntax
hd = dfilt.structure(input1,...)
hd = [dfilt.structure(input1,...),
dfilt.structure(input1,...),...]
hd = design(d,'designmethod')
Description
hd = [dfilt.structure(input1,...),
dfilt.structure(input1,...),...] returns a vector containing
dfilt filters.
Structures
Structures for dfilt.structure specify the type of filter structure.
Available types of structures for dfilt are shown below.
dfilt.structure
Description
dfilt.allpass
Allpass filter
Supported
Supported
dfilt.cascadewdfallpass
Cascade of allpass wave digital
Supported
filters
4-252
dfilt.delay
Delay
Not supported
dfilt.df1
Direct-form I
Supported
dfilt.df1sos
Direct-form I, second-order
sections
Supported
dfilt
dfilt.structure
Description
dfilt.df1t
Direct-form I transposed
Supported
dfilt.df1tsos
Direct-form I transposed,
second-order sections
Supported
dfilt.df2
Direct-form II
Supported
dfilt.df2sos
Supported
dfilt.df2t
Direct-form II transposed
Supported
dfilt.df2tsos
Direct-form II transposed,
second-order sections
Supported
dfilt.dffir
Direct-form FIR
Supported
dfilt.dffirt
Supported
dfilt.dfsymfir
Supported
dfilt.dfasymfir
Supported
dfilt.farrowfd
Supported
Not supported
filter
dfilt.fftfir
Overlap-add FIR
dfilt.latticeallpassLattice allpass
Not supported
Supported
dfilt.latticear
Supported
dfilt.latticearma
Supported
dfilt.latticemamax
Supported
dfilt.latticemamin
Supported
4-253
dfilt
dfilt.structure
Description
dfilt.calattice
Supported
dfilt.calatticepc
Supported
dfilt.statespace
State-space
Supported
dfilt.scalar
Supported
dfilt.wdfallpass
Supported
dfilt.cascade
Supported
dfilt.parallel
Supported
design(d,'designmethod).
4-254
dfilt
specification object. The next table lists all of the design methods in
the toolbox.
Design Method
String
butter
Butterworth IIR
cheby1
cheby2
ellip
Elliptic IIR
equiripple
firls
Least-squares FIR
freqsamp
Frequency-Sampled FIR
ifir
Interpolated FIR
iirlpnorm
iirls
Least-Squares IIR
kaiserwin
Kaiser-windowed FIR
lagrange
multistage
Multistage FIR
window
Windowed FIR
4-255
dfilt
Analysis Methods
Methods provide ways of performing functions directly on your dfilt
object without having to specify the filter parameters again. You can
apply these methods directly on the variable you assigned to your dfilt
object.
For example, if you create a dfilt object, hd, you can check whether
it has linear phase with islinphase(hd), view its frequency response
plot with fvtool(hd), or obtain its frequency response values with
h = freqz(hd). You can use all of the methods described here in this
way.
Note If your variable hd is a 1-D array of dfilt filters, the method is
applied to each object in the array. Only freqz, grpdelay, impz, is*,
order, and stepz methods can be applied to arrays. The zplane method
can be applied to an array only if zplane is used without outputs.
Some of the methods listed here have the same name as functions in
Signal Processing Toolbox software. They behave similarly.
4-256
dfilt
Method
Description
addstage
block
and values:
'Destination' indicates where to place the
block. 'Current' places the block in the
current Simulink model. 'New' creates a new
model. Default value is 'Current'.
'Blockname' assigns the entered string to the
block name. Default name is 'Filter'.
'OverwriteBlock'indicates whether to
overwrite the block generated by the block
method ('on') and defined by Blockame.
Default is 'off'.
'MapStates specifies initial conditions in the
block ('on'). Default is 'off'. Refer to "Using
coeffs
convert
4-257
dfilt
Method
Description
fcfwrite
4-258
fftcoeffs
filter
firtype
freqz
grpdelay
impz
impzlength
info
dfilt
Method
Description
isallpass
iscascade
isfir
islinphase
ismaxphase
isminphase
isparallel
isreal
isscalar
issos
isstable
4-259
dfilt
Method
Description
nsections
nstages
nstates
order
parallel
phasez
realizemdl
4-260
dfilt
Method
Description
new model. Valid values are 'Current' and
'New'.
'OverwriteBlock' specifies whether to
setstage
4-261
dfilt
Method
Description
sos
stepz
sysobj
4-262
dfilt
Method
Description
tf
zerophase
zpk
zplane
Viewing Properties
As with any object, use get to view a dfilt properties. To see a specific
property, use
get(hd,'property')
Changing Properties
To set specific properties, use
set(hd,'property1',value,'property2',value,...)
You must use single quotation marks around the property name. Use
single quotation marks around the value argument when the value is a
string, such as specifyall or fixed.
Copying an Object
To create a copy of an object, use the copy method.
4-263
dfilt
h2 = copy(hd)
Note Using the syntax H2 = hd copies only the object handle and does
not create a new, independent object.
4-264
dfilt
Examples
[h,w] = freqz(hd);
test_fir = isfir(hd)
% hd(1) is FIR and hd(2) is not.
Refer to the reference pages for each structure for more examples.
See Also
4-265
dfilt.allpass
Purpose
Allpass filter
Syntax
hd = dfilt.allpass(c)
Description
must contain one, two, three, or four real elements. The number of
elements in c determines the order of the filter. For example, c with
two elements creates a second-order filter and c with four elements
creates a fourth-order filter.
The transfer function for the allpass filter is defined by
H ( z) =
c(n) + c(n 1) z1 + + z n
1 + c(1) z1 + + c(n) z n
Properties
4-266
The following table provides a list of all the properties associated with
an allpass dfilt object.
Property Name
Brief Description
AllpassCoefficients
FilterStructure
dfilt.allpass
Examples
Property Name
Brief Description
PersistentMemory
States
See Also
4-267
dfilt.calattice
Purpose
Syntax
hd = dfilt.calattice(k1,k2,beta)
hd = dfilt.calattice
Description
k1(2)
conj(k1(3))
conj(k1(2))
1
x
0.5
k1(1)
conj(k1(1))
z (3)
z (2)
z (1)
1
y
H2(z)
k2(2)
k2(3)
conj(k2(2))
conj(k2(3))
beta
4-268
k2(1)
conj(k2(2))
z (6)
z (5)
z (4)
dfilt.calattice
Examples
See Also
4-269
dfilt.calatticepc
Purpose
Syntax
hd = dfilt.calatticepc(k1,k2)
hd = dfilt.calatticepc
Description
4-270
dfilt.calatticepc
Examples
4-271
dfilt.calatticepc
get(hd,'Allpass1')
See Also
4-272
dfilt.cascade
Purpose
Syntax
Description
hd = dfilt.cascade(filterobject1,filterobject2,...) returns
a discrete-time filter object hd of type cascade, which is a serial
interconnection of two or more filter objects filterobject1,
filterobject2, and so on. dfilt.cascade accepts any combination
of dfilt objects (discrete time filters) to cascade, as well as Farrow
filter objects.
You can use the standard notation to cascade one or more filters:
cascade(hd1,hd2,...)
where hd1, hd2, and so on can be mixed types, such as dfilt objects
and mfilt objects.
hd1, hd2, and so on can be fixed-point filters. All filters in the cascade
must be the same arithmetic format double, single, or fixed. hd,
the filter object returned, inherits the format of the cascaded filters.
Examples
% Lowpass
[b2,a2]=butter(8,0.4,'high');
% Highpass
h1=dfilt.df2t(b1,a1);
h2=dfilt.df2t(b2,a2);
hcas=dfilt.cascade(h1,h2);
See Also
4-273
dfilt.cascadeallpass
Purpose
Syntax
hd = dfilt.cascadeallpass(c1,c2,...)
Description
Properties
4-274
In the next table, the row entries are the filter properties and a brief
description of each property.
dfilt.cascadeallpass
Examples
Property Name
Brief Description
AllpassCoefficients
FilterStructure
PersistentMemory
States
4-275
dfilt.cascadeallpass
See Also
4-276
dfilt.cascadewdfallpass
Purpose
Syntax
hd = dfilt.cascadewdfallpass(c1,c2,...)
Description
Each c vector contains the coefficients for one section of the cascaded
filter. C vectors must have one, two, or four elements (coefficients).
Three element vectors are not supported.
When the c vector has four elements, the first and third elements of
the vector must be 0. Each section of the cascade is an allpass wave
digital filter, from dfilt.wdfallpass, with the coefficients given by the
corresponding c vector. That is, the first section has coefficients from
vector c1, the second section coefficients come from c2, and on until all
of the c vectors are used.
You can mix the lengths of the c vectors. They do not need to be
the same length. For example, you can cascade several fourth-order
sections (length(c) = 4) with first or second-order sections.
Wave digital filters are usually used to create other filters. This toolbox
uses them to implement halfband filters, which the first example in
Examples demonstrates. They are most often building blocks for filters.
Generally, you do not construct these WDF allpass cascade filters
directly. Instead, they result from the design process for an IIR
filter. Refer to the first example in Examples for more about using
dfilt.cascadewdfallpass to design an IIR filter.
For more information about the c vectors and the transfer function for
the allpass filters, refer to dfilt.wdfallpass.
Properties
In the next table, the row entries are the filter properties and a brief
description of each property.
4-277
dfilt.cascadewdfallpass
Property Name
Brief Description
Examples
FilterStructure
PersistentMemory
States
4-278
dfilt.cascadewdfallpass
x 10
16
14
12
Magnitude (dB)
10
2
0
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-279
dfilt.cascadewdfallpass
See Also
4-280
dfilt | dfilt.wdfallpass
dfilt.delay
Purpose
Delay filter
Syntax
Hd = dfilt.delay
Hd = dfilt.delay(latency)
Description
Examples
4-281
dfilt.delay
See Also
4-282
dfilt
dfilt.df1
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form I filter
implemented by dfilt.df1. To help you see how the filter processes the
coefficients, input, output, and states of the filter, as well as numerical
operations, the figure includes the locations of the arithmetic and data
type format elements within the signal flow.
4-283
dfilt.df1
4-284
dfilt.df1
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFormat
AccumWordLength
DenAccumFracLength AccumMode,
CastBeforeSum
DenFormat
CoeffWordLength
DenFracLength
CoeffAutoScale ,
SignedDenominator
DenProdFormat
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
InputFormat
InputWordLength
InputFracLength
None
NumAccumFormat
AccumWordLength
NumAccumFracLength AccumMode,
CastBeforeSum
NumFormat
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
NumProdFormat
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
Related Properties
Properties
In this table you see the properties associated with df1 implementations
of dfilt objects.
4-285
dfilt.df1
Note The table lists all the properties that a filter can have. Many
of the properties are dynamic, meaning they exist only in response to
the settings of other properties. You might not see all of the listed
properties all the time. To view all the properties for a filter at any
time, use get(hd) where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-286
Property Name
Brief Description
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
dfilt.df1
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
Denominator
DenProdFracLength
FilterStructure
4-287
dfilt.df1
4-288
Property Name
Brief Description
InputFracLength
InputWordLength
NumAccumFracLength
Numerator
NumFracLength
NumProdFracLength
OutputFracLength
OutputWordLength
dfilt.df1
Property Name
Brief Description
OverflowMode
ProductMode
ProductWordLength
PersistentMemory
4-289
dfilt.df1
Property Name
Brief Description
RoundMode
4-290
dfilt.df1
Examples
Property Name
Brief Description
Signed
States
See Also
4-291
dfilt.df1sos
Purpose
Syntax
Description
4-292
dfilt.df1sos
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form I filter
implemented in second-order sections by dfilt.df1sos. To help you
see how the filter processes the coefficients, input, and states of the
filter, as well as numerical operations, the figure includes the locations
of the formatting objects within the signal flow.
4-293
dfilt.df1sos
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength
AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,
Signed, Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
DenStateFrmt
DenStateWordLength DenStateFracLength
CastBeforeSum,
States
InputFrmt
InputWordLength
InputFracLength
None
NumAccumFrmt
AccumWordLength
NumAccumFracLength
AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
NumStateFrmt
NumStateWordLength NumStateFracLength
States
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
ScaleValueFrmt
CoeffWordLength
ScaleValueFracLengthCoeffAutoScale,
ScaleValues
Related Properties
4-294
dfilt.df1sos
Properties
In this table you see the properties associated with SOS implementation
of direct-form I dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumMode
4-295
dfilt.df1sos
Property Name
Brief Description
from the accumulator, set AccumMode to
SpecifyPrecision.
4-296
AccumWordLength
Arithmetic
CastBeforeSum
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
dfilt.df1sos
Property Name
Brief Description
DenProdFracLength
DenStateFracLength
DenStateWordLength
FilterStructure
InputFracLength
InputWordLength
NumAccumFracLength
NumFracLength
NumStateFracLength
4-297
dfilt.df1sos
Property Name
Brief Description
NumWordFracLength
OptimizeScaleValues
OutputFracLength
OutputMode
OutputWordLength
4-298
dfilt.df1sos
Property Name
Brief Description
OverflowMode
ProductMode
ProductWordLength
PersistentMemory
4-299
dfilt.df1sos
Property Name
Brief Description
RoundMode
4-300
dfilt.df1sos
Examples
Property Name
Brief Description
ScaleValues
Signed
SosMatrix
States
StateWordLength
See Also
dfilt | dfilt.df2tsos
4-301
dfilt.df1t
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
4-302
The following figure shows the signal flow for the transposed direct-form
I filter implemented by dfilt.df1t. To help you see how the filter
processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
dfilt.df1t
4-303
dfilt.df1t
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength
AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale, ,
Signed, Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
DenStateFrmt
DenStateWordLength
DenStateFracLength
CastBeforeSum,
States
InputFrmt
InputWordLength
InputFracLength
None
Multiplicandfrmt
MultiplicandWordLength
MultiplicandFracLength
CastBeforeSum
NumAccumFrmt
AccumWordLength
NumAccumFracLength
AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed,
Numerator
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
NumStateFrmt
NumStateWordLength
NumStateFracLength
States
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
Related Properties
4-304
dfilt.df1t
reviewing the table, you see that the DenProdFrmt refers to the
properties ProdWordLength, ProductMode and DenProdFracLength
that fully define the denominator format after multiply (or product)
operations.
Properties
In this table you see the properties associated with df1t implementation
of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumMode
AccumWordLength
4-305
dfilt.df1t
4-306
Property Name
Brief Description
Arithmetic
CastBeforeSum
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
Denominator
dfilt.df1t
Property Name
Brief Description
DenProdFracLength
DenStateFracLength
FilterStructure
InputFracLength
InputWordLength
MultiplicandFracLength
MultiplicandWordLength
NumAccumFracLength
4-307
dfilt.df1t
Property Name
Brief Description
Numerator
NumFracLength
NumProdFracLength
NumStateFracLength
OutputFracLength
OutputMode
4-308
dfilt.df1t
Property Name
Brief Description
SpecifyPrecision lets you set the
word and fraction lengths used by the
output data from filtering.
OutputWordLength
OverflowMode
ProductMode
4-309
dfilt.df1t
Property Name
Brief Description
ProductWordLength
PersistentMemory
RoundMode
4-310
dfilt.df1t
Property Name
Brief Description
Examples
Signed
StateAutoScale
States
StateWordLength
See Also
4-311
dfilt.df1tsos
Purpose
Syntax
Description
matrix.
Make this filter a fixed-point or single-precision filter by changing the
value of the Arithmetic property for the filter hd as follows:
To change to single-precision filtering, enter
set(hd,'arithmetic','single');
4-312
dfilt.df1tsos
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form
I transposed filter implemented using second-order sections by
dfilt.df1tsos. To help you see how the filter processes the coefficients,
input, and states of the filter, as well as numerical operations, the figure
includes the locations of the formatting objects within the signal flow.
4-313
dfilt.df1tsos
For example, the InputFrmt label refers to the word length and
fraction length used to interpret the data input to the filter. The
format properties InputWordLength and InputFracLength (as shown
in the table) store the word length and the fraction length in bits. Or
consider NumFrmt, which refers to the word and fraction lengths
(CoeffWordLength, NumFracLength) associated with representing filter
numerator coefficients.
Signal Flow
Label
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength
AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,
Signed, Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
DenStateFrmt
DenStateWordLength
DenStateFracLength
CastBeforeSum,
States
InputFrmt
InputWordLength
InputFracLength
None
MultiplicandFracLength
CastBeforeSum
NumAccumFrmt AccumWordLength
NumAccumFracLength
AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
NumStateFrmt
NumStateWordLength
NumStateFracLength
States
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
ScaleValueFrmt
CoeffWordLength
ScaleValueFracLength
CoeffAutoScale,
ScaleValues
MultiplicandFrmt MultiplicandWordLength
4-314
Related Properties
dfilt.df1tsos
Properties
In this table you see the properties associated with SOS implementation
of transposed direct-form I dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-315
dfilt.df1tsos
4-316
Property Name
Brief Description
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
CoeffAutoScale
dfilt.df1tsos
Property Name
Brief Description
CoeffWordLength
DenAccumFracLength
DenFracLength
DenProdFracLength
DenStateFracLength
FilterStructure
InputFracLength
4-317
dfilt.df1tsos
4-318
Property Name
Brief Description
InputWordLength
MultiplicandFracLength
MultiplicandWordLength
NumAccumFracLength
Numerator
NumProdFracLength
NumStateFracLength
dfilt.df1tsos
Property Name
Brief Description
NumStateWordLength
OptimizeScaleValues
OutputFracLength
OutputMode
4-319
dfilt.df1tsos
4-320
Property Name
Brief Description
OutputWordLength
OverflowMode
ProductMode
dfilt.df1tsos
Property Name
Brief Description
ProductWordLength
PersistentMemory
RoundMode
4-321
dfilt.df1tsos
Property Name
Brief Description
round - Round toward nearest.
Ties round toward negative
infinity for negative numbers,
and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic.
Coefficient and input arithmetic
always round. Finally, products
never overflow they maintain full
precision.
4-322
ScaleValueFracLength
ScaleValues
Signed
dfilt.df1tsos
Examples
Property Name
Brief Description
SosMatrix
StateAutoScale
States
StateWordLength
4-323
dfilt.df1tsos
See Also
4-324
dfilt.df2
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form II filter
implemented by dfilt.df2. To help you see how the filter processes
the coefficients, input, and states of the filter, as well as numerical
operations, the figure includes the locations of the formatting objects
within the signal flow.
4-325
dfilt.df2
4-326
dfilt.df2
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,
Signed,
Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
InputFrmt
InputWordLength
InputFracLength
None
NumAccumFrmt
AccumWordLength
NumAccumFracLength AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
StateFrmt
StateWordLength
StateFracLength
States
Related Properties
4-327
dfilt.df2
Properties
In this table you see the properties associated with the df2
implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-328
Property Name
Brief Description
AccumMode
AccumWordLength
Arithmetic
dfilt.df2
Property Name
Brief Description
CastBeforeSum
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
Denominator
DenProdFracLength
4-329
dfilt.df2
4-330
Property Name
Brief Description
FilterStructure
InputFracLength
InputWordLength
NumAccumFracLength
Numerator
NumFracLength
NumProdFracLength
OutputFracLength
dfilt.df2
Property Name
Brief Description
OutputMode
OutputWordLength
OverflowMode
4-331
dfilt.df2
Property Name
Brief Description
ProductMode
PersistentMemory
RoundMode
4-332
dfilt.df2
Property Name
Brief Description
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic.
Coefficient and input arithmetic always
round. Finally, products never overflow
they maintain full precision.
Examples
Signed
StateFracLength
States
StateWordLength
See Also
4-333
dfilt.df2sos
Purpose
Syntax
Description
4-334
dfilt.df2sos
Fixed-Point
Filter
Structure
The figure below shows the signal flow for the direct-form II filter
implemented with second-order sections by dfilt.df2sos. To help you
see how the filter processes the coefficients, input, and states of the
filter, as well as numerical operations, the figure includes the locations
of the formatting objects within the signal flow.
4-335
dfilt.df2sos
4-336
dfilt.df2sos
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,
Signed, sosMatrix
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength,
sosMatrix
InputFrmt
InputWordLength
InputFracLength
None
NumAccumFrmt
AccumWordLength
NumAccumFracLength AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
Related Properties
CoeffAutoScale,
Signed, sosMatrix
4-337
dfilt.df2sos
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
ScaleValueFrmat
CoeffWordLength
ScaleValueFracLength
CoeffAutoScale,
ScaleValues
SectionInputFormt
SectionInputWordLength
SectionInputFracLength
SectionInputAutoScale
SectionOutputFrmt
SectionOutputWordLength
SectionOutputFracLength
SectionOutputAutoScale
StateFrmt
StateWordLength
StateFracLength
CastBeforeSum,
States
Related Properties
Properties
4-338
In this table you see the properties associated with second-order section
implementation of direct-form II dfilt objects.
dfilt.df2sos
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumMode
AccumWordLength
Arithmetic
4-339
dfilt.df2sos
4-340
Property Name
Brief Description
CastBeforeSum
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
DenProdFracLength
FilterStructure
dfilt.df2sos
Property Name
Brief Description
InputFracLength
InputWordLength
NumAccumFracLength
NumFracLength
NumProdFracLength
OptimizeScaleValues
OutputFracLength
4-341
dfilt.df2sos
Property Name
Brief Description
OutputMode
4-342
OutputWordLength
OverflowMode
dfilt.df2sos
Property Name
Brief Description
ProductMode
ProductWordLength
PersistentMemory
RoundMode
4-343
dfilt.df2sos
Property Name
Brief Description
floor - Round toward negative infinity.
nearest - Round toward nearest. Ties
round toward positive infinity.
round - Round toward nearest. Ties
round toward negative infinity for
negative numbers, and toward positive
infinity for positive numbers.
The choice you make affects only the
accumulator and output arithmetic.
Coefficient and input arithmetic always
round. Finally, products never overflow
they maintain full precision.
ScaleValueFracLength
ScaleValues
4-344
dfilt.df2sos
Property Name
Brief Description
SosMatrix
StateFracLength
States
StateWordLength
4-345
dfilt.df2sos
Examples
See Also
4-346
dfilt.df2t
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form II
transposed filter implemented by dfilt.df2t. To help you see how the
filter processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
4-347
dfilt.df2t
4-348
dfilt.df2t
Signal Flow
Label
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength
AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,Signed,
Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
InputFrmt
InputWordLength
InputFracLength
None
NumAccumFrmt
AccumWordLength
NumAccumFracLength
AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
OutputFrmt
OutputWordLength OutputFracLength
None
StateFrmt
StateWordLength
States
StateFracLength
Related Properties
4-349
dfilt.df2t
Properties
In this table you see the properties associated with df2t implementation
of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-350
Property Name
Brief Description
AccumMode
AccumWordLength
dfilt.df2t
Property Name
Brief Description
Arithmetic
CastBeforeSum
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
Denominator
4-351
dfilt.df2t
4-352
Property Name
Brief Description
DenProdFracLength
FilterStructure
InputFracLength
InputWordLength
NumAccumFracLength
Numerator
NumFracLength
NumProdFracLength
OutputFracLength
OutputWordLength
dfilt.df2t
Property Name
Brief Description
OverflowMode
ProductMode
ProductWordLength
PersistentMemory
4-353
dfilt.df2t
Property Name
Brief Description
RoundMode
Signed
4-354
dfilt.df2t
Examples
Property Name
Brief Description
StateAutoScale
StateFracLength
States
StateWordLength
See Also
4-355
dfilt.df2tsos
Purpose
Syntax
Description
4-356
dfilt.df2tsos
Fixed-Point
Filter
Structure
The figure below shows the signal flow for the second-order section
transposed direct-form II filter implemented by dfilt.dftsos. To help
you see how the filter processes the coefficients, input, and states of the
filter, as well as numerical operations, the figure includes the locations
of the formatting objects within the signal flow.
4-357
dfilt.df2tsos
4-358
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
DenAccumFrmt
AccumWordLength
DenAccumFracLength AccumMode,
CastBeforeSum
DenFrmt
CoeffWordLength
DenFracLength
CoeffAutoScale,
Signed,
Denominator
DenProdFrmt
CoeffWordLength
DenProdFracLength
ProductMode,
ProductWordLength
InputFrmt
InputWordLength
InputFracLength
None
NumAccumFrmt
AccumWordLength
NumAccumFracLength AccumMode,
CastBeforeSum
NumFrmt
CoeffWordLength
NumFracLength
Related Properties
CoeffAutoScale,
SignedNumerator
dfilt.df2tsos
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
NumProdFrmt
CoeffWordLength
NumProdFracLength
ProductWordLength,
ProductMode
OutputFrmt
OutputWordLength
OutputFracLength
OutputMode
ScaleValueFrmt
CoeffWordLength
ScaleValueFracLengthCoeffAutoScale,
ScaleValues
SectionInputFormt
SectionInputWordLength
SectionInputFracLength
SectionOutputFrmt
SectionOutputWordLength
SectionOutputFracLength
StateFrmt
StateWordLength
StateFracLength
Related Properties
States
Properties
In this table you see the properties associated with second-order section
implementation of transposed direct-form II dfilt objects.
4-359
dfilt.df2tsos
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-360
Property Name
Brief Description
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
dfilt.df2tsos
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
DenAccumFracLength
DenFracLength
DenProdFracLength
FilterStructure
InputFracLength
InputWordLength
NumAccumFracLength
4-361
dfilt.df2tsos
Property Name
Brief Description
NumFracLength
NumProdFracLength
OptimizeScaleValues
OutputFracLength
OutputMode
Sets the mode the filter uses to scale the filtered data
for output. You have the following choices:
AvoidOverflow directs the filter to set the output
data word length and fraction length to avoid
causing the data to overflow.
BestPrecision directs the filter to set the output
data word length and fraction length to maximize
the precision in the output data.
SpecifyPrecision lets you set the word and
fraction lengths used by the output data from
filtering.
OutputWordLength
4-362
dfilt.df2tsos
Property Name
Brief Description
OverflowMode
ProductMode
ProductWordLength
PersistentMemory
4-363
dfilt.df2tsos
Property Name
Brief Description
RoundMode
4-364
ScaleValueFracLength
ScaleValues
Signed
dfilt.df2tsos
Property Name
Brief Description
SosMatrix
SectionInputFracLength
SectionInputWordLength
Lets you set the word length for section inputs in SOS
filters, if you set SectionInputAutoScale to false.
SectionOutputFracLength
SectionOutputWordLength
Lets you set the word length for section outputs in SOS
filters, if you set SectionOutputAutoScale to false.
StateAutoScale
StateFracLength
States
StateWordLength
Examples
4-365
dfilt.df2tsos
[s,g] = zp2sos(z,p,k);
hd = dfilt.df2tsos(s,g);
% convert filter to fixed-point
hd.arithmetic='fixed';
See Also
4-366
dfilt.dfasymfir
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the odd-order
antisymmetric FIR filter implemented by dfilt.dfasymfir. The
even-order filter uses similar flow. To help you see how the filter
processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
4-367
dfilt.dfasymfir
4-368
dfilt.dfasymfir
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
None
InputFormat
InputWordLength
InputFracLength
None
NumFormat
CoeffWordLength
NumFracLength
CoeffAutoScale, ,
Signed, Numerator
OutputFormat
OutputWordLength
OutputFracLength
None
ProductFormat
ProductWordLength
ProductFracLength
None
TapSumFormat
InputWordLength
InputFracLength
InputFormat
Properties
4-369
dfilt.dfasymfir
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-370
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits [27]
AccumWordLength
Any integer
number of bits[33]
Arithmetic
fixed for
fixed-point filters
CoeffAutoScale
[true], false
CoeffWordLength
Any integer
number of bits
[16]
dfilt.dfasymfir
Name
Values
Description
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits [15]
InputWordLength
Any integer
number of bits
[16]
NumFracLength
Any positive or
negative integer
number of bits [14]
OutputFracLength
Any positive or
negative integer
number of bits [29]
OutputWordLength
Any integer
number of bits
[33]
4-371
dfilt.dfasymfir
Name
Values
Description
OverflowMode
saturate, [wrap]
ProductFracLength
Any positive or
negative integer
number of bits [27]
ProductWordLength
Any integer
number of bits
[33]
RoundMode
[convergent],
ceil, fix, floor,
nearest, round
4-372
dfilt.dfasymfir
Name
Values
Description
floor - Round toward negative infinity.
nearest - Round toward nearest. Ties
round toward positive infinity.
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic.
Coefficient and input arithmetic always
round. Finally, products never overflow
they maintain full precision.
Signed
[true], false
States
fi object to
match the filter
arithmetic setting
Examples
Odd Order
Specify a fifth-order direct-form antisymmetric FIR filter structure for a
dfilt object, hd, with the following code:
b = [-0.008 0.06 -0.44 0.44 -0.06 0.008];
hd = dfilt.dfasymfir(b);
4-373
dfilt.dfasymfir
Even Order
Specify a fourth-order direct-form antisymmetric FIR filter structure
for dfilt object hd, with the following code:
b = [-0.01 0.1 0.0 -0.1 0.01];
hd = dfilt.dfasymfir(b);
hd.arithmetic='fixed';
FilterCoefs = get(hd,'numerator');
% or equivalently
FilterCoefs = hd.numerator;
See Also
4-374
dfilt.dffir
Purpose
Syntax
Description
output unchanged.
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the direct-form FIR filter
implemented by dfilt.dffir. To help you see how the filter processes
the coefficients, input, and states of the filter, as well as numerical
operations, the figure includes the locations of the formatting objects
within the signal flow.
4-375
dfilt.dffir
4-376
dfilt.dffir
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFrmt
AccumWordLength
AccumFracLength
None
InputFrmt
InputWordLength
InputFracLength
None
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
OutputFrmt
OutputWordLength
OutputFracLength
None
ProductFrmt
ProductWordLength
ProductFracLength
None
Properties
In this table you see the properties associated with direct-form FIR
implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
4-377
dfilt.dffir
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-378
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits
[30]
AccumWordLength
Any integer
number of bits[34]
Arithmetic
fixed for
fixed-point filters
CoeffAutoScale
[true], false
CoeffWordLength
Any integer
number of bits
[16]
FilterInternals
[FullPrecision],
SpecifyPrecision
dfilt.dffir
Name
Values
Description
InputFracLength
Any positive or
negative integer
number of bits
[15]
InputWordLength
Any integer
number of bits
[16]
NumFracLength
Any positive or
negative integer
number of bits
[14]
OutputFracLength
Any positive or
negative integer
number of bits
[32]
OutputWordLength
Any integer
number of bits
[39]
OverflowMode
saturate, [wrap]
4-379
dfilt.dffir
Name
Values
Description
ProductFracLength
Any positive or
negative integer
number of bits
[30]
ProductWordLength
Any integer
number of bits
[32]
RoundMode
[convergent],
ceil, fix, floor,
nearest, round
4-380
dfilt.dffir
Name
Values
Description
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Signed
[true], false
States
fi object to
match the filter
arithmetic setting
Examples
See Also
4-381
dfilt.dffirt
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
4-382
The following figure shows the signal flow for the transposed direct-form
FIR filter implemented by dfilt.dffirt. To help you see how the filter
processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
dfilt.dffirt
4-383
dfilt.dffirt
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
None
InputFormat
InputWordLength
InputFracLength
None
NumFormat
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
OutputFormat
OutputWordLength
OutputFracLength
None
ProductFormat
ProductWordLength
ProductFracLength
None
Properties
4-384
In this table you see the properties associated with the transposed
direct-form FIR implementation of dfilt objects.
dfilt.dffirt
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits [30]
AccumWordLength
Arithmetic
CoeffAutoScale
[true], false
CoeffWordLength
4-385
dfilt.dffirt
4-386
Name
Values
Description
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits [15]
InputWordLength
NumFracLength
Any positive or
negative integer
number of bits [14]
OutputFracLength
Any positive or
negative integer
number of bits [30]
OutputWordLength
dfilt.dffirt
Name
Values
Description
OverflowMode
saturate, [wrap]
RoundMode
[convergent],
ceil, fix, floor,
nearest, round
4-387
dfilt.dffirt
Name
Values
Description
[true], false
States
fi object to match
Examples
See Also
4-388
dfilt.dfsymfir
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
In the following figure you see the signal flow diagram for the symmetric
FIR filter that dfilt.dfsymfir implements.
4-389
dfilt.dfsymfir
4-390
dfilt.dfsymfir
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFrmt
AccumWordLength
AccumFracLength
None
InputFrmt
InputWordLength
InputFracLength
None
NumFrmt
CoeffWordLength
NumFracLength
CoeffAutoScale,
Signed, Numerator
OutputFrmt
OutputWordLength
OutputFracLength
None
ProductFrmt
ProductWordLength
ProductFracLength
None
TapSumFrmt
InputWordLength
InputFracLength
None
Properties
In this table you see the properties associated with the symmetric FIR
implementation of dfilt objects.
4-391
dfilt.dfsymfir
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-392
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits [27]
AccumWordLength
Arithmetic
CoeffAutoScale
[true], false
CoeffWordLength
dfilt.dfsymfir
Name
Values
Description
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits [15]
InputWordLength
NumFracLength
Any positive or
negative integer
number of bits [14]
OutputFracLength
Any positive or
negative integer
number of bits [29]
OutputWordLength
4-393
dfilt.dfsymfir
4-394
Name
Values
Description
OverflowMode
saturate, [wrap]
ProductFracLength
Any positive or
negative integer
number of bits [29]
ProductWordLength
dfilt.dfsymfir
Name
Values
Description
RoundMode
[convergent], ceil,
fix, floor, nearest,
round
4-395
dfilt.dfsymfir
Name
Values
Description
Signed
[true], false
States
fi object to match
the filter arithmetic
setting
Examples
Odd Order
Specify a fifth-order direct-form symmetric FIR filter structure for a
dfilt object hd, with the following code:
b = [-0.008 0.06 0.44 0.44 0.06 -0.008];
hd = dfilt.dfsymfir(b);
% Create fixed-point filter
set(hd,'arithmetic','fixed')
% Change FilterInternals property to
% SpecifyPrecision
hd.Filterinternals='SpecifyPrecision';
Even Order
Specify a fourth-order, fixed-point, direct-form symmetric FIR filter
structure for a dfilt object hd, with the following code:
b = [-0.01 0.1 0.8 0.1 -0.01];
hd = dfilt.dfsymfir(b);
set(hd,'arithmetic','fixed');
See Also
4-396
dfilt.farrowfd
Purpose
Syntax
Hd = dfilt.farrowfd(D, COEFFS)
Description
Hd = dfilt.farrowfd(D, COEFFS)
Examples
4-397
dfilt.farrowfd
How To
4-398
dfilt
dfilt.farrowlinearfd
Purpose
Syntax
Hd = dfilt.farrowlinearfd(D)
Description
Hd = dfilt.farrowlinearfd(D)
Examples
How To
dfilt
4-399
dfilt.fftfir
Purpose
Syntax
Hd = dfilt.fftfir(b,len)
Hd = dfilt.fftfir(b)
Hd = dfilt.fftfir
Description
This object uses the overlap-add method of block FIR filtering, which is
very efficient for streaming data.
Hd = dfilt.fftfir(b,len) returns a discrete-time, FFT, FIR filter,
Hd, with numerator coefficients, b and block length, len. The block
4-400
dfilt.fftfir
where len is the block length and M is the length of the numerator-1,
(length(b)-1), which is also the number of states. The output of each
convolution is a block that is longer than the input block by a tail of
(length(b)-1) samples. These tails overlap the next block and are
added to it. The states reported by dfilt.fftfir are the tails of the
final convolution.
Examples
See Also
4-401
dfilt.latticeallpass
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
4-402
The following figure shows the signal flow for the allpass lattice filter
implemented by dfilt.latticeallpass. To help you see how the filter
processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
dfilt.latticeallpass
4-403
dfilt.latticeallpass
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
AccumMode
InputFormat
InputWordLength
InputFracLength
None
LatticeFormat
CoeffWordLength
LatticeFracLength
CoeffAutoScale
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
ProductFormat
ProductWordLength
ProductFracLength
ProductMode
StateFormat
StateWordLength
StateFracLength
States
Properties
In this table you see the properties associated with the allpass lattice
implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
4-404
dfilt.latticeallpass
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumFracLength
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
4-405
dfilt.latticeallpass
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
FilterStructure
InputFracLength
InputWordLength
Lattice
coefficients.
OutputFracLength
4-406
dfilt.latticeallpass
Property Name
Brief Description
OutputMode
OutputWordLength
OverflowMode
4-407
dfilt.latticeallpass
Property Name
Brief Description
ProductMode
RoundMode
4-408
dfilt.latticeallpass
Property Name
Brief Description
nearest - Round toward nearest. Ties round
toward positive infinity.
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic. Coefficient
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Examples
Signed
StateFracLength
States
StateWordLength
4-409
dfilt.latticeallpass
k = [.66 .7 .44];
hd=dfilt.latticeallpass(k);
% convert to fixed-point arithmetic
hd.arithmetic = 'fixed';
See Also
4-410
dfilt.latticear
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the autoregressive lattice
filter implemented by dfilt.latticear. To help you see how the filter
processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
4-411
dfilt.latticear
4-412
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
AccumMode
InputFormat
InputWordLength
InputFracLength
None
dfilt.latticear
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
LatticeFormat
CoeffWordLength
LatticeFracLength
CoeffAutoScale
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
ProductFormat
ProductWordLength
ProductFracLength
ProductMode
StateFormat
StateWordLength
StateFracLength
States
Properties
In this table you see the properties associated with the autoregressive
lattice implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-413
dfilt.latticear
4-414
Property Name
Brief Description
AccumFracLength
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
dfilt.latticear
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
FilterStructure
InputFracLength
InputWordLength
Lattice
LatticeFracLength
OutputFracLength
4-415
dfilt.latticear
Property Name
Brief Description
OutputMode
4-416
OutputWordLength
OverflowMode
ProductFracLength
dfilt.latticear
Property Name
Brief Description
ProductMode
ProductWordLength
PersistentMemory
RoundMode
4-417
dfilt.latticear
Property Name
Brief Description
nearest - Round toward nearest. Ties round
toward positive infinity.
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic. Coefficient
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Examples
4-418
Signed
StateFracLength
States
StateWordLength
dfilt.latticear
k = [.66 .7 .44];
hd1=dfilt.latticear(k);
hd1.arithmetic='fixed';
specifyall(hd1);
See Also
4-419
dfilt.latticearma
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
4-420
The following figure shows the signal flow for the autoregressive lattice
filter implemented by dfilt.latticearma. To help you see how the
filter processes the coefficients, input, and states of the filter, as well as
numerical operations, the figure includes the locations of the formatting
objects within the signal flow.
dfilt.latticearma
4-421
dfilt.latticearma
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related
Properties
InputFormat
InputWordLength
InputFracLength
None
LadderAccumFormat AccumWordLength
LadderAccumFracLength AccumMode
LadderFormat
CoeffWordLength
LadderFracLength
CoeffAutoScale
LadderProdFormat
ProductWordLength
LadderProdFracLength
ProductMode
LatticeAccumFormat AccumWordLength
LatticeAccumFracLength
AccumMode
LatticeFormat
CoeffWordLength
LatticeFracLength
CoeffAutoScale
LatticeProdFormat
ProductWordLength
LatticeProdFracLength ProductMode
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
StateFormat
StateWordLength
StateFracLength
States
Properties
4-422
In this table you see the properties associated with the autoregressive
moving-average lattice implementation of dfilt objects.
dfilt.latticearma
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumFracLength
AccumMode
4-423
dfilt.latticearma
4-424
Property Name
Brief Description
AccumWordLength
Arithmetic
CastBeforeSum
CoeffAutoScale
CoeffWordLength
FilterStructure
InputFracLength
InputWordLength
Ladder
dfilt.latticearma
Property Name
Brief Description
Lattice
LatticeFracLength
OutputFracLength
OutputMode
4-425
dfilt.latticearma
4-426
Property Name
Brief Description
OutputWordLength
OverflowMode
ProductFracLength
ProductMode
dfilt.latticearma
Property Name
Brief Description
ProductWordLength
PersistentMemory
RoundMode
4-427
dfilt.latticearma
Property Name
Brief Description
Coefficient and input arithmetic always
round. Finally, products never overflow
they maintain full precision.
See Also
4-428
Signed
StateFracLength
States
StateWordLength
dfilt.latticemamax
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
The following figure shows the signal flow for the maximum phase
implementation of a moving-average lattice filter implemented by
dfilt.latticemamax. To help you see how the filter processes the
coefficients, input, and states of the filter, as well as numerical
4-429
dfilt.latticemamax
4-430
dfilt.latticemamax
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
AccumMode
InputFormat
InputWordLength
InputFracLength
None
LatticeFormat
CoeffWordLength
LatticeFracLength
CoeffAutoScale
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
ProductFormat
ProductWordLength
ProductFracLength
ProductMode
StateFormat
StateWordLength
StateFracLength
States
Properties
In this table you see the properties associated with the maximum phase,
moving average lattice implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
4-431
dfilt.latticemamax
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
4-432
Property Name
Brief Description
AccumFracLength
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
dfilt.latticemamax
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
FilterStructure
InputFracLength
InputWordLength
Lattice
coefficients.
OutputFracLength
4-433
dfilt.latticemamax
Property Name
Brief Description
OutputMode
OutputWordLength
OverflowMode
4-434
dfilt.latticemamax
Property Name
Brief Description
ProductMode
RoundMode
4-435
dfilt.latticemamax
Property Name
Brief Description
nearest - Round toward nearest. Ties round
toward positive infinity.
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic. Coefficient
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Examples
4-436
Signed
StateFracLength
States
StateWordLength
dfilt.latticemamax
See Also
4-437
dfilt.latticemamin
Purpose
Syntax
Description
Fixed-Point
Filter
Structure
4-438
The following figure shows the signal flow for the minimum phase
implementation of a moving-average lattice filter implemented by
dfilt.latticemamin. To help you see how the filter processes the
coefficients, input, and states of the filter, as well as numerical
dfilt.latticemamin
4-439
dfilt.latticemamin
Corresponding
Word Length
Property
Corresponding
Fraction Length
Property
Related Properties
AccumFormat
AccumWordLength
AccumFracLength
AccumMode
InputFormat
InputWordLength
InputFracLength
None
LatticeFormat
CoeffWordLength
LatticeFracLength
CoeffAutoScale
OutputFormat
OutputWordLength
OutputFracLength
OutputMode
ProductFormat
ProductWordLength
ProductFracLength
ProductMode
StateFormat
StateWordLength
StateFracLength
States
Properties
In this table you see the properties associated with the minimum phase,
moving average lattice implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
4-440
dfilt.latticemamin
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
AccumFracLength
AccumMode
AccumWordLength
Arithmetic
CastBeforeSum
4-441
dfilt.latticemamin
Property Name
Brief Description
CoeffAutoScale
CoeffWordLength
FilterStructure
InputFracLength
InputWordLength
Lattice
coefficients.
OutputFracLength
4-442
dfilt.latticemamin
Property Name
Brief Description
OutputMode
OutputWordLength
OverflowMode
4-443
dfilt.latticemamin
Property Name
Brief Description
ProductMode
RoundMode
4-444
dfilt.latticemamin
Property Name
Brief Description
nearest - Round toward nearest. Ties round
toward positive infinity.
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic. Coefficient
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Examples
Signed
StateFracLength
States
StateWordLength
4-445
dfilt.latticemamin
k = [.66 .7 .44];
hd = dfilt.latticemamin(k);
See Also
4-446
dfilt.parallel
Purpose
Syntax
Description
You can also use the standard notation to combine filters into a parallel
structure.
parallel(hd1,hd2,...)
In this syntax, hd1, hd2, and so on can be a mix of dfilt objects, mfilt
objects, and adaptfilt objects.
hd1, hd2, and so on can be fixed-point filters. All filters in the parallel
See Also
4-447
dfilt.scalar
Purpose
Syntax
Description
Properties
In this table you see the properties associated with the scalar
implementation of dfilt objects.
Note The table lists all the properties that a filter can have. Many of
the properties are dynamic, meaning they exist only in response to the
settings of other properties. You might not see all of the listed properties
all the time. To view all the properties for a filter at any time, use
get(hd)
where hd is a filter.
4-448
dfilt.scalar
For further information about the properties of this filter or any dfilt
object, refer to Fixed-Point Filter Properties on page 5-2.
Property Name
Brief Description
Arithmetic
CastBeforeSum
CoeffAutoScale
CoeffFracLength
CoeffWordLength
FilterStructure
Gain
InputFracLength
4-449
dfilt.scalar
Property Name
Brief Description
InputWordLength
data.
OverflowMode
4-450
dfilt.scalar
Property Name
Brief Description
4-451
dfilt.scalar
Examples
Property Name
Brief Description
Signed
States
4-452
dfilt.scalar
and
hd.Stage(2)
See Also
dfilt | dfilt.cascade
4-453
dfilt.wdfallpass
Purpose
Syntax
hd = dfilt.wdfallpass(c)
Description
H ( z) =
c(n) + c(n 1) z1 + + z n
1 + c(1) z1 + + c(n) z n
Properties
4-454
In the next table, the row entries are the filter properties and a brief
description of each property.
dfilt.wdfallpass
Property Name
Brief Description
Filter
Structure
FilterStructure
PersistentMemory
States
When you change the order of the wave digital filters in the cascade, the
filter structure changes as well.
As shown in this example, realizemdl lets you see the filter structure
used for your filter, if you have Simulink installed.
section11=0.8;
section12=[1.5,0.7];
section13=[1.8,0.9];
hd1=dfilt.cascadewdfallpass(section11,section12,section13);
section21=[0.8,0.4];
section22=[0,1.5,0,0.7];
4-455
dfilt.wdfallpass
section23=[0,1.8,0,0.9];
hd2=dfilt.cascadewdfallpass(section21,section22,section23);
% If you have Simulink
realizemdl(hd2)
hd1 has this filter structure with three sections.
4-456
dfilt.wdfallpass
4-457
dfilt.wdfallpass
The filter structure for hd2 is somewhat different, with the different
orders and interconnections between the three sections.
4-458
dfilt.wdfallpass
4-459
dfilt.wdfallpass
Examples
See Also
4-460
disp
Purpose
Syntax
disp(hd)
disp(ha)
disp(hm)
Description
ha=adaptfilt.rls;
fprintf('Displaying properties for default RLS adaptive filter:\n');
fprintf('\n');
disp(ha)
pause(2);
hm=mfilt.cicdecim(6);
fprintf('Displaying properties for cascaded integrator-comb decimator\
fprintf('with a decimation factor of 6:\n');
fprintf('\n');
disp(hm)
See Also
set
4-461
double
Purpose
Syntax
hd = double(h)
Description
Examples
Use the same filter, once with fixed-point arithmetic and once with
floating-point, to compare fixed-point filtering with double-precision
floating-point filtering.
h = dfilt.dffir(firgr(27,[0 .4 .6 1],...
[1 1 0 0]));
% Lowpass filter.
% Set h to use fixed-point arithmetic to filter.
% Quantize the coeffs.
h.arithmetic = 'fixed';
% Cast h to double-precision
hd = double(h);
% Set up an input signal.
n = 0:99; x = sin(0.7*pi*n(:));
y = filter(h,x);
% Fixed-point output.
yd = filter(hd,x);
% Floating-point output.
FixedFloatNormDiff=norm(yd-double(y),inf);
See Also
4-462
reffilter
dsp.util.getLogsArray
Purpose
Syntax
Array =
dsp.util.getLogsArray(LogObject,Format2D,'SignalPath',PATH)
Array =
dsp.util.getLogsArray(LogObject,Format2D,'SignalName',NAME)
Description
Array =
dsp.util.getLogsArray(LogObject,Format2D,'SignalPath',PATH)
Input
Arguments
LogObject
Specify the name of the object that contains your logged signals. Valid
classes for LogObject depend on the syntax you use:
When you specify PATH as a dsp.util.SignalPath object,
LogObject can be either a Simulink.SimulationData.Dataset or
Simulink.SimulationData.Signal object.
When you specify PATH as the full path to a block in a Simulink
model, LogObject must be a Simulink.SimulationData.Dataset
object.
When you specify the NAME of a signal in
LogObject, LogObject can be an object of class
timeseries, Simulink.SimulationData.Dataset, or
Simulink.SimulationData.Signal.
Format2D
4-463
dsp.util.getLogsArray
When you set this property to false, the function returns the logged
signal without any reformatting.
PATH
Specify the path to the logged signal in LogObject. You can specify the
path using a dsp.util.SignalPath object, or you can provide the full
path to a block in your Simulink model. To get the full path to a block
in your Simulink model, use the gcb command.
NAME
Output
Arguments
Array
4-464
dsp.util.getLogsArray
Examples
4-465
dsp.util.getLogsArray
See Also
dsp.util.getSignalPath | dsp.util.SignalPath
| Simulink.SimulationData.BlockPath
| Simulink.SimulationData.Dataset |
Simulink.SimulationData.Signal | timeseries
How To
4-466
dsp.util.getSignalPath
Purpose
Syntax
Description
Tips
Input
Arguments
LogObject
Specify the name of the object that contains your logged signals.
LogObject must be a Simulink.SimulationData.Dataset or
Simulink.SimulationData.Signal object.
SignalName
Output
Arguments
Path
The output Path contains the path to all signals named SignalName
in LogObject.
If LogObject contains a unique signal with name SignalName, the
function returns a single dsp.util.SignalPath object.
If LogObject contains more than one signal with the specified name,
the function returns an array of dsp.util.SignalPath objects.
4-467
dsp.util.getSignalPath
Examples
4-468
dsp.util.getSignalPath
See Also
dsp.util.getLogsArray | dsp.util.SignalPath
| Simulink.SimulationData.Dataset
| Simulink.SimulationData.Signal |
Simulink.SimulationData.updateDatasetFormatLogging
How To
4-469
dsp.util.SignalPath
Purpose
Description
Construction
Properties
SignalName
Provides the output port index of the block from which the logged
signal SignalName originates.
BusElement
4-470
dsp.util.SignalPath
the name of the nested bus followed by the name of the non-bus
signal. For example: nestbus.signal1
When the bus contains nested busses within nested
busses to any depth, BusElement will be a dot-separated
string. This string contains each of the nested bus names,
and ends with the nonbus signal name. For example:
outernestedbus.innernestedbus.signal1
See Also
dsp.util.getLogsArray | dsp.util.getSignalPath
| Simulink.SimulationData.BlockPath |
Simulink.SimulationData.Dataset
4-471
dsp_links
Purpose
Syntax
dsp_links
dsp_links('modelname')
Description
specified model.
Definitions
Obsolete Blocks
Obsolete blocks are blocks that the toolbox no longer supports. In some
cases, these blocks no longer function properly.
Deprecated Blocks
Deprecated blocks are blocks that the toolbox still supports but are
likely to become obsolete in a future release. Refer to the block reference
page for suggested replacements.
Current Blocks
Current blocks are blocks that the toolbox supports and that represent
the latest block functionality.
Examples
Display block support information for the specified model, and then find
the name of the first current block:
sys = 'dspcochlear';
load_system(sys)
% Load the dspcochlear model
links = dsp_links(sys) % Run dsp_links on the model
links.current{1}
% Find the name of the first current block
See Also
4-472
liblinks
dsplib
Purpose
Syntax
dsplib
Description
dsplib opens the top-level DSP System Toolbox block library model.
Examples
Alternatives
To view and gain access to the DSP System Toolbox blocks using the
Simulink library browser:
Type simulink at the MATLAB command line, and then expand the
DSP System Toolbox node in the library browser.
4-473
dspstartup
Purpose
Syntax
dspstartup
Description
appropriate for a typical signal processing project. You can use the
dspstartup function in the following ways:
4-474
dspstartup
Examples
See Also
startup
How To
4-475
ellip
Purpose
Syntax
hd = design(d,'ellip')
hd = design(d,'ellip',designoption,value,designoption,...
value,...)
Description
For complete help about using ellip, refer to the command line help
system. For example, to get specific information about using ellip with
d, the specification object, enter the following at the MATLAB prompt.
help(d,'ellip')
Examples
Example 1
Construct the default bandpass filter specification object and design
an elliptic filter.
d = fdesign.bandpass;
hd = design(d,'ellip','matchexactly','both');
4-476
ellip
Example 2
Construct a lowpass object with order, passband-edge frequency,
stopband-edge frequency, and passband ripple specifications, and then
design an elliptic filter.
d = fdesign.lowpass('n,fp,fst,ap',6,20,25,.8,80);
design(d,'ellip'); % Starts FVtool to display the filter.
Example 3
Construct a lowpass object with filter order, passband edge frequency,
passband ripple, and stopband attenuation specifications, and then
design an elliptic filter.
d = fdesign.lowpass('n,fp,ap,ast',6,20,.8,60,80);
design(d,'ellip'); % Starts FVTool to display the filter.
4-477
ellip
See Also
4-478
euclidfactors
Purpose
Syntax
[lo,mo] = euclidfactors(hm)
Description
or interpolators.
Examples
See Also
polyphase | nstates
4-479
equiripple
Purpose
Syntax
hd = design(d,'equiripple')
hd = design(d,'equiripple',designoption,value,designoption,
...value,...)
Description
halfband or interpolator.
When you use equiripple with Nyquist filter specification objects, you
might encounter design cases where the filter design does not converge.
Convergence errors occur mostly at large filter orders, or small
transition widths, or large stopband attenuations. These specifications,
alone or combined, can cause design failures. For more information,
refer to fdesign.nyquist in the online Help system.
hd = design(d,'equiripple',designoption,value,designoption,
...value,...) returns an equiripple FIR filter where you specify
For complete help about using equiripple, refer to the command line
help system. For example, to get specific information about using
equiripple with d, the specification object, enter the following at the
MATLAB prompt.
help(d,'equiripple')
4-480
equiripple
Displaying the filter in FVTool shows the equiripple nature of the filter.
Magnitude Response (dB)
0
10
20
30
Magnitude (dB)
Examples
40
50
60
70
80
90
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-481
equiripple
Note The MaxPhase design option for equripple FIR filters is currently
only available for lowpass, highpass, bandpass, and bandstop filters.
See Also
4-482
fcfwrite
Purpose
Syntax
fcfwrite(h)
fcfwrite(h,filename)
fcfwrite(...,'fmt')
Description
The default file name is untitled.fcf. When you have DSP System
Toolbox software, you can use fcfwrite(h) to write filter coefficient
files for multirate filters, adaptive filters, and discrete-time filters.
fcfwrite(h,filename) writes the filter coefficients and general
information to a text file called filename in your present MATLAB
working folder and opens the file in the MATLAB editor for you to
review or modify.
If you do not include a file extension in filename, fcfwrite adds the
extension fcf to filename.
fcfwrite(...,'fmt') writes the filter coefficients in the format
specified by the input argument fmt. Valid fmt values are hex for
hexadecimal, dec for decimal, or bin for binary representation of the
filter coefficients.
Examples
4-483
fcfwrite
SOS matrix:
1 2 1 1 -0.22222900390625
1 2 1 1 -0.19903564453125
1 2 1 1 -0.18060302734375
4-484
0.88262939453125
0.68621826171875
0.5303955078125
fcfwrite
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
-0.1658935546875
-0.154052734375
-0.14453125
-0.136962890625
-0.13092041015625
-0.126220703125
-0.12274169921875
-0.12030029296875
-0.118896484375
-0.0592041015625
0.40570068359375
0.305419921875
0.22479248046875
0.16015625
0.10906982421875
0.06939697265625
0.0399169921875
0.01947021484375
0.0074462890625
0
Scale Values:
0.41510009765625
0.371826171875
0.33746337890625
0.3099365234375
0.287841796875
0.27008056640625
0.25579833984375
0.2445068359375
0.23577880859375
0.22930908203125
0.22479248046875
0.22216796875
0.47039794921875
1
To write two or more filters out to one file, provide the filters as a
vector to fcfwrite:
fcfwrite([hd hd1 hd2])
See Also
4-485
fdatool
Purpose
Syntax
fdatool
Description
fdatool opens the Filter Design and Analysis Tool (FDATool). Use
4-486
fdatool
Use the buttons on the sidebar to configure the design area to use
various tools in FDATool.
Set Quantization Parameters provides access to the properties
of the quantizers that compose a quantized filter. When you click
Set Quantization Parameters, you see FDATool displaying the
4-487
fdatool
quantization options at the bottom of the dialog box (the design area),
as shown in the figure.
Transform Filter clicking this button opens the Frequency
Transformations pane so you can use digital frequency transformations
to change the magnitude response of your filter.
Create a multirate filter clicking this button switches FDATool to
multirate filter design mode so you can design interpolators, decimators,
and fractional rate change filters.
Realize Model starting from your quantized, direct-form, FIR filter,
clicking this button creates a Simulink model of your filter structure in
new model window.
4-488
fdatool
Other options in the menu bar let you convert the filter structure to a
new structure, change the order of second-order sections in a filter, or
change the scaling applied to the filter, among many possibilities.
Tips
See Also
4-489
fdesign
Purpose
Syntax
d
d
d
d
Description
=
=
=
=
fdesign.response
fdesign.response(spec)
fdesign.response(...,Fs)
fdesign.response(...,magunits)
4-490
fdesign
fdesign Response
String
Description
arbgrpdelay
arbmag
bandpass filters.
bandstop
bandstop filters.
4-491
fdesign
fdesign Response
String
Description
ciccomp
highpass filters.
hilbert
4-492
fdesign
fdesign Response
String
Description
isinclp
lowpass filters.
notch
4-493
fdesign
doc fdesign.lowpass
doc fdesign.bandstop
Properties
4-494
Default Value
Description
Response
Depends on the
chosen type
Specification
Depends on the
chosen type
fdesign
Property Name
Default Value
Description
Description
Depends on the
filter type you
choose
Contains descriptions of
the filter specifications
used to define the object,
and the filter specifications
you use when you create a
filter from the object. This
is a read-only value.
Description
Specifies the amount to decrease the sampling
rate. Always a positive integer.
4-495
fdesign
Added Properties
for mfilt Objects
Description
factor filters. Total filter length is the product
of pl and the rate change factors. pl must be
an even integer.
use that define your filter design, such as the passband frequency or
the stopband attenuation. The specifications are applied to the filter
design method you choose to design your filter.
For example, when you create a default lowpass filter specification
object, fdesign.lowpass sets the passband frequency Fp, the stopband
frequency Fst, the stopband attenuation Ast, and the passband ripple
Ap :
H = fdesign.lowpass
% Without a terminating semicolon
% the filter specifications are displayed
4-496
fdesign
d = fdesign.lowpass;
% Specification is Fp,Fst,Ap,Ast
Hd = design(d,'equiripple');
length(Hd.Numerator) % returns 43
% Filter order is 42
fvtool(Hd) %view magnitude
When you use any of the design methods without providing an output
argument, the resulting filter design appears in FVTool by default.
4-497
fdesign
Description
setspecs
designmethods
designopts
You can set filter specification values by passing them after the
Specification argument, or by passing the values without the
Specification string.
Filter object constructors take the input arguments in the same
order as setspecs and the order in the strings for Specification.
Enter doc setspecs at the prompt for more information about using
setspecs.
When the first input to fdesign is not a valid Specification string
like n,fc, fdesign assumes that the input argument is a filter
specification and applies it using the default Specification string
fp,fst,ap,ast for a lowpass object, for example.
Examples
4-498
fdesign
butter
cheby1
cheby2
4-499
fdesign
ellip
equiripple
ifir
kaiserwin
multistage
You can use d and the butter design method to design a Butterworth
filter.
hd = design(d,'butter','matchexactly','passband');
fvtool(hd);
4-500
fdesign
See Also
4-501
fdesign.arbgrpdelay
Purpose
Syntax
D
D
D
D
Description
Arbitrary group delay filters are allpass filters you can use for correcting
phase distortion introduced by other filters. fdesign.arbgrpdelay
uses an iterative least p-th norm optimization procedure to minimize
the phase response error [1].
=
=
=
=
fdesign.arbgrpdelay(SPEC)
fdesign.arbgrpdelay(SPEC,SPEC1,SPEC2,...)
fdesign.arbgrpdelay(N,F,Gd)
fdesign.arbgrpdelay(...,Fs)
Tips
4-502
fdesign.arbgrpdelay
Input
Arguments
SPEC
4-503
fdesign.arbgrpdelay
filtorder = 14;
freqband1 = [0 0.1 0.4]; grpdelay1 = [1 2 3];
freqband2 = [0.5 0.8 1]; grpdelay2 = [3 2 1];
D = fdesign.arbgrpdelay('N,B,F,Gd',filtorder,2,freqband1,grpdelay1,freq
Default: 'N,F,Gd'
Fs
Output
Arguments
4-504
fdesign.arbgrpdelay
Definitions
H (e j )
B(e j )
A(e j )
( )
d
Arg( H (e j ))
d
Allpass Systems
The general form of an allpass system function with a real-valued
impulse response is:
M
H ap ( z)
z1 dk
k1 1 dk
( z1 ck )( z1 ck* )
(1 c
z1
k1
kz
)(1 ck* z1 )
4-505
fdesign.arbgrpdelay
where the dk denote the real-valued poles and the ck denote the
complex-valued poles, which occur in conjugate pairs.
The preceding equation demonstrates that allpass systems with
real-valued impulse responses have 2N+M zeros and poles. The poles
and zeros occur in pairs with reciprocal magnitudes. The filter order is
always the same for the numerator and denominator.
Because fdesign.arbgrpdelay uses robust second-order section
(biquad) filter structures to implement the allpass arbitrary group delay
filter, the filter order must be even.
Examples
4-506
fdesign.arbgrpdelay
Filter the input signal with the arbitrary group delay filter and
illustrate the frequency dispersion. The highfrequency wave packet,
which initially preceded the lowfrequency wave packet, now occurs
later because of the nonconstant group delay.
y = filter(Hd,x);
subplot(211)
plot(x); title('Input Signal');
grid on; ylabel('Amplitude');
subplot(212);
plot(y); title('Output Signal'); grid on;
4-507
fdesign.arbgrpdelay
xlabel('Samples'); ylabel('Amplitude');
4-508
10;
[0 0.02 0.04 0.06 0.08 0.1 0.25 0.5 0.75 1];
[5 5 5 5 5 5 4 3 2 1];
[2 2 2 2 2 2 1 1 1 1];
= fdesign.arbgrpdelay(N,f,g);
= design(hgd,'iirlpnorm','Weights',w,'MaxPoleRadius',0.95);
fdesign.arbgrpdelay
fvtool(Hgd,'Analysis','grpdelay') ;
Fs = 1e3;
Hcheby2 = design(fdesign.bandstop('N,Fst1,Fst2,Ast',10,150,400,60,Fs),
f1 = 0.0:0.5:150; % Hz
g1 = grpdelay(Hcheby2,f1,Fs).'/Fs; % seconds
f2 = 400:0.5:500; % Hz
g2 = grpdelay(Hcheby2,f2,Fs).'/Fs; % seconds
4-509
fdesign.arbgrpdelay
4-510
fdesign.arbgrpdelay
Algorithms
References
Alternatives
described in [1].
See Also
How To
4-511
fdesign.arbmag
Purpose
Syntax
D= fdesign.arbmag
D= fdesign.arbmag(SPEC)
D = fdesign.arbmag(SPEC,specvalue1,specvalue2,...)
D = fdesign.arbmag(specvalue1,specvalue2,specvalue3)
D = fdesign.arbmag(...,Fs)
Description
4-512
fdesign.arbmag
Define the frequency vector F as [0 0.25 0.3 0.4 0.5 0.6 0.7 0.75
1.0]
A (Response Desired at F)
0.25
0.3
0.4
4-513
fdesign.arbmag
F (Normalized
Frequency)
A (Response Desired at F)
0.5
0.6
0.7
0.75
1.0
Examples
4-514
fdesign.arbmag
N = 150;
B = 3;
F = [0 .25 .3 .4 .5 .6 .7 .75 1];
A = [1 1 0 0 0 0 0 1 1];
A1 = A(1:2);
A2 = A(3:7);
A3 = A(8:end);
F1 = F(1:2);
F2 = F(3:7);
F3 = F(8:end);
d = fdesign.arbmag('N,B,F,A',N,B,F1,A1,F2,A2,F3,A3);
Hd = design(d);
fvtool(Hd)
A response with two passbands one roughly between 0 and 0.25 and
the second between 0.75 and 1 results from the mapping between
F and A.
4-515
fdesign.arbmag
4-516
fdesign.arbmag
If you have the DSP System Toolbox, you can design a minimum-phase
equiripple filter.
hd2 = design(d,'equiripple','MinPhase',true);
hfvt = fvtool([hd1 hd2],'analysis','polezero');
legend(hfvt,'Equiripple Filter','Minimum-phase Equiripple Filter');
4-517
fdesign.arbmag
4-518
fdesign.arbmag
See Also
4-519
fdesign.arbmagnphase
Purpose
Syntax
d
d
d
d
d
Description
=
=
=
=
=
fdesign.arbmagnphase
fdesign.arbmagnphase(specification)
fdesign.arbmagnphase(specification,specvalue1,specvalue2,...)
fdesign.arbmagnphase(specvalue1,specvalue2,specvalue3)
fdesign.arbmagnphase(...,fs)
the strings shown in the following table. Specification strings are not
case sensitive.
Specification
String
n,f,h
n,b,f,h
nb,na,f,h
4-520
Argument
Description
fdesign.arbmagnphase
Argument
Description
nb
na
Specifying f and h
f and h are the input arguments you use to define the filter
response desired. Each frequency value you specify in f must have a
corresponding response value in h. This example creates a filter with
two passbands (b = 4) and shows how f and h are related. This example
h (Response Desired at f)
0.1
0.5
0.2
0.5
0.4
0.1
0.5
0.1
0.6
0.8
0.9
0.8
1.0
0.0
4-521
fdesign.arbmagnphase
A response with two passbandsone roughly between 0.1 and 0.2 and
the second between 0.6 and 0.9results from the mapping between f
and h. Plotting f and h yields the following figure that resembles a
filter with two passbands.
1
0.9
0.8
0.7
Response
0.6
0.5
0.4
0.3
0.2
0.1
0.1
0.2
0.3
0.4
0.5
0.6
Frequency (normalized)
0.7
0.8
0.9
The second example in Examples shows this plot in more detail with
a complex filter response for h. In the example, h uses complex values
for the response.
Different specification types often have different design methods
available. Use designmethods(d) to get a list of design methods
available for a given specification string and specifications object.
d =
fdesign.arbmagnphase(specification,specvalue1,specvalue2,...)
initializes the filter specification object with specvalue1, specvalue2,
4-522
fdesign.arbmagnphase
Examples
For a more complex example, design a bandpass filter with low group
delay by specifying the desired delay and using f and h to define the
filter bands.
n = 50;
gd = 12;
d=fdesign.arbmagnphase('n,b,f,h',50,3,f1,h1,f2,h2,f3,h3);
D = design(d,'equiripple');
fvtool(D,'Analysis','freq');
4-523
fdesign.arbmagnphase
See Also
4-524
fdesign.audioweighting
Purpose
Syntax
HAwf
HAwf
HAwf
HAwf
HAwf
Description
=
=
=
=
=
fdesign.audioweighting
fdesign.audioweighting(spec)
fdesign.audioweighting(spec,specvalue1,specvalue2)
fdesign.audioweighting(specvalue1,specvalue2)
fdesign.audioweighting(...,Fs)
4-525
fdesign.audioweighting
Input
Arguments
Weighting type
The weighting type defines the frequency response of the filter. The
valid weighting types are: A weighting, C weighting, C-message, ITU-T
0.41, and ITU-R 4684 weighting. The weighting types are described in
Definitions on page 4-527.
Class
Filter Class
Filter class is only applicable for A weighting and C weighting filters.
The filter class describes the frequency-dependent tolerances specified
in the relevant standards [1], [2]. There are two possible class values:
1 and 2. Class 1 weighting filters have stricter tolerances than class 2
filters. The filter class value does not affect the design. The class value
is only used to provide a specification mask in fvtool for the analysis
of the filter design.
4-526
fdesign.audioweighting
Default: 1
Definitions
A weighting
The specifications for the A weighting filter are found in ANSI
standard S1.42-2001. The A weighting filter is based on the 40phon
Fletcher-Munson equal loudness contour [3]. One phon is equal to
one dB sound pressure level (SPL) at one kHz. The Fletcher-Munson
equal loudness contours are designed to account for frequency and level
dependent differences in the perceived loudness of tonal stimuli. The
40phon contour reflects the fact that the human auditory system is
more sensitive to frequencies around 12 kHz than lower and higher
frequencies. The filter roll off is more pronounced at lower frequencies
and more modest at higher frequencies. While A weighting is based on
the equal loudness contour for low-level (40phon) tonal stimuli, it is
commonly used in the United States for assessing potential health risks
associated with noise exposure to narrowband and broadband stimuli
at high levels.
C weighting
The specifications for the C weighting filter are found in ANSI standard
S1.42-2001. The C weighting filter approximates the 100phon
Fletcher-Munson equal loudness contour for tonal stimuli. The C
weighting magnitude response is essentially flat with 3dB frequencies
at 31.5 Hz and 8000 Hz. While C weighting is not as common as A
weighting, sound level meters frequently have a C weighting filter
option.
C-message
The specifications for the Cmessage weighting filter are found in Bell
System Technical Reference, PUB 41009. C-message weighting filters
are designed for measuring the impact of noise on telecommunications
circuits used in speech transmission [6]. C-message weighting filters
are commonly used in North America, while the ITU-T 0.41 filter is
more commonly used outside of North America.
4-527
fdesign.audioweighting
ITU-R 4684
The specifications for the ITU-R 4864 weighting filter are found in
the International Telecommunication Union Recommendation ITU-R
BS.468-4. ITU-R 4864 is an equal loudness contour weighting filter.
Unlike the A weighting filter, the ITU-R 4684 filter describes subjective
loudness judgements for broadband stimuli [4]. A common criticism of
the A weighting filter is that it underestimates the loudness judgement
of real-world stimuli particularly in the frequency band from about 19
kHz. A comparison of A weighting and ITU-R 4684 weighting curves
shows that the ITU-R 4684 curve applies more gain between 1 and 10
kHz with a peak difference of approximately 12 dB around 67 kHz.
ITU-T 0.41
The specifications for the ITU-T 0.41 filter are found in the ITU-T
Recommendation 0.41. ITU-T 0.41 weighting filters are designed for
measuring the impact of noise on telecommunications circuits used in
speech transmission [5]. ITU-T 0.41 weighting filters are commonly
used outside of North America, while the C-message weighting filter is
more common in North America.
Examples
Compare class 1 A weighting and ITU-R 4684 filters between 0.1 and
12 kHz:
HawfA = fdesign.audioweighting('WT,Class','A',1,44.1e3);
% Sampling frequency is 44.1 kHz
HawfITUR = fdesign.audioweighting('WT','ITUR4684',44.1e3);
Afilter = design(HawfA);
ITURfilter = design(HawfITUR);
hfvt = fvtool([Afilter ITURfilter]);
axis([0.1 12 -80 20]);
legend(hfvt,'A-weighting','ITU-R 468-4');
4-528
fdesign.audioweighting
4-529
fdesign.audioweighting
4-530
fdesign.audioweighting
References
4-531
fdesign.audioweighting
See Also
How To
4-532
fdesign.bandpass
Purpose
Syntax
D = fdesign.bandpass
D = fdesign.bandpass(SPEC)
D = fdesign.bandpass(spec,specvalue1,specvalue2,...)
D = fdesign.bandpass(specvalue1,specvalue2,specvalue3,
specvalue4,...specvalue4,specvalue5,specvalue6)
D = fdesign.bandpass(...,Fs)
D = fdesign.bandpass(...,MAGUNITS)
Description
various filter response features, such as the filter order, that govern the
filter design. Valid entries for SPEC are shown below and used to define
the bandpass filter. The strings are not case sensitive.
Note Specifications strings marked with an asterisk require the DSP
System Toolbox software.
'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2' (default spec)
'N,F3dB1,F3dB2'
"N,F3dB1,F3dB2,Ap' *
'N,F3dB1,F3dB2,Ast' *
'N,F3dB1,F3dB2,Ast1,Ap,Ast2' *
'N,F3dB1,F3dB2,BWp *
'N,F3dB1,F3dB2,BWst' *
'N,Fc1,Fc2'
4-533
fdesign.bandpass
'N,Fc1,Fc2,Ast1,Ap,Ast2'
'N,Fp1,Fp2,Ap'
'N,Fp1,Fp2,Ast1,Ap,Ast2'
'N,Fst1,Fp1,Fp2,Fst2'
'N,Fst1,Fp1,Fp2,Fst2,C' *
'N,Fst1,Fp1,Fp2,Fst2,Ap' *
'N,Fst1,Fst2,Ast'
'Nb,Na,Fst1,Fp1,Fp2,Fst2' *
The string entries are defined as follows:
Ap amount of ripple allowed in the pass band. Also called Apass.
Ast1 attenuation in the first stop band in decibels (the default
units). Also called Astop1.
Ast2 attenuation in the second stop band in decibels (the default
units). Also called Astop2.
BWp bandwidth of the filter passband. Specified in normalized
frequency units.
BWst bandwidth of the filter stopband. Specified in normalized
frequency units.
C Constrained band flag. This enables you to specify passband
ripple or stopband attenuation for fixed-order designs in one or two
of the three bands.
In the specification string 'N,Fst1,Fp1,Fp2,Fst2,C', you
cannot specify constraints in both stopbands and the passband
simultaneously. You can specify constraints in any one or two bands.
F3dB1 cutoff frequency for the point 3 dB point below the passband
value for the first cutoff. Specified in normalized frequency units.
(IIR filters)
4-534
fdesign.bandpass
F3dB2 cutoff frequency for the point 3 dB point below the passband
value for the second cutoff. Specified in normalized frequency units.
(IIR filters)
Fc1 cutoff frequency for the point 6 dB point below the passband
value for the first cutoff. Specified in normalized frequency units.
(FIR filters)
Fc2 cutoff frequency for the point 6 dB point below the passband
value for the second cutoff. Specified in normalized frequency units.
(FIR filters)
Fp1 frequency at the edge of the start of the pass band. Specified
in normalized frequency units. Also called Fpass1.
Fp2 frequency at the edge of the end of the pass band. Specified in
normalized frequency units. Also called Fpass2.
Fst1 frequency at the edge of the start of the first stop band.
Specified in normalized frequency units. Also called Fstop1.
Fst2 frequency at the edge of the start of the second stop band.
Specified in normalized frequency units. Also called Fstop2.
N filter order for FIR filters. Or both the numerator and
denominator orders for IIR filters when na and nb are not provided.
Na denominator order for IIR filters
Nb numerator order for IIR filters
Graphically, the filter specifications look similar to those shown in the
following figure.
4-535
fdesign.bandpass
Regions between specification values like Fst1 and Fp1 are transition
regions where the filter response is not explicitly defined.
The filter design methods that apply to a bandpass filter specification
object change depending on the Specification string. Use
designmethods to determine which design methods apply to an object
and the Specification property value.
Use designopts to determine the design options for a given design
method. Enter help(D,METHOD) at the MATLAB command line to
obtain detailed help on the design options for a given design method,
METHOD.
D = fdesign.bandpass(spec,specvalue1,specvalue2,...)
constructs an object D and sets its specifications at construction time.
D = fdesign.bandpass(specvalue1,specvalue2,specvalue3,
specvalue4,...specvalue4,specvalue5,specvalue6)
constructs Dwith the default Specification property string,
4-536
fdesign.bandpass
Examples
d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2',1/4,3/8,5/8,6/8,
Hd = design(d,'equiripple');
4-537
fdesign.bandpass
d = fdesign.bandpass('N,Fst1,Fp1,Fp2,Fst2,C',100,800,1e3,1.4e3,1.6e3,1e4)
d.Stopband1Constrained = true; d.Astop1 = 60;
d.Stopband2Constrained = true; d.Astop2 = 60;
Hd = design(d,'equiripple');
fvtool(Hd);
measure(Hd)
The passband ripple is slightly over 2 dB. Because the design constrains
both stopbands, you cannot constrain the passband ripple.
See Also
4-538
fdesign.bandstop
Purpose
Syntax
D = fdesign.bandstop
D = fdesign.bandstop(SPEC)
D = fdesign.bandstop(SPEC,specvalue1,specvalue2,...)
D = fdesign.bandstop(specvalue1,specvalue2,specvalue3,specvalue4,...
specvalue5,specvalue6,specvalue7)
D = fdesign.bandstop(...,Fs)
D = fdesign.bandstop(...,MAGUNITS)
Description
various filter response features, such as the filter order, that govern
the filter design. Valid entries for SPEC are shown below. The strings
are not case sensitive.
Note Specifications strings marked with an asterisk require the DSP
System Toolbox software.
'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2' (default spec)
'N,F3dB1,F3dB2'
'N,F3dB1,F3dB2,Ap' *
'N,F3dB1,F3dB2,Ap,Ast' *
'N,F3dB1,F3dB2,Ast' *
'N,F3dB1,F3dB2,BWp' *
'N,F3dB1,F3dB2,BWst' *
'N,Fc1,Fc2'
4-539
fdesign.bandstop
'N,Fc1,Fc2,Ap1,Ast,Ap2'
'N,Fp1,Fp2,Ap'
'N,Fp1,Fp2,Ap,Ast'
'N,Fp1,Fst1,Fst2,Fp2'
'N,Fp1,Fst1,Fst2,Fp2,C' *
'N,Fp1,Fst1,Fst2,Fp2,Ap' *
'N,Fst1,Fst2,Ast'
'Nb,Na,Fp1,Fst1,Fst2,Fp2' *
The string entries are defined as follows:
Ap amount of ripple allowed in the passband in decibels (the
default units). Also called Apass.
Ap1 amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass1.
Ap2 amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass2.
Ast attenuation in the first stopband in decibels (the default
units). Also called Astop1.
BWp bandwidth of the filter passband. Specified in normalized
frequency units.
BWst bandwidth of the filter stopband. Specified in normalized
frequency units.
C Constrained band flag. This enables you to specify passband
ripple or stopband attenuation for fixed-order designs in one or two
of the three bands.
In the specification string 'N,Fp1,Fst1,Fst2,Fp2,C', you cannot
specify constraints simultaneously in both passbands and the
stopband. You can specify constraints in any one or two bands.
4-540
fdesign.bandstop
F3dB1 cutoff frequency for the point 3 dB point below the passband
value for the first cutoff.
F3dB2 cutoff frequency for the point 3 dB point below the passband
value for the second cutoff.
Fc1 cutoff frequency for the point 6 dB point below the passband
value for the first cutoff. (FIR filters)
Fc2 cutoff frequency for the point 6 dB point below the passband
value for the second cutoff. (FIR filters)
Fp1 frequency at the start of the pass band. Also called Fpass1.
Fp2 frequency at the end of the pass band. Also called Fpass2.
Fst1 frequency at the end of the first stop band. Also called Fstop1.
Fst2 frequency at the start of the second stop band. Also called
Fstop2.
N filter order.
Na denominator order for IIR filters.
Nb numerator order for IIR filters.
Graphically, the filter specifications look similar to those shown in the
following figure.
4-541
fdesign.bandstop
Regions between specification values like Fp1 and Fst1 are transition
regions where the filter response is not explicitly defined.
The filter design methods that apply to a bandstop filter specification
object change depending on the Specification string. Use
designmethods to determine which design methods apply to an object
and the Specification property value.
Use designopts to determine the design options for a given design
method. Enter help(D,METHOD) at the MATLAB command line to
obtain detailed help on the design options for a given design method,
METHOD.
D = fdesign.bandstop(SPEC,specvalue1,specvalue2,...)
constructs an object D and sets its specifications at construction time.
D =
fdesign.bandstop(specvalue1,specvalue2,specvalue3,specvalue4,...
specvalue5,specvalue6,specvalue7) constructs an object D with the
default Specification property string , using the values you provide in
specvalue1,specvalue2,specvalue3,specvalue4,specvalue5,
specvalue6 and specvalue7.
D = fdesign.bandstop(...,Fs) adds the argument Fs, specified in Hz
to define the sampling frequency. If you specify the sampling frequency
as a trailing scalar, all frequencies in the specifications are in Hz as well.
D = fdesign.bandstop(...,MAGUNITS) specifies the units for any
magnitude specification you provide in the input arguments. MAGUNITS
can be one of
4-542
fdesign.bandstop
Examples
d = fdesign.bandstop('Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2',2/8,3/8,5/8,6/8,1
Hd = design(d,'equiripple');
fvtool(Hd)
Zoom in on the magnitude response plot to verify that the 3-dB down
points are located at 1 and 1.5 kHz.
The following example requires the DSP System Toolbox license.
4-543
fdesign.bandstop
d = fdesign.bandstop('N,Fp1,Fst1,Fst2,Fp2,C',100,800,1e3,1.5e3,1.7e3,1e4)
d.Passband1Constrained = true; d.Apass1 = 0.5;
d.Passband2Constrained = true; d.Apass2 = 0.5;
Hd = design(d,'equiripple');
fvtool(Hd);
measure(Hd)
With this order filter and passband ripple constraints, you achieve
approximately 50 dB of stopband attentuation.
See Also
4-544
fdesign.ciccomp
Purpose
Syntax
d= fdesign.ciccomp
d= fdesign.ciccomp(d,nsections,rcic)
d= fdesign.ciccomp(...,spec)
h = fdesign.ciccomp(...,spec,specvalue1,specvalue2,...)
Description
If the CIC rate change factor is equal to 1, the filter passband response
is an inverse sinc that is an approximation to the true inverse passband
response of the CIC filter.
If you specify a CIC rate change factor not equal to 1, the filter passband
response is an inverse Dirichlet sinc that matches exactly the true
inverse passband response of the CIC filter.
d= fdesign.ciccomp(...,spec) constructs a CIC Compensator
specifications object and sets its Specification property to spec.
4-545
fdesign.ciccomp
'n,fp,fst'
'n,fst,ap,ast'
The string entries are defined as follows:
ap amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass.
ast attenuation in the stop band in decibels (the default units).
Also called Astop.
fc cutoff frequency for the point 6 dB point below the passband
value. Specified in normalized frequency units.
fp frequency at the end of the pass band. Specified in normalized
frequency units. Also called Fpass.
fst frequency at the start of the stop band. Specified in normalized
frequency units. Also called Fstop.
n filter order.
In graphic form, the filter specifications look like this:
4-546
fdesign.ciccomp
constructs an object and sets the specifications in the order they are
specified in the spec input when you construct the object.
4-547
fdesign.ciccomp
20
40
Magnitude (dB)
60
80
100
120
140
160
180
0
10
15
20
25
Frequency (kHz)
30
35
40
45
Given a CIC filter, how do you design a compensator for that filter? CIC
compensators share three defining properties with the CIC filter
differential delay, d; number of sections, numberofsections; and the
usable passband frequency, Fpass.
By taking the number of sections, passband, and differential delay from
your CIC filter and using them in the definition of the CIC compensator,
the resulting compensator filter effectively corrects for the passband
droop of the CIC filter, and narrows the transition region.
As a demonstration of this concept, this example creates a CIC
decimator and its compensator.
fs = 96e3;
% Input sampling frequency.
fpass = 4e3; % Frequency band of interest.
m = 6; % Decimation factor.
hcic = design(fdesign.decimator(m,'cic',1,fpass,60,fs));
4-548
fdesign.ciccomp
hd = cascade(dfilt.scalar(1/gain(hcic)),hcic);
hd(2) = design(fdesign.ciccomp(hcic.differentialdelay, ...
hcic.numberofsections,fpass,4.5e3,.1,60,fs/m));
fvtool(hd(1),hd(2),...
cascade(hd(1),hd(2)),'Fs',[96e3 96e3/m 96e3])
Examples
4-549
fdesign.ciccomp
10
Magnitude (dB)
20
30
40
50
60
70
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
See Also
4-550
fdesign.decimator | fdesign.interpolator
fdesign.comb
Purpose
Syntax
d=fdesign.comb
d=fdesign.comb(combtype)
d=fdesign(combtype,specstring)
d=fdesign(combtype,specstring,specvalue1,specvalue2,...)
d=fdesign.comb(...,Fs)
Description
applies default values for the filter order (N=10) and quality factor
(Q=16).
d=fdesign.comb(combtype) creates a comb filter specification object of
the specified type and applies default values for the filter order and
quality factor. The valid entries for combtype are shown in the following
table. The entries are not case-sensitive.
Argument
Description
notch
peak
'N,Q' (default)
'N,BW'
4-551
fdesign.comb
'L,BW,GWB,Nsh'
The following table describes the arguments in specstring.
4-552
Argument
Description
BW
GWB
fdesign.comb
Argument
Description
Nsh
d=fdesign(combtype,specstring,specvalue1,specvalue2,...) creates
an IIR comb filter specification object of type combtype and sets its
Specification property to the values in specvalue1,specvalue2,...
d=fdesign.comb(...,Fs) creates an IIR comb filter specification object
using the sampling frequency, Fs, of the signal to be filtered. The
function assumes that Fs is in Hertz and must be specified as a scalar
trailing all other provided values.
Examples
4-553
fdesign.comb
Next, create a peaking comb filter with 5 peaks and a quality factor
of 25.
d = fdesign.comb('peak','N,Q',5,25);
Hd = design(d);
fvtool(Hd)
4-554
fdesign.comb
4-555
fdesign.comb
4-556
fdesign.decimator
Purpose
Syntax
D = fdesign.decimator(M)
D = fdesign.decimator(M,RESPONSE)
D = fdesign.decimator(M,PULSESHAPINGRESPONSE,SPS)
D = fdesign.decimator(M,CICRESPONSE,D)
D = fdesign.decimator(M,RESPONSE,SPEC)
D = fdesign.decimator(...,SPEC,specvalue1,specvalue2,...)
D = fdesign.decimator(...,Fs)
D = fdesign.decimator(...,MAGUNITS)
Description
specification string.
Because you are designing multirate filters, the specification strings
available are not the same as the specifications for designing single-rate
filters. The decimation factor M is not included in the specification
strings. Different filter responses support different specifications. The
4-557
fdesign.decimator
'Arbitrary
Magnitude'
'Arbitrary
Magnitude and
Phase'
'Bandpass'
'Bandstop'
'CIC'
'N,Fp1,Fst1,Fst2,Fp2'
attenuation
in decibels.
To 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
specify a CIC decimator, include the(default
string) delay after 'CIC' and before the
differential
filter specification string: 'Fp,Ast'. For
example:
d =
fdesign.decimator(2,'cic',4,'Fp,Ast',0.4,40);
4-558
fdesign.decimator
Design String
'CIC
Compensator'
4-559
fdesign.decimator
Design String
'Highpass'
'Hilbert'
'Inverse-sinc
Lowpass'
4-560
fdesign.decimator
Design String
'Inverse-sinc
Highpass'
'Lowpass'
'N,Fst,Ap,Ast'
4-561
fdesign.decimator
Design String
'Nyquist'
'Raised Cosine'
'Square Root
Raised Cosine'
4-562
fdesign.decimator
such as the filter order, that govern the filter design. Valid entries for
SPEC depend on the RESPONSE type.
Because you are designing multirate filters, the specification strings
available are not the same as the specifications for designing single-rate
filters with such response types as fdesign.lowpass. The strings are
not case sensitive.
The decimation factor M is not in the specification strings.
D = fdesign.decimator(...,SPEC,specvalue1,specvalue2,...)
constructs an object D and sets its specifications at construction time.
D = fdesign.decimator(...,Fs) provides the sampling frequency of
the signal to be filtered. Fs must be specified as a scalar trailing the
other numerical values provided. Fs is assumed to be in Hz as are all
other frequency values provided.
D = fdesign.decimator(...,MAGUNITS) specifies the units for any
magnitude specification you provide in the input arguments. MAGUNITS
can be one of
Examples
4-563
fdesign.decimator
the design input argument, bandpass in this example, when you include
a specification.
d=fdesign.decimator(8,'bandpass',...
'fst1,fp1,fp2,fst2,ast1,ap,ast2');
Pass a new specification type for the filter, specifying the filter order.
Note that the inputs must include the differential delay dd with the CIC
input argument to design a CIC specification object.
m = 5;
dd = 2;
d = fdesign.decimator(m,'cic',dd,'fp,ast',0.55,55);
4-564
fdesign.decimator
See Also
4-565
fdesign.differentiator
Purpose
Syntax
D
D
D
D
D
D
Description
=
=
=
=
=
=
fdesign.differentiator
fdesign.differentiator(SPEC)
fdesign.differentiator(SPEC,specvalue1,specvalue2, ...)
fdesign.differentiator(specvalue1)
fdesign.differentiator(...,Fs)
fdesign.differentiator(...,MAGUNITS)
sensitive.
Note Specifications strings marked with an asterisk require the DSP
System Toolbox software.
'N' Full band differentiator (default)
'N,Fp,Fst' Partial band differentiator
'N,Fp,Fst,Ap' Partial band differentiator *
'N,Fp,Fst,Ast' Partial band differentiator *
'Ap' Minimum order full band differentiator *
'Fp,Fst,Ap,Ast' Minimum order partial band differentiator *
The string entries are defined as follows:
Ap amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass.
Ast attenuation in the stop band in decibels (the default units).
Also called Astop.
4-566
fdesign.differentiator
4-567
fdesign.differentiator
When you omit the MAGUNITS argument, fdesign assumes that all
magnitudes are in decibels. Note that fdesign stores all magnitude
specifications in decibels (converting to decibels when necessary)
regardless of how you specify the magnitudes.
Examples
Filter the modulated signal and take the Hilbert transform to obtain
the envelope.
y1 = filter(Hd,y);
y1 = hilbert(y1);
% Plot the envelope
plot(t.*1000,abs(y1));
xlabel('Milliseconds'); ylabel('Magnitude');
grid on;
title('Envelope of the Demodulated Signal');
4-568
fdesign.differentiator
From the preceding figure, you see that the envelope completes two
cycles every 100 milliseconds. The envelope is oscillating at 20 Hz,
which corresponds to the frequency of the message signal.
Design an FIR differentiator using least squares and plot the zero
phase response.
d = fdesign.differentiator(33); % Filter order is 33.
hd = design(d,'firls');
fvtool(hd,'magnitudedisplay','zero-phase',...
'frequencyrange','[-pi, pi)')
4-569
fdesign.differentiator
4-570
fdesign.differentiator
See Also
design | fdesign
4-571
fdesign.fracdelay
Purpose
Syntax
d
d
d
d
d
Description
=
=
=
=
=
fdesign.fracdelay(delta)
fdesign.fracdelay(delta,'N')
fdesign.fracdelay(delta,'N',n)
fdesign.fracdelay(delta,n)
fdesign.fracdelay(...,fs)
Examples
4-572
fdesign.fracdelay
d = fdesign.fracdelay(50e-6,'N',3,8000);
Hd = design(d, 'lagrange', 'FilterStructure', 'farrowfd');
See Also
4-573
fdesign.halfband
Purpose
Syntax
d = fdesign.halfband
d
d
d
d
d
d
Description
=
=
=
=
=
=
fdesign.halfband('type',type)
fdesign.halfband(spec)
fdesign.halfband(spec,specvalue1,specvalue2,...)
fdesign.halfband(specvalue1,specvalue2)
fdesign.halfband(...,fs)
fdesign.halfband(...,magunits)
filter response features, such as the filter order, that govern the filter
design. Valid entries for spec are shown below. The strings are not
case sensitive.
tw,ast (default spec)
n,tw
n
n,ast
The string entries are defined as follows:
ast attenuation in the stop band in decibels (the default units).
n filter order.
tw width of the transition region between the pass and stop bands.
Specified in normalized frequency units.
4-574
fdesign.halfband
4-575
fdesign.halfband
Examples
For another example, pass the filter values that correspond to the
default Specification n,ast.
d = fdesign.halfband(.01, 80);
In this example, pass the specifications for the filter, and then design
a least-squares FIR filter from the object, using firls as the design
method.
hs = fdesign.halfband('n,tw', 42, .04);
% designmethods(hs)
hd=design(hs,'firls');
4-576
fdesign.halfband
[Hr,W]=zerophase(Hd2);
% Plot and compare response
plot(W,Hr_zerophase,'k','linewidth',2);
xlabel('Radians/sample'); ylabel('Amplitude');
hold on;
plot(W,Hr,'r');
axis tight; grid on;
legend('with ''ZeroPhase'', true','with ''ZeroPhase'' false');
Note that the amplitude of the zero phase response (black line) is
nonnegative for all frequencies.
See Also
4-577
fdesign.highpass
Purpose
Syntax
D = fdesign.highpass
D = fdesign.highpass(SPEC)
D = fdesign.highpass(SPEC,specvalue1,specvalue2,...)
D = fdesign.highpass(specvalue1,specvalue2,specvalue3,
specvalue4)
D = fdesign.highpass(...,Fs)
D = fdesign.highpass(...,MAGUNITS)
Description
various filter response features, such as the filter order, that govern
the filter design. Valid entries for SPEC are shown below. The strings
are not case sensitive.
Note Specifications strings marked with an asterisk require the DSP
System Toolbox software.
'Fst,Fp,Ast,Ap' (default spec)
'N,F3db'
'N,F3db,Ap' *
'N,F3db,Ast' *
'N,F3db,Ast,Ap' *
'N,F3db,Fp *
'N,Fc'
'N,Fc,Ast,Ap'
'N,Fp,Ap'
4-578
fdesign.highpass
'N,Fp,Ast,Ap'
'N,Fst,Ast'
'N,Fst,Ast,Ap'
'N,Fst,F3db' *
'N,Fst,Fp'
'N,Fst,Fp,Ap' *
'N,Fst,Fp,Ast' *
'Nb,Na,Fst,Fp' *
The string entries are defined as follows:
Ap amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass.
Ast attenuation in the stop band in decibels (the default units).
Also called Astop.
F3db cutoff frequency for the point 3 dB point below the passband
value. Specified in normalized frequency units.
Fc cutoff frequency for the point 6 dB point below the passband
value. Specified in normalized frequency units.
Fp frequency at the start of the pass band. Specified in normalized
frequency units. Also called Fpass.
Fst frequency at the end of the stop band. Specified in normalized
frequency units. Also called Fstop.
N filter order.
Na and Nb are the order of the denominator and numerator.
Graphically, the filter specifications look similar to those shown in the
following figure.
4-579
fdesign.highpass
time.
D = fdesign.highpass(specvalue1,specvalue2,specvalue3,
specvalue4) constructs an object D with the default Specification
property and the values you enter for specvalue1,specvalue2,....
D = fdesign.highpass(...,Fs) provides the sampling frequency for
the filter specification object. Fs is in Hz and must be specified as a
4-580
fdesign.highpass
Examples
Query the valid design methods for your filter specification object, d.
designmethods(d)
Create an FIR equiripple filter and view the filter magnitude response
with fvtool.
Hd = design(d,'equiripple');
fvtool(Hd);
4-581
fdesign.highpass
xdft = fft(x);
ydft = fft(y);
plot(freq,abs(xdft(1:length(x)/2+1)));
hold on;
plot(freq,abs(ydft(1:length(y)/2+1)),'r','linewidth',2);
legend('Original Signal','Lowpass Signal', ...
'Location','NorthEast');
ylabel('Magnitude'); xlabel('Radians/Sample');
If you have the DSP System Toolbox software, you can specify the shape
of the stopband and the rate at which the stopband decays.
Create two FIR equiripple filters with different linear stopband slopes.
Specify the passband frequency to be 0.3 radians/sample and the
stopband frequency to be 0.35 radians/sample. Specify 1 dB of
allowable passband ripple and a stopband attenuation of 60 dB. Design
one filter with a 20 dB/rad/sample stopband slope and another filter
with 40 dB/rad/sample.
D = fdesign.highpass('Fst,Fp,Ast,Ap',0.3,0.35,60,1);
Hd1 = design(D,'equiripple','StopBandShape','linear','StopBandDecay',20);
Hd2 = design(D,'equiripple','StopBandShape','linear','StopBandDecay',40);
hfvt = fvtool([Hd1 Hd2]);
legend(hfvt,'20 dB/rad/sample','40 dB/rad/sample');
4-582
fdesign.highpass
See Also
4-583
fdesign.hilbert
Purpose
Syntax
d
d
d
d
d
d
Description
=
=
=
=
=
=
fdesign.hilbert
fdesign.hilbert(specvalue1,specvalue2)
fdesign.hilbert(spec)
fdesign.hilbert(spec,specvalue1,specvalue2)
fdesign.hilbert(...,Fs)
fdesign.hilbert(...,MAGUNITS)
0.1 radians/sample.
d = fdesign.hilbert(specvalue1,specvalue2) constructs a Hilbert
filter designer d assuming the default specification string 'N,TW'. You
input specvalue1 and specvalue2 for N and TW.
d = fdesign.hilbert(spec) initializes the filter designer
Specification property to spec. You provide one of the following
strings as input to replace spec. The specification strings are not case
sensitive.
Note Specifications strings marked with an asterisk require the DSP
System Toolbox software.
'N,TW' default spec string.
'TW,Ap' *
The string entries are defined as follows:
Ap amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass.
N filter order.
TW width of the transition region between the pass and stop bands.
4-584
fdesign.hilbert
Examples
4-585
fdesign.hilbert
4-586
fdesign.hilbert
fvtool(Hd,'analysis','impulse')
4-587
fdesign.hilbert
Plot a the filter input and output and validate the approximate /2
phase shift obtained with the Hilbert transformer.
stem(x(1:end-Delay),'markerfacecolor',[0 0 1]);
hold on;
stem(y,'Color',[1 0 0],'markerfacecolor',[1 0 0]);
axis([10 20 -1.5 1.5]); grid on;
xlabel('Samples'); ylabel('Amplitude');
legend('Input','Output','Location','NorthWest')
4-588
fdesign.hilbert
4-589
fdesign.hilbert
4-590
fdesign.hilbert
See Also
4-591
fdesign.interpolator
Purpose
Syntax
D = fdesign.interpolator(L)
D
D
D
D
D
D
d
Description
=
=
=
=
=
=
=
fdesign.interpolator(L,RESPONSE)
fdesign.interpolator(L,PULSESHAPINGRESPONSE,SPS)
fdesign.interpolator(L,CICRESPONSE,D)
fdesign.interpolator(L,RESPONSE,spec)
fdesign.interpolator(...,spec,specvalue1,specvalue2,...)
fdesign.interpolator(...,Fs)
fdesign.interpolator(...,MAGUNITS)
represent various filter response features, such as the filter order, that
4-592
fdesign.interpolator
govern the filter design. Valid entries for spec depend on the design
type of the specifications object.
When you add the spec input argument, you must also add the
RESPONSE input argument.
Because you are designing multirate filters, the specification strings
available are not the same as the specifications for designing single-rate
filters with design methods such as fdesign.lowpass. The strings
are not case sensitive.
The interpolation factor L is not in the specification strings. The
different filter responses support different specifications. The following
table lists the supported response types and specification strings.
Design String
'Arbitrary
Magnitude'
'Arbitrary
Magnitude and
Phase'
'Bandpass'
'Bandstop'
4-593
fdesign.interpolator
Design String
'CIC'
4-594
fdesign.interpolator
Design String
'Halfband
'Highpass'
'Hilbert'
4-595
fdesign.interpolator
Design String
'Inverse-sinc
Lowpass'
'Inverse-sinc
Highpass'
'Lowpass'
4-596
'N,Fst,Ap,Ast'
fdesign.interpolator
Design String
'Nyquist'
'Raised Cosine'
'Square Root
Raised Cosine'
D = fdesign.interpolator(...,spec,specvalue1,specvalue2,...)
constructs an object D and sets its specifications at construction time.
4-597
fdesign.interpolator
Hz, to define the sampling frequency to use. In this case, all frequencies
in the specifications are in Hz as well.
d = fdesign.interpolator(...,MAGUNITS) specifies the units for any
magnitude specification you provide in the input arguments. MAGUNITS
can be one of
'linear' specify the magnitude in linear units.
'dB' specify the magnitude in dB (decibels).
'squared' specify the magnitude in power units.
When you omit the MAGUNITS argument, fdesign assumes that all
magnitudes are in decibels. Note that fdesign stores all magnitude
specifications in decibels (converting to decibels when necessary)
regardless of how you specify the magnitudes.
Examples
4-598
fdesign.interpolator
Pass a new specification type for the filter, specifying the filter order.
d = fdesign.interpolator(5,'CIC',1,'fp,ast',0.55,55);
d=fdesign.interpolator(8,'bandpass','fst1,fp1,fp2,fst2,ast1,ap,ast2',.
0.25,0.35,.55,.65,50,.05,1e3);
In this, the last example, use the linear option for the filter
specification object and specify the stopband ripple attenuation in
linear form.
d = fdesign.interpolator(4,'lowpass','n,fst,ap,ast',15,0.55,.05,...
1e3,'linear'); % 1e3 = 60dB.
4-599
fdesign.interpolator
dd = 2;
% Differential delay.
fp = 50;
% Passband of interest.
ast = 80;
% Minimum attenuation of alias components in passband.
fs = 600;
% Sampling frequency for input signal.
l
= 32;
% Interpolation factor.
d
= fdesign.interpolator(l,'cic',dd,'fp,ast',fp,ast,l*fs);
hm = design(d); %Use the default design method.
4-600
fdesign.interpolator
80
Magnitude (dB)
60
40
20
20
0
5
Frequency (kHz)
4-601
fdesign.interpolator
20
10
Magnitude (dB)
10
20
30
40
50
60
70
0
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-602
fdesign.interpolator
SingleStage Equiripple
Multistage
Magnitude (dB)
20
40
60
80
See Also
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-603
fdesign.isinchp
Purpose
Syntax
D = fdesign.isinchp
D
D
D
D
D
Description
=
=
=
=
=
fdesign.isinchp(SPEC)
fdesign.isinchp(SPEC,specvalue1,specvalue2,...)
fdesign.isinchp(specvalue1,specvalue2,specvalue3,specvalue4)
fdesign.isinchp(...,Fs)
fdesign.isinchp(...,MAGUNITS)
various filter response features, such as the filter order, that govern
the filter design. Valid entries for SPEC are shown below. The strings
are not case sensitive.
'Fst,Fp,Ast,Ap' (default spec)
'N,Fc,Ast,Ap'
'N,Fst,Fp'
'N,Fp,Ast,Ap'
'N,Fst,Ast,Ap'
The string entries are defined as follows:
Ast attenuation in the stopband in decibels (the default units).
Also called Astop.
Ap amount of ripple allowed in the passband in decibels (the
default units). Also called Apass.
Fp frequency at the start of the passband. Specified in normalized
frequency units. Also called Fpass.
Fst frequency at the end of the stopband. Specified in normalized
frequency units. Also called Fstop.
4-604
fdesign.isinchp
N filter order.
The filter design methods that apply to an inverse sinc highpass
filter specification object change depending on the value of the
Specification property. Use designmethods to determine which
design method applies to a specific Specification.
Use designopts to see the available design options for a specific design
method. Enter help(D,METHOD) at the MATLAB command line to
obtain detailed information on the design options for a given design
method, METHOD.
D = fdesign.isinchp(SPEC,specvalue1,specvalue2,...)
constructs an object D and sets the specifications at construction time.
D =
fdesign.isinchp(specvalue1,specvalue2,specvalue3,specvalue4)
constructs an object D assuming the default Specification
property string 'Fst,Fp,Ast,Ap', using the values you provide in
specvalue1,specvalue2, specvalue3, and specvalue4.
D = fdesign.isinchp(...,Fs) adds the argument Fs, specified in Hz
can be one of
'linear' specify the magnitude in linear units
'dB' specify the magnitude in dB (decibels)
'squared' specify the magnitude in power units
When you omit the MAGUNITS argument, fdesign assumes that all
magnitudes are in decibels. Note that fdesign stores all magnitude
specifications in decibels (converting to decibels when necessary)
regardless of how you specify the magnitudes.
The design method of fdesign.isinchp implements a filter with a
passband magnitude response equal to:
4-605
fdesign.isinchp
H ( ) sinc(C(1 )) P
You can control the values of the sinc frequency factor, C, and the sinc
power, P, using the 'SincFrequencyFactor' and 'SincPower' options
in the design method. 'SincFrequencyFactor' and 'SincPower'
default to 0.5 and 1 respectively.
Examples
Design a minimum order inverse sinc highpass filter and shape the
stopband to have a slope of 20 dB/radian/sample.
d = fdesign.isinchp('Fst,Fp,Ast,Ap',.4,.5,40,0.01);
Hd = design(d);
% Shape the stopband to have a linear slope of 20 dB/rad/sample
Hd1 = design(d,'StopbandShape','linear','StopbandDecay',20);
fvtool(Hd,Hd1);
4-606
fdesign.isinchp
Design a 50th order inverse sinc highpass filter. Set the sinc frequency
factor to 0.25, and the sinc power to 16 to achieve a magnitude response
in the passband of the form H() = sinc(0.25*(1-))^(-16) .
d = fdesign.isinchp('N,Fst,Fp',50,.4,.5);
Hd = design(d,'SincFrequencyFactor',0.25,'SincPower',16);
fvtool(Hd);
See Also
4-607
fdesign.isinclp
Purpose
Syntax
d = fdesign.isinclp
d
d
d
d
d
Description
=
=
=
=
=
fdesign.isinclp(spec)
fdesign.isinclp(spec,specvalue1,specvalue2,...)
fdesign.isinclp(specvalue1,specvalue2,specvalue3,specvalue4)
fdesign.isinclp(...,Fs)
fdesign.isinclp(...,MAGUNITS)
filter response features, such as the filter order, that govern the filter
design. Valid entries for spec are shown below. The strings are not
case sensitive.
'Fp,Fst,Ap,Ast' (default spec)
'N,Fc,Ap,Ast'
'N,Fp,Ap,Ast'
'N,Fp,Fst'
'N,Fst,Ap,Ast'
The string entries are defined as follows:
Ast attenuation in the stopband in decibels (the default units).
Also called Astop.
Ap amount of ripple allowed in the passband in decibels (the
default units). Also called Apass.
Fp frequency at the start of the passband. Specified in normalized
frequency units. Also called Fpass.
Fst frequency at the end of the stopband. Specified in normalized
frequency units. Also called Fstop.
4-608
fdesign.isinclp
N filter order.
The filter design methods that apply to an inverse sinc lowpass filter
specification object change depending on the Specification string.
Use designmethods to determine which design method applies to an
object and its specification string.
d = fdesign.isinclp(spec,specvalue1,specvalue2,...)
constructs an object d and sets its specifications at construction time.
d =
fdesign.isinclp(specvalue1,specvalue2,specvalue3,specvalue4)
constructs an object d assuming the default Specification
property string 'Fp,Fst,Ap,Ast', using the values you provide in
specvalue1,specvalue2, specvalue3, and specvalue4.
d = fdesign.isinclp(...,Fs) adds the argument Fs, specified in Hz
can be one of
'linear' specify the magnitude in linear units
'dB' specify the magnitude in dB (decibels)
'squared' specify the magnitude in power units
When you omit the MAGUNITS argument, fdesign assumes that all
magnitudes are in decibels. Note that fdesign stores all magnitude
specifications in decibels (converting to decibels when necessary)
regardless of how you specify the magnitudes.
The design method of fdesign.isinclp implements a filter with a
passband magnitude response equal to:
H ( ) sinc(C ) P
You can control the values of the sinc frequency factor, C, and the sinc
power, P, using the 'SincFrequencyFactor' and 'SincPower' options
4-609
fdesign.isinclp
Examples
Design a 50th order inverse sinc lowpass filter. Set the sinc frequency
factor to 0.25 and the sinc power to 16 to achieve a magnitude response
in the passband of the form H(w) = sinc(0.25*w)^(-16) .
d = fdesign.isinclp('N,Fp,Fst',50,.4,.5);
Hd = design(d,'SincFrequencyFactor',0.25,'SincPower',16);
fvtool(Hd, 'MagnitudeDisplay', 'Magnitude');
4-610
fdesign.isinclp
See Also
4-611
fdesign.lowpass
Purpose
Syntax
D
D
D
D
D
D
Description
=
=
=
=
=
=
fdesign.lowpass
fdesign.lowpass(SPEC)
fdesign.lowpass(SPEC,specvalue1,specvalue2,...)
fdesign.lowpass(specvalue1,specvalue2,specvalue3,specvalue4)
fdesign.lowpass(...,Fs)
fdesign.lowpass(...,MAGUNITS)
4-612
fdesign.lowpass
'N,Fp,Ap,Ast'
'N,Fp,Fst,Ap' *
'N,Fp,F3db' *
'N,Fp,Fst'
'N,Fp,Fst,Ast' *
'N,Fst,Ap,Ast' *
'N,Fst,Ast'
'Nb,Na,Fp,Fst' *
The string entries are defined as follows:
Ap amount of ripple allowed in the pass band in decibels (the
default units). Also called Apass.
Ast attenuation in the stop band in decibels (the default units).
Also called Astop.
F3db cutoff frequency for the point 3 dB point below the passband
value. Specified in normalized frequency units.
Fc cutoff frequency for the point 6 dB point below the passband
value. Specified in normalized frequency units.
Fp frequency at the start of the pass band. Specified in normalized
frequency units. Also called Fpass.
Fst frequency at the end of the stop band. Specified in normalized
frequency units. Also called Fstop.
N filter order.
Na and Nb are the order of the denominator and numerator.
Graphically, the filter specifications look similar to those shown in the
following figure.
4-613
fdesign.lowpass
4-614
fdesign.lowpass
When you omit the MAGNUNITS argument, fdesign assumes that all
magnitudes are in decibels. Note that fdesign stores all magnitude
specifications in decibels (converting to decibels when necessary)
regardless of how you specify the magnitudes.
Examples
Query the valid design methods for your filter specification object, d.
designmethods(d)
Create an FIR equiripple filter and view the filter magnitude response
with fvtool.
Hd = design(d,'equiripple');
fvtool(Hd);
4-615
fdesign.lowpass
See Also
4-616
fdesign.notch
Purpose
Syntax
d
d
d
d
Description
=
=
=
=
4-617
fdesign.notch
Examples
4-618
fdesign.notch
See Also
fdesign | fdesign.peak
4-619
fdesign.nyquist
Purpose
Syntax
d = fdesign.nyquist
d
d
d
d
d
Description
=
=
=
=
=
fdesign.nyquist(l,spec)
fdesign.nyquist(l,spec,specvalue1,specvalue2,...)
fdesign.nyquist(l,specvalue1,specvalue2)
fdesign.nyquist(...,fs)
fdesign.nyquist(...,magunits)
4-620
fdesign.nyquist
tw width of the transition region between the pass and stop bands.
Specified in normalized frequency units.
The filter design methods that apply to a Nyquist filter specification
object change depending on the Specification string. Use
designmethods to determine which design method applies to an object
and its specification string. Different filter design methods also have
options that you can specify. Use designopts with the design method
string to see the available options. For example:
f=fdesign.nyquist(4,'N,TW');
designmethods(f)
d = fdesign.nyquist(l,spec,specvalue1,specvalue2,...)
constructs an object d and sets its specification to spec, and the
specification values to specvalue1, specvalue2, and so on at
construction time.
d = fdesign.nyquist(l,specvalue1,specvalue2) constructs an
object d with the values you provide in l, specvalue1,specvalue2 as
the values for l, tw and ast.
d = fdesign.nyquist(...,fs) adds the argument fs, specified in Hz
to define the sampling frequency to use. In this case, all frequencies in
the specifications are in Hz as well.
d = fdesign.nyquist(...,magunits) specifies the units for any
magnitude specification you provide in the input arguments. magunits
can be one of
4-621
fdesign.nyquist
Examples
4-622
fdesign.nyquist
4-623
fdesign.nyquist
Note that the amplitude of the zero phase response (black line) is
nonnegative for all frequencies.
See Also
4-624
fdesign.octave
Purpose
Syntax
d
d
d
d
Description
=
=
=
=
fdesign.octave(l)
fdesign.octave(l, MASK)
fdesign.octave(l, MASK, spec)
fdesign.octave(..., Fs)
'class 0'
'class 1'
'class 2'
d = fdesign.octave(l, MASK, spec) constructs an octave filter
specification object d with l bands per octave, MASK specification for the
FVTool, and the spec specification string. The specification strings
available are:
'N, F0'
(not case sensitive), where:
N is the filter order
F0 is the center frequency. The center frequency is specified in
normalized frequency units assuming a sampling frequency of
48 kHz, unless a sampling frequency in Hz is included in the
specification: d = fdesign.octave(..., Fs). If you specify an
invalid center frequency, a warning is issued and the center frequency
is rounded to the nearest valid value. You can determine the valid
center frequencies for your design by using validfrequencies with
your octave filter specification object. For example:
d = fdesign.octave(1,'Class 1','N,F0',6,1000,44.1e3);
validcenterfreq = validfrequencies(d);
4-625
fdesign.octave
G = 10^(3/10);
x = -1000:1350;
validcenterfreq = 1000*(G.^((2*x-59)/(2*L)));
validcenterfreq = validcenterfreq(validcenterfreq>20 & validcenterfre
Only center frequencies greater than 20 and less than 20000 are
retained. Choosing a center frequency greater than your Nyquist
frequency (1/2 the sampling rate) results in an error when you
design the filter. If you do not specify a sampling frequency, the
remaining center frequencies are divided by 24000 to obtain valid
normalized center frequencies. For fdesign.octave, normalized
frequency assumes a sampling frequency of 48 kHz.
validcenterfreq = validcenterfreq/24000;
G = 10^(3/10);
x = -1000:1350;
validcenterfreq = 1000*(G.^((x-30)/L));
validcenterfreq = validcenterfreq(validcenterfreq>20 & validcenterf
4-626
fdesign.octave
frequency of 48 kHz.
validcenterfreq = validcenterfreq/24000;
Examples
The following figure shows the magnitude response plot of the filter.
The logarithmic scale for frequency is automatically set by FVTool for
the octave filters.
See Also
4-627
fdesign.parameq
Purpose
Syntax
Description
follows:
'F0, BW, BWp, Gref, G0, GBW, Gp' (minimum order default)
'F0, BW, BWst, Gref, G0, GBW, Gst'
'F0, BW, BWp, Gref, G0, GBW, Gp, Gst'
'N, F0, BW, Gref, G0, GBW'
'N, F0, BW, Gref, G0, GBW, Gp'
'N, F0, Fc, Qa, G0'
'N, F0, Fc, S, G0'
'N, F0 ,BW, Gref, G0, GBW, Gst'
'N, F0, BW, Gref, G0, GBW, Gp, Gst'
'N, Flow, Fhigh, Gref, G0, GBW'
'N, Flow, Fhigh, Gref, G0, GBW, Gp'
'N, Flow, Fhigh, Gref, G0, GBW, Gst'
'N, Flow, Fhigh, Gref, G0, GBW, Gp, Gst'
where the parameters are defined as follows:
BW Bandwidth
BWp Passband Bandwidth
BWst Stopband Bandwidth
Gref Reference Gain (decibels)
4-628
fdesign.parameq
Examples
4-629
fdesign.parameq
Design a 4th order audio lowpass (F0 = 0) shelving filter with cutoff
frequency of Fc = 0.25, quality factor Qa =10, and boost gain of G0 = 8
dB:
d = fdesign.parameq('N,F0,Fc,Qa,G0',4,0,0.25,10,8);
Hd = design(d);
fvtool(Hd)
4-630
fdesign.parameq
4-631
fdesign.parameq
See Also
fdesign
How To
4-632
fdesign.peak
Purpose
Syntax
d
d
d
d
Description
=
=
=
=
4-633
fdesign.peak
cheby1
d = fdesign.peak(n,f0,q) constructs a peaking filter specification
Examples
4-634
fdesign.peak
fvtool(Hd)
See Also
4-635
fdesign.polysrc
Purpose
Syntax
d = fdesign.polysrc(l,m)
d = fdesign.polysrc(l,m,'Fractional Delay','Np',Np)
d = fdesign.polysrc(...,Fs)
Description
Examples
This example shows how to design sample-rate converter that uses a 3rd
order Lagrange interpolation filter to convert from 44.1kHz to 48kHz:
[L,M] = rat(48/44.1);
f = fdesign.polysrc(L,M,'Fractional Delay','Np',3);
Hm = design(f,'lagrange');
% Original sampling frequency
Fs = 44.1e3;
% 9408 samples, 0.213 seconds long
n = 0:9407;
% Original signal, sinusoid at 1kHz
x = sin(2*pi*1e3/Fs*n);
% 10241 samples, still 0.213 seconds
y = filter(Hm,x);
% Plot original sampled at 44.1kHz
stem(n(1:45)/Fs,x(1:45))
hold on
% Plot fractionally interpolated signal (48kHz) in red
stem((n(3:51)-2)/(Fs*L/M),y(3:51),'r','filled')
xlabel('Time (sec)');ylabel('Signal value')
legend('44.1 kHz sample rate','48 kHz sample rate')
4-636
fdesign.polysrc
For more information about Farrow SRCs, see the Efficient Sample
Rate Conversion between Arbitrary Factors example, efficientsrcdemo.
See Also
fdesign
4-637
fdesign.pulseshaping
Purpose
Syntax
D
D
D
d
d
d
Description
=
=
=
=
=
=
fdesign.pulseshaping
fdesign.pulseshaping(sps)
fdesign.pulseshaping(sps,shape)
fdesign.pulseshaping(sps,shape,spec,value1,value2,...)
fdesign.pulseshaping(...,fs)
fdesign.pulseshaping(...,magunits)
'Raised Cosine'
'Square Root Raised Cosine'
'Gaussian'
d = fdesign.pulseshaping(sps,shape,spec,value1,value2,...)
constructs d where spec defines the Specification properties. The
string entries for spec specify various properties of the filter, including
the order and frequency response. Valid entries for spec depend upon
the shape property. For 'Raised Cosine' and 'Square Root Raised
Cosine' filters, the valid entries for spec are:
4-638
fdesign.pulseshaping
'N,Beta'
The string entries are defined as follows:
Ast stopband attenuation (in dB). The default stopband attenuation
for a raised cosine filter is 60 dB. The default stopband attenuation
for a square root raised cosine filter is 30 dB. If Ast is specified, the
minimum-order filter is returned.
Beta rolloff factor expressed as a real-valued scalar ranging from 0
to 1. Smaller rolloff factors result in steeper transitions between the
passband and stopband of the filter.
Nsym filter order in symbols. The length of the impulse
response is given by Nsym*SamplesPerSymbol+1. The product
Nsym*SamplesPerSymbol must be even.
N filter order (must be even). The length of the impulse response
is N+1.
If the shape property is specified as 'Gaussian', the valid entries for
spec are:
'Nsym,BT' (default)
The string entries are defined as follows:
Nsymfilter order in symbols. Nsym defaults to 6. The length of the
filter impulse response is Nsym*SamplesPerSymbol+1. The product
Nsym*SamplesPerSymbol must be even.
BT the 3dB bandwidth-symbol time product. BT is a positive
real-valued scalar, which defaults to 0.3. Larger values of BT produce
a narrower pulse width in time with poorer concentration of energy
in the frequency domain.
d = fdesign.pulseshaping(...,fs) specifies the sampling frequency
of the signal to be filtered. fs must be specified as a scalar trailing the
other numerical values provided. For this case, fs is assumed to be in
Hz and is used for analysis and visualization.
4-639
fdesign.pulseshaping
Examples
Pulse-shaping can be used to change the waveform of transmitted pulses
so the signal bandwidth matches that of the communication channel.
This helps to reduce distortion and intersymbol interference (ISI).
This example shows how to design a minimum-order raised cosine filter
that provides a stop band attenuation of 60 dB, rolloff factor of 0.50,
and 8 samples per symbol.
h
= fdesign.pulseshaping(8,'Raised Cosine','Ast,Beta',60,0.50);
Hd = design(h);
fvtool(Hd)
4-640
fdesign.pulseshaping
This example shows how to design a raised cosine filter that spans 8
symbol durations (i.e., of order 8 symbols), has a rolloff factor of 0.50,
and oversampling factor of 10.
h
= fdesign.pulseshaping(10,'Raised Cosine','Nsym,Beta',8,0.50);
Hd = design(h);
fvtool(Hd, 'impulse')
4-641
fdesign.pulseshaping
This example shows how to design a square root raised cosine filter of
order 42, rolloff factor of 0.25, and 10 samples per symbol.
h
4-642
fdesign.pulseshaping
4-643
fdesign.rsrc
Purpose
Syntax
D
D
D
D
D
D
D
D
Description
=
=
=
=
=
=
=
=
fdesign.rsrc(L,M)
fdesign.rsrc(L,M,RESPONSE)
fdesign.rsrc(L,M,PULSESHAPINGRESPONSE,SPS)
fdesign.rsrc(L,M,CICRESPONSE,D)
fdesign.rsrc(L,M,RESPONSE,SPEC)
fdesign.rsrc(L,M,SPEC,specvalue1,specvalue2,...)
fdesign.rsrc(...,Fs)
fdesign.rsrc(...,MAGUNITS)
default values for the transition width and stopband attenuation in the
Nyquist design are 0.1 radians/sample and 80 dB. If L is unspecified, L
defaults to 3. If M is unspecified, M defaults to 2.
D = fdesign.rsrc(L,M,RESPONSE) constructs an rational-factor
sample-rate converter with the interpolation factor L, decimation factor
M, and the response you specify in RESPONSE.
D = fdesign.rsrc(L,M,PULSESHAPINGRESPONSE,SPS) constructs a
4-644
fdesign.rsrc
'Arbitrary
Magnitude'
'Arbitrary
Magnitude and
Phase'
'Bandpass'
'Bandstop'
'CIC'
'N,Fp1,Fst1,Fst2,Fp2'
frequency,
Ap is the passband ripple, and Ast is
the
stopband
attenuation in decibels. (default
'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
To string)
specify a CIC rational-factor sample-rate
convertor, include the differential delay after
'CIC' and before the filter specification string:
'Fp,Ast'. For example:
d = fdesign.rsrc(2,2,'cic',4);
4-645
fdesign.rsrc
Design String
'CIC
Compensator'
4-646
fdesign.rsrc
Design String
'Highpass'
'Hilbert'
'Inverse-sinc
Lowpass'
4-647
fdesign.rsrc
Design String
'Inverse-sinc
Highpass'
'Lowpass'
4-648
'N,Fst,Ap,Ast'
fdesign.rsrc
Design String
'Nyquist'
'Raised Cosine'
'Square Root
Raised Cosine'
various filter response features, such as the filter order, that govern
4-649
fdesign.rsrc
the filter design. Valid entries for SPEC depend on the design type of
the specifications object.
When you add the SPEC input argument, you must also add the
RESPONSE input argument.
D = fdesign.rsrc(L,M,SPEC,specvalue1,specvalue2,...)
constructs an object D and sets its specifications at construction time.
D = fdesign.rsrc(...,Fs) provides the sampling frequency of the
signal to be filtered. Fs must be specified as a scalar trailing the other
numerical values provided. Fs is assumed to be in Hz as are all other
frequency values provided.
D = fdesign.rsrc(...,MAGUNITS) specifies the units for any
magnitude specification you provide in the input arguments. MAGUNITS
can be one of
Examples
4-650
fdesign.rsrc
specification string. Set the order equal to 12 and the transition width
to 0.1 radians/sample. The Lth band factor in the Nyquist design is
equal to the interpolation factor.
d = fdesign.rsrc(5,3,'nyquist',5,'N,TW',12,0.1);
See Also
4-651
fftcoeffs
Purpose
Frequency-domain coefficients
Syntax
c = fftcoeffs(hd)
c = fftcoeffs(ha)
Description
adaptfilt.fdaf
adaptfilt.pbfdaf
adaptfilt.pbufdaf
adaptfilt.ufdaf
Examples
Similarly, you can use fftcoeffs with the adaptive filters algorithms
listed above. Start by constructing an adaptive filter ha.
d = 16;
% Number of samples of delay.
b = exp(1j*pi/4)*[-0.7 1]; % Numerator coefficients of channel.
a = [1 -0.7];
% Denominator coefficients of channel.
ntr= 1000;
% Number of iterations.
s = sign(randn(1,ntr+d)) +...
1j*sign(randn(1,ntr+d));
% Baseband QPSK signal.
n = 0.1*(randn(1,ntr+d) + 1j*randn(1,ntr+d)); % Noise signal.
r = filter(b,a,s)+n;
% Received signal.
4-652
fftcoeffs
x = r(1+d:ntr+d);
% Input signal (received signal).
s = s(1:ntr);
% Desired signal (delayed QPSK signal).
del = 1;
% Initial FFT input powers.
mu = 0.1;
% Step size.
lam = 0.9;
% Averaging factor.
blocksize
= 8;
% Block size.
ha = adaptfilt.pbufdaf(32,mu,1,del,lam,blocksize);
See Also
4-653
filter
Purpose
Syntax
Description
This reference page contains three sections that describe the syntaxes
for the filter objects:
Fixed-Point Filter Syntaxes on page 4-654
Adaptive Filter Syntaxes on page 4-655
Multirate Filter Syntaxes on page 4-656
4-654
filter
When you are filtering multichannel data, dim lets you specify which
dimension of the input matrix to filter along whether a row
represents a channel or a column represents a channel. When you
provide the dim input argument, the filter operates along the dimension
specified by dim. When your input data x is a vector or matrix and dim
is 1, each column of x is treated as a one input channel. When dim is 2,
the filter treats each row of the input x as a channel.
To filter multichannel data in a loop environment, you must use the dim
input argument to set the proper processing dimension.
You specify the initial conditions for each channel individually, when
needed, by setting hm.states to a matrix of nstates(hd) rows (one row
containing the states for one channel of input data) and size(x,2)
columns (one column containing the filter states for each channel).
4-655
filter
When you are filtering multichannel data, dim lets you specify which
dimension of the input matrix to filter along whether a row
represents a channel or a column represents a channel. When you
provide the dim input argument, the filter operates along the dimension
specified by dim. When your input data x is a vector or matrix and dim
is 1, each column of x is treated as a one input channel. When dim is 2,
the filter treats each row of the input x as a channel.
To filter multichannel data in a loop environment, you must use the dim
input argument to set the processing dimension.
You specify the initial conditions for each channel individually, when
needed, by setting hm.states to a matrix of nstates(hm) rows (one row
containing the states for one channel of input data) and size(x,2)
columns (one column containing the filter states for each channel).
The number of data samples in your input data set x does not need to
be a multiple of the rate change factor r for the object. When the rate
change factor is not an even divisor of the number of input samples x,
filter processes the samples as shown in the following figure, where
the rate change factor is 3 and the number of input samples is 23.
Decimators always take the first input sample to generate the first
output sample. After that, the next output sample comes after each r
number of input samples.
4-656
filter
Examples
{
{
{
{
{
{
{
2 Processed Samples
That Did Not Generate
An Output Sample
% 'PersistentMemory'='false'(default).
% Final conditions.
Now use nonzero initial conditions by setting ICs after before you filter.
hd.persistentmemory = true;
hd.states = 1;
% Uses scalar expansion.
y2 = filter(hd,x);
stem([y1 y2])
% Different sequences at beginning.
Looking at the stem plot shows that the sequences are different at the
beginning of the filter process.
4-657
filter
1.5
Filter without ICs
Filter with ICs set
Filter Response
0.5
0.5
10
20
30
Samples
40
50
60
4-658
filter
Filter Response
0.5
0.5
1.5
10
20
30
40
50
60
Input Samples
70
80
90
100
%
%
%
%
%
4-659
filter
This time, set nonzero initial conditions before filtering the data.
hm.persistentmemory = true;
hm.states = 1;
% Uses scalar expansion to set ICs.
y2 = filter(hm,x);
stem([y1(1:60) y2(1:60)]) % Show the filtering results.
Algorithms
Quantized Filters
The filter command implements fixed- or floating-point arithmetic
on the quantized filter structure you specify.
The algorithm applied by filter when you use a discrete-time filter
object on an input signal depends on the response you chose for the
filter, such as lowpass or Nyquist or bandstop. To learn more about
each filter algorithm, refer to the literature reference provided on the
appropriate discrete-time filter reference page.
4-660
filter
Adaptive Filters
The algorithm used by filter when you apply an adaptive filter object
to a signal depends on the algorithm you chose for your adaptive
filter. To learn more about each adaptive filter algorithm, refer to the
literature reference provided on the appropriate adaptfilt.algorithm
reference page.
Multirate Filters
The algorithm applied by filter when you apply a multirate filter
objects to signals depends on the algorithm you chose for the filter
the form of the multirate filter, such as decimator or interpolator. To
learn more about each filter algorithm, refer to the literature reference
provided on the appropriate multirate filter reference page.
References
See Also
4-661
filterbuilder
Purpose
Syntax
filterbuilder(h)
filterbuilder('response')
Description
4-662
filterbuilder
Note You must have the DSP System Toolbox software to create
and import filter System objects.
Enter filterbuilder('response'), replacing response with a
response string from the following table. MATLAB opens a filter
design dialog that corresponds to the response string.
Note You must have the DSP System Toolbox software to implement
a number of the filter designs listed in the following table. If you only
have the Signal Processing Toolbox software, you can design a limited
set of the following filter-response types.
Response String
Description of
Resulting Filter
Design
Filter Object
arbgrpdelay
fdesign.arbgrpdelay
arbmag
Arbitrary magnitude
filter design
fdesign.arbmag
arbmagnphase
Arbitrary response
filter (magnitude and
phase)
fdesign.arbmagnphase
audioweighting
fdesign.audioweighting
bandpass or bp
Bandpass filter
fdesign.bandpass
bandstop or bs
Bandstop filter
fdesign.bandstop
cic
CIC filter
fdesign.decimator(M,'cic',...
ciccomp
CIC compensator
fdesign.interpolator(L,'cic',
fdesign.ciccomp
comb
Comb filter
fdesign.comb
fdesign.decimator
or
See
and
fdesign.interpolator
4-663
filterbuilder
Response String
Description of
Resulting Filter
Design
Filter Object
diff
Differentiator filter
fdesign.differentiator
fracdelay
fdesign.fracdelay
halfband or hb
Halfband filter
fdesign.halfband
highpass or hp
Highpass filter
fdesign.highpass
hilb
Hilbert filter
fdesign.hilbert
isinc,
isinclp, or
isinchp
fdesign.isinclp
lowpass or lp
Lowpass filter
(default)
fdesign.lowpass
notch
Notch filter
fdesign.notch
nyquist
Nyquist filter
fdesign.nyquist
octave
Octave filter
fdesign.octave
parameq
Parametric equalizer
filter
fdesign.parameq
peak
Peak filter
fdesign.peak
pulseshaping
Pulse-shaping filter
fdesign.pulseshaping
and
fdesign.isinchp
4-664
filterbuilder
As you choose the response for the filter, the available options and
design parameters displayed in the dialog box change. This display
allows you to focus only on parameters that make sense in the context
of your filter design.
4-665
filterbuilder
Every filter design dialog box includes the options displayed at the top
of the dialog box, shown in the following figure.
4-666
filterbuilder
The Arithmetic drop down box allows the choice of Double precision,
Single precision, or Fixed point. Some of these options may be
unavailable depending on the filter parameters. The following table
describes these options.
Arithmetic List
Entry
Double precision
4-667
filterbuilder
Arithmetic List
Entry
Single precision
Fixed point
The following figure shows the Data Types pane after you select Fixed
point for Arithmetic and set Filter internals to Specify precision.
This figure shows the Data Types pane for the case where the Use a
System object to implement filter check box is not selected in the
Main pane.
4-668
filterbuilder
4-669
filterbuilder
Input signal
Specify the format the filter applies to data to be filtered. For all
cases, filterbuilder implements filters that use binary point
scaling and signed input. You set the word length and fraction
length as needed.
Coefficients
Choose how you specify the word length and the fraction length of
the filter numerator and denominator coefficients:
Specify word length enables you to enter the word length
of the coefficients in bits. In this mode, filterbuilder
automatically sets the fraction length of the coefficients to
the binary-point only scaling that provides the best possible
precision for the value and word length of the coefficients.
Binary point scaling enables you to enter the word
length and the fraction length of the coefficients in bits. If
applicable, enter separate fraction lengths for the numerator
and denominator coefficients.
The filter coefficients do not obey the Rounding mode and
Overflow mode parameters that are available when you select
Specify precision from the Filter internals list. Coefficients
are always saturated and rounded to Nearest.
Section Input
Choose how you specify the word length and the fraction length of
the fixed-point data type going into each section of an SOS filter.
This parameter is visible only when the selected filter structure is
IIR and SOS.
Binary point scaling enables you to enter the word and
fraction lengths of the section input in bits.
Specify word length enables you to enter the word lengths
in bits.
Section Output
Choose how you specify the word length and the fraction length
of the fixed-point data type coming out of each section of an SOS
4-670
filterbuilder
4-671
filterbuilder
4-672
filterbuilder
4-673
filterbuilder
4-674
filterbuilder
4-675
filterbuilder
HDL
For more information on this option, see Opening the Filter
Design HDL Coder GUI From the filterbuilder GUI.
MATLAB
Generate MATLAB code based on filter specifications
Generate function that returns your filter as an output
Selecting this option generates a function that designs either a
DFILT/MFILT object or a system object (depending on whether
you have selected the Use a System object to implement
the filter check box) using fdesign. The function call returns
a filter object.
Generate function that filters your data
Selecting this option generates a function that takes data as
input, and outputs data filtered with the designed filter.
Clicking on the Generate MATLAB code button, brings up a
Save File dialog. Specify the file name and location, and save. The
filter is now contained in an editable file.
Simulink Model
Generate Simulink blocks and subsystems from your
designed filters
When the Use a System object to implement filter check box
is selected in the Main pane, you are able to generate Simulink
models as long as the Arithmetic is not set to Fixed point in
the Data Types pane. If the Arithmetic is set to Fixed point,
the Generate Model button in the Simulink model panel will
be disabled.
Clicking on the Generate Model button brings up the Export to
Simulink dialog box, as shown in the following figure.
4-676
filterbuilder
4-677
filterbuilder
Filter
Responses
4-678
filterbuilder
Select your desired filter response from the menu and design your filter.
The following sections describe the options available for each response
type.
4-679
filterbuilder
4-680
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Impulse response
This dialog only applies if you have the DSP System Toolbox
software. Select either FIR or IIR from the drop down list, where
FIR is the default impulse response. When you choose an impulse
response, the design methods and structures you can use to
implement your filter change accordingly. Arbitrary group delay
designs are only available if Impulse response is IIR. Without
the DSP System Toolbox, the only available arbitrary response
filter design is FIR.
Order mode
This dialog only applies if you have the DSP System Toolbox
software. Choose Minimum or Specify. Choosing Specify enables
the Order dialog.
Order
This dialog only applies when Order mode is Specify. For an
FIR design, specify the filter order. For an IIR design, you can
specify an equal order for the numerator and denominator, or
you can specify different numerator and denominator orders.
The default is equal orders. To specify a different denominator
order, check the Denominator order box. Because the Signal
Processing Toolbox only supports FIR arbitrary-magnitude filters,
you do not have the option to specify a denominator order.
Denominator order
Select the check box and enter the denominator order. This option
is enabled only if IIR is selected for Impulse response.
Filter type
This dialog only applies if you have the DSP System Toolbox
software and is only available for FIR filters. Select Single-rate,
Decimator, Interpolator, or Sample-rate converter. Your
choice determines the type of filter as well as the design methods
4-681
filterbuilder
4-682
filterbuilder
Input Fs
Enter the input sampling frequency in the units specified in the
Frequency units drop-down box. This option is enabled when
Frequency units is set to an option in hertz.
Band Properties
These properties are modified automatically depending on the
response chosen in the Specify response as drop-down box. Two or
three columns are presented for input. The first column is always
Frequencies. The other columns are either Amplitudes, Magnitudes,
Phases, or Frequency Response. Enter the corresponding vectors of
values for each column.
Frequencies and Amplitudes These columns are presented
for input if you select Amplitudes in the Specify response as
drop-down box.
Frequencies, Magnitudes, and Phases These columns are
presented for input if the response chosen in the Specify response
as drop-down box is Magnitudes and phases.
Frequencies and Frequency response These columns are
presented for input if the response chosen in the Specify response
as drop-down box is Frequency response.
Algorithm
The options for each design are specific for each design method. In the
arbitrary response design, the available options also depend on the
Response specifications. This section does not present all of the
available options for all designs and design methods.
Design Method
Select the design method for the filter. Different methods are
enabled depending on the defining parameters entered in the
previous sections.
4-683
filterbuilder
Design Options
Window Valid when the Design method is Frequency
Sampling. Replace the square brackets with the name of a
window function or function handle. For example, 'hamming' or
@hamming. If the window function takes parameters other than
the length, use a cell array. For example, {`kaiser',3.5} or
{@chebwin,60}.
Density factor Valid when the Design method is
equiripple. Density factor controls the density of the
frequency grid over which the design method optimization
evaluates your filter response function. The number of equally
spaced points in the grid is the value you enter for Density
factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents
a reasonable trade between the accurate approximation to the
ideal filter and the time to design the filter.
The default changes to 20 for an IIR arbitrary group delay
design.
Phase constraint Valid when the Design method is
equiripple, you have the DSP System Toolbox installed, and
Specify response as is set to Amplitudes. Choose one of
Linear, Minimum, or Maximum.
Weights Uses the weights in Weights to weight the error for
a single-band design. If you have multiple frequency bands, the
Weights design option changes to B1 Weights, B2 Weights
to designate the separate bands. Use Bi Weights to specify
weights for the i-th band. The Bi Weights design option is only
available when you specify the i-th band as an unconstrained.
Bi forced frequency point This option is only available
in a multi-band constrained equiripple design when Specify
response as is Amplitudes. Bi forced frequency point is
4-684
filterbuilder
4-685
filterbuilder
4-686
filterbuilder
Filter specifications
Weighting type The weighting type defines the frequency
response of the filter. The valid weighting types are: A, C
, C-message, ITU-T 0.41, and ITU-R 4684 weighting. See
fdesign.audioweighting for definitions of the weighting types.
Class Filter class is only applicable for A weighting and C
weighting filters. The filter class describes the frequency-dependent
tolerances specified in the relevant standards. There are two
possible class values: 1 and 2. Class 1 weighting filters have stricter
tolerances than class 2 filters. The filter class value does not affect
the design. The class value is only used to provide a specification
mask in fvtool for the analysis of the filter design.
Impulse response Impulse response type as one of IIR or FIR.
For A, C , C-message, and ITU-R 4684 filter, IIR is the only option.
For a ITU-T 0.41 weighting filter, FIR is the only option.
Frequency units Choose Hz, kHz, MHz, or GHz. Normalized
frequency designs are not supported for audio weighting filters.
Input Fs The sampling frequency in Frequency units. For
example, if Frequency units is set to kHz, setting Input Fs to 40 is
equivalent to a 40 kHz sampling frequency.
Algorithm
Design method Valid design methods depend on the weighting
type. For type A and C weighting filters, the only valid design type
is ANSI S1.42. This is an IIR design method that follows ANSI
standard S1.422001. For a C message filter, the only valid design
method is Bell 41009, which is an IIR design method following the
Bell System Technical Reference PUB 41009. For a ITU-R 4684
weighting filter, you can design an IIR or FIR filter. If you choose an
IIR design, the design method is IIR least p-norm. If you choose an
FIR design, the design method choices are: Equirriple or Frequency
Sampling. For an ITU-T 0.41 weighting filter, the available FIR
design methods are equirriple or Frequency Sampling
4-687
filterbuilder
4-688
filterbuilder
4-689
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down box.
Selecting Specify enables the Order option so you can enter the
filter order.
If you have the DSP System Toolbox software installed, you can
specify IIR filters with different numerator and denominator
orders. The default is equal orders. To specify a different
denominator order, check the Denominator order box.
Filter type This dialog only applies if you have the DSP System
Toolbox software.
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
4-690
filterbuilder
Order
Enter the filter order. This option is enabled only if you select
Specify for Order mode.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default factor value is 2.
Interpolation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default factor value is 2.
Frequency specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
4-691
filterbuilder
Frequency constraints
Select the filter features to use to define the frequency response
characteristics. This dialog applies only when Order mode is
Specify.
Passband and stopband edges Define the filter by
specifying the frequencies for the edges for the stop- and
passbands.
Passband edges Define the filter by specifying frequencies
for the edges of the passband.
Stopband edges Define the filter by specifying frequencies
for the edges of the stopbands.
3dB points Define the filter response by specifying the
locations of the 3 dB points (IIR filters). The 3-dB point is the
frequency for the point 3 dB below the passband value.
3dB points and passband width Define the filter by
specifying frequencies for the 3-dB points in the filter response
and the width of the passband. (IIR filters)
3dB points and stopband widths Define the filter by
specifying frequencies for the 3-dB points in the filter response
and the width of the stopband. (IIR filters)
6dB points Define the filter response by specifying the
locations of the 6-dB points. The 6-dB point is the frequency for
the point 6dB below the passband value. (FIR filters)
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in hertz, select one of the frequency
units from the drop-down listHz, kHz, MHz, or GHz. Selecting one
of the unit options enables the Input Fs parameter.
4-692
filterbuilder
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Fstop1
Enter the frequency at the edge of the end of the first stopband.
Specify the value in either normalized frequency units or the
absolute units you select in Frequency units.
Fpass1
Enter the frequency at the edge of the start of the passband.
Specify the value in either normalized frequency units or the
absolute units you select Frequency units.
Fpass2
Enter the frequency at the edge of the end of the passband.
Specify the value in either normalized frequency units or the
absolute units you select Frequency units.
Fstop2
Enter the frequency at the edge of the start of the second
stopband. Specify the value in either normalized frequency units
or the absolute units you select Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude constraints
Specify as Unconstrained or Constrained bands. You must have
the DSP System Toolbox software to select Constrained bands.
Selecting Constrained bands enables dialogs for both stopbands
and the passband: Astop1, Astop2, and Apass. You cannot
specify constraints for all three bands simultaneously.
4-693
filterbuilder
4-694
filterbuilder
4-695
filterbuilder
Wstop1
Weight for the first stopband.
Wpass
Passband weight.
Wstop2
Weight for the second stopband.
Max pole radius
Valid only for IIR designs. Constrains the maximum pole radius.
The default is 1. Reducing the max pole radius can produce a
transfer function more resistant to quantization.
Init norm
Valid only for IIR designs. The initial norm used in the
optimization. The default initial norm is 2.
Init numerator
Specifies an initial estimate of the filter numerator coefficients.
This may be useful in difficult optimization problems.
Init denominator
Specifies an initial estimate of the filter denominator coefficients.
This may be useful in difficult optimization problems.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-696
filterbuilder
4-697
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option so you can enter the
filter order.
If you have the DSP System Toolbox software installed, you can
specify IIR filters with different numerator and denominator
orders. The default is equal orders. To specify a different
denominator order, check the Denominator order box.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
4-698
filterbuilder
4-699
filterbuilder
Frequency constraints
Select the filter features to use to define the frequency response
characteristics. This dialog applies only when Order mode is
Specify.
Passband and stopband edges Define the filter by
specifying the frequencies for the edges for the stop- and
passbands.
Passband edges Define the filter by specifying frequencies
for the edges of the passband.
Stopband edges Define the filter by specifying frequencies
for the edges of the stopbands.
3dB points Define the filter response by specifying the
locations of the 3 dB points (IIR filters). The 3 dB point is the
frequency for the point 3 dB point below the passband value.
3dB points and passband width Define the filter by
specifying frequencies for the 3 dB points in the filter response
and the width of the passband (IIR filters).
3dB points and stopband widths Define the filter by
specifying frequencies for the 3 dB points in the filter response
and the width of the stopband (IIR filters).
6dB points Define the filter response by specifying the
locations of the 6-dB points (FIR filters). The 6-dB point is the
frequency for the point 6 dB point below the passband value.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
4-700
filterbuilder
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Output Fs
When you design an interpolator, Fs represents the sampling
frequency at the filter output rather than the filter input. This
option is available only when you set Filter type is interpolator.
Fpass1
Enter the frequency at the edge of the end of the first passband.
Specify the value in either normalized frequency units or the
absolute units you select in Frequency units.
Fstop1
Enter the frequency at the edge of the start of the stopband.
Specify the value in either normalized frequency units or the
absolute units you select Frequency units.
Fstop2
Enter the frequency at the edge of the end of the stopband. Specify
the value in either normalized frequency units or the absolute
units you select Frequency units.
Fpass2
Enter the frequency at the edge of the start of the second
passband. Specify the value in either normalized frequency units
or the absolute units you select Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
4-701
filterbuilder
Magnitude constraints
Specify as Unconstrained or Constrained bands. You must have
the DSP System Toolbox software to select Constrained bands.
Selecting Constrained bands enables dialogs for both passbands
and the stopband: Apass1, Apass2, and Astop. You cannot
specify constraints for all three bands simultaneously.
Setting Magnitude constraints to Constrained bands enables
the Wstop and Wpass options under Design options.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Apass1
Enter the filter ripple allowed in the first passband in the units
you choose for Magnitude units, either linear or decibels.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels
Apass2
Enter the filter ripple allowed in the second passband in the units
you choose for Magnitude units, either linear or decibels
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
4-702
filterbuilder
4-703
filterbuilder
Minimum order
This option only applies when you have the DSP System Toolbox
software and Order mode is Minimum.
Select Any (default), Even, or Odd. Selecting Even or Odd forces the
minimum-order design to be an even or odd order.
Wpass1
Weight for the first passband.
Wstop
Stopband weight.
Wpass2
Weight for the second passband.
Match exactly
Specifies that the resulting filter design matches either the
passband or stopband or both bands when you select passband
or stopband .
Max pole radius
Valid only for IIR designs. Constrains the maximum pole radius.
The default is 1. Reducing the max pole radius can produce a
transfer function more resistant to quantization.
Init norm
Valid only for IIR designs. The initial norm used in the
optimization. The default initial norm is 2.
Init numerator
Specifies an initial estimate of the filter numerator coefficients.
This may be useful in difficult optimization problems.
Init denominator
Specifies an initial estimate of the filter denominator coefficients.
This may be useful in difficult optimization problems.
4-704
filterbuilder
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-705
filterbuilder
4-706
filterbuilder
Filter specifications
Parameters in this group enable you to specify your CIC filter format,
such as the filter type and the differential delay.
Filter type
Select whether your filter will be a decimator or an interpolator.
Your choice determines the type of filter and the design methods
and structures that are available to implement your filter.
Selecting decimator or interpolator activates the Factor
option. When you design an interpolator, you enable the Output
Fs parameter.
When you design either a decimator or interpolator, the resulting
filter is a CIC filter that decimates or interpolates your input
signal.
Differential Delay
Specify the differential delay of your CIC filter as an integer value
greater than or equal to 1. The default value is 1. The differential
delay changes the shape, number, and location of nulls in the
filter response. Increasing the differential delay increases the
sharpness of the nulls and the response between the nulls. In
practice, differential delay values of 1 or 2 are the most common.
Factor
Specify the decimation or interpolation factor for your filter as an
integer value greater than or equal to 1. The default value is 2.
Frequency specifications
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
4-707
filterbuilder
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Output Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter output. When you
provide an output sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available only when you design interpolators.
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select Frequency units.
Magnitude specifications
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
4-708
filterbuilder
Filter implementation
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-709
filterbuilder
4-710
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the filter order mode and the filter type.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option (see the following
sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
When you design either a decimator or an interpolator, the
resulting filter is a bandpass filter that either decimates or
interpolates your input signal.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Order mode.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default factor value is 2.
Interpolation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default factor value is 2.
4-711
filterbuilder
4-712
filterbuilder
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
4-713
filterbuilder
4-714
filterbuilder
4-715
filterbuilder
4-716
filterbuilder
4-717
filterbuilder
Filter specifications
Parameters in this group enable you to specify the type of comb filter
and the number of peaks or notches.
Comb Type
Select Notch or Peak from the drop-down list. Notch creates
a comb filter that attenuates a set of harmonically related
frequencies. Peak creates a comb filter that amplifies a set of
harmonically related frequencies.
Order mode
Select Order or Number of Peaks/Notches from the drop-down
menu.
Select Order to enter the desired filter order in the
4-718
filterbuilder
4-719
filterbuilder
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
The IIR Butterworth design is the only option for peaking or
notching comb filters.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off.
4-720
filterbuilder
4-721
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order. Graphically, the filter
specifications look similar to those shown in the following figure.
4-722
filterbuilder
4-723
filterbuilder
4-724
filterbuilder
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Astop2
Enter the filter attenuation in the second stopband in the units
you choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
4-725
filterbuilder
The options for each design are specific for each design method. This
section does not present all of the available options for all designs and
design methods. There are many more that you encounter as you select
different design methods and filter specifications.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in the grid
is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents a
reasonable trade between the accurate approximation to the ideal
filter and the time to design the filter.
Wpass
Passband weight. This option is only available for a specified-order
design when Frequency constraints is equal to Passband edge
and stopband edge and the Design method is Equiripple.
Wstop
Stopband weight. This option is only available for a specified-order
design when Frequency constraints is equal to Passband edge
and stopband edge and the Design method is Equiripple.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
4-726
filterbuilder
Frequency specifications
Parameters in this group enable you to specify your filter format, such
as the fractional delay and the filter order.
4-727
filterbuilder
Order
If you choose Specify for Order mode, enter your filter
order in this field, or select the order from the drop-down
list.filterbuilder designs a filter with the order you specify.
Fractional delay
Specify a value between 0 and 1 samples for the filter fractional
delay. The default value is 0.5 samples.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
4-728
filterbuilder
4-729
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter type and order.
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option (see the following
sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, or Interpolator. By default,
filterbuilder specifies single-rate filters.
When you design either a decimator or an interpolator, the
resulting filter is a bandpass filter that decimates or interpolates
your input by a factor of two.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Order mode.
Frequency specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications for a halfband lowpass filter
look similar to those shown in the following figure.
4-730
filterbuilder
In the figure, the transition region lies between the end of the passband
and the start of the stopband. The width is defined explicitly by the
value of Transition width.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
4-731
filterbuilder
Transition width
Specify the width of the transition between the end of the
passband and the edge of the stopband. Specify the value in
normalized frequency units or the absolute units you select in
Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default).
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. For FIR halfband filters,
the available design options are Equiripple and Kaiser
window. For IIR halfband filters, the available design options are
Butterworth, Elliptic, and IIR quasi-linear phase.
Design Options
The following design options are available for FIR halfband filters when
the user specifies an equiripple design:
4-732
filterbuilder
Minimum phase
To design a filter that is minimum phase, select Minimum
phase. Clearing the Minimum phase option removes the phase
constraintthe resulting design is not minimum phase.
Stopband Shape
Stopband shape lets you specify how the stopband changes with
increasing frequency. Choose one of the following options:
Flat Specifies that the stopband is flat. The attenuation
does not change as the frequency increases.
Linear Specifies that the stopband attenuation changes
linearly as the frequency increases. Change the slope of the
stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in Stopband
decay.
Stopband Decay
When you set Stopband shape, Stopband decay specifies the
amount of decay applied to the stopband. the following conditions
apply to Stopband decay based on the value of Stopband Shape:
When you set Stopband shape to Flat, Stopband decay
has no affect on the stopband.
When you set Stopband shape to Linear, enter the slope of
the stopband in units of dB/rad/s. filterbuilder applies that
slope to the stopband.
When you set Stopband shape to 1/f, enter a value for the
exponent n in the relation (1/f)n to define the stopband decay.
filterbuilder applies the (1/f)n relation to the stopband to
result in an exponentially decreasing stopband attenuation.
4-733
filterbuilder
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-734
filterbuilder
4-735
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option so you can enter the
filter order.
If your Impulse response is IIR, you can specify an equal order
for the numerator and denominator, or different numerator and
denominator orders. The default is equal orders. To specify a
different denominator order, check the Denominator order box.
Filter type
This option is only available if you have the DSP System Toolbox
software. Select Single-rate, Decimator, Interpolator, or
Sample-rate converter. Your choice determines the type of
filter as well as the design methods and structures that are
available to implement your filter. By default, filterbuilder
specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
4-736
filterbuilder
In the figure, the region between specification values Fstop and Fpass
represents the transition region where the filter response is not
explicitly defined.
4-737
filterbuilder
Frequency constraints
Select the filter features to use to define the frequency response
characteristics. The list contains the following options, when
available for the filter specifications.
Stopband edge and passband edge Define the filter by
specifying the frequencies for the edges for the stopband and
passband.
Passband edge Define the filter by specifying the frequency
for the edge of the passband.
Stopband edge Define the filter by specifying the frequency
for the edges of the stopband.
Stopband edge and 3dB point Define the filter by
specifying the stopband edge frequency and the 3-dB down
point (IIR designs).
3dB point and passband edge Define the filter by
specifying the 3-dB down point and passband edge frequency
(IIR designs).
3dB point Define the filter by specifying the frequency for
the 3-dB point (IIR designs or maxflat FIR).
6dB point Define the filter by specifying the frequency for
the 6-dB point in the filter response (FIR designs).
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
4-738
filterbuilder
4-739
filterbuilder
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method. This
section does not present all of the available options for all designs and
design methods. There are many more that you encounter as you select
different design methods and filter specifications. The following options
represent some of the most common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in the grid
is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents a
4-740
filterbuilder
4-741
filterbuilder
4-742
filterbuilder
4-743
filterbuilder
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
This option is only available if you have the DSP System Toolbox
software. Select either Minimum (the default) or Specify from the
drop-down list. Selecting Specify enables the Order option (see
the following sections) so you can enter the filter order.
Filter type
This option is only available if you have the DSP System Toolbox
software. Select Single-rate, Decimator, Interpolator, or
Sample-rate converter. Your choice determines the type of
filter as well as the design methods and structures that are
available to implement your filter. By default, filterbuilder
specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
When you design either a decimator or an interpolator, the
resulting filter is a bandpass filter that either decimates or
interpolates your input signal.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Order mode.
4-744
filterbuilder
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default factor value is 2.
Interpolation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default factor value is 2.
Frequency specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
4-745
filterbuilder
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Transition width
Specify the width of the transitions at the ends of the passband.
Specify the value in normalized frequency units or the absolute
units you select in Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
4-746
filterbuilder
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method. This
section does not present all of the available options for all designs and
design methods. There are many more that you encounter as you select
different design methods and filter specifications. The following options
represent some of the most common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in the grid
is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents a
4-747
filterbuilder
4-748
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
4-749
filterbuilder
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option (see the following
sections) so you can enter the filter order.
Response type
Select Lowpass or Highpass to design an inverse sinc lowpass
or highpass filter.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
When you design either a decimator or an interpolator, the
resulting filter is a bandpass filter that either decimates or
interpolates your input signal.
Order
Enter the filter order. This option is enabled only if Specify was
selected for Order mode.
Decimation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Decimator or Sample-rate converter. The
default factor value is 2.
Interpolation Factor
Enter the decimation factor. This option is enabled only if the
Filter type is set to Interpolator or Sample-rate converter.
The default factor value is 2.
4-750
filterbuilder
Frequency specifications
The parameters in this group allow you to specify your filter response
curve. Graphically, the filter specifications look similar to those shown
in the following figure.
4-751
filterbuilder
6dB point The 6-dB point is the frequency for the point 6
dB point below the passband value.
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Fpass
Enter the frequency at the end of the passband. Specify the value
in either normalized frequency units or the absolute units you
select Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
4-752
filterbuilder
4-753
filterbuilder
4-754
filterbuilder
4-755
filterbuilder
4-756
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option (see the following
sections) so you can enter the filter order.
If your Impulse response is IIR, you can specify an equal order
for the numerator and denominator, or different numerator and
denominator orders. The default is equal orders. To specify a
different denominator order, check the Denominator order box.
Filter type
This option is only available if you have the DSP System Toolbox.
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
4-757
filterbuilder
In the figure, regions between specification values such as Fpass and Fstop
represent transition regions where the filter response is not explicitly
defined.
4-758
filterbuilder
Frequency constraints
Select the filter features to use to define the frequency response
characteristics. The list contains the following options, when
available for the filter specifications.
Passband and stopband edge Define the filter by specifying
the frequencies for the edge of the stopband and passband.
Passband edge Define the filter by specifying the frequency
for the edge of the passband.
Stopband edge Define the filter by specifying the frequency
for the edges of the stopband.
Passband edge and 3dB point Define the filter by
specifying the passband edge frequency and the 3-dB down
point (IIR designs).
3dB point and stopband edge Define the filter by
specifying the 3-dB down point and stopband edge frequency
(IIR designs).
3dB point Define the filter by specifying the frequency for
the 3-dB point (IIR designs or maxflat FIR).
6dB point Define the filter by specifying the frequency for
the 6-dB point in the filter response (FIR designs).
Frequency units
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 1)
to enter frequencies in normalized form. This behavior is the
default. To enter frequencies in absolute values, select one of the
frequency units from the drop-down listHz, kHz, MHz, or GHz.
Selecting one of the unit options enables the Input Fs parameter.
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
4-759
filterbuilder
available when you select one of the frequency options from the
Frequency units list.
Fpass
Enter the frequency at the of the passband. Specify the value in
either normalized frequency units or the absolute units you select
Frequency units.
Fstop
Enter the frequency at the start of the stopband. Specify the
value in either normalized frequency units or the absolute units
you select Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Squared Specify the magnitude in squared units.
Apass
Enter the filter ripple allowed in the passband in the units you
choose for Magnitude units, either linear or decibels.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
4-760
filterbuilder
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method. This
section does not present all of the available options for all designs and
design methods. There are many more that you encounter as you select
different design methods and filter specifications. The following options
represent some of the most common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in the grid
is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents a
reasonable trade between the accurate approximation to the ideal
filter and the time to design the filter.
4-761
filterbuilder
Phase constraint
This option only applies when you have the DSP System Toolbox
software and when the Design method is equiripple. Select
one of Linear, Minimum, or Maximum.
Minimum order This option only applies when you have the DSP
System Toolbox software and the Order mode is Minimum.
Select Any (default), Even, or Odd. Selecting Even or Odd forces the
minimum-order design to be an even or odd order.
Match Exactly
Specifies that the resulting filter design matches either the
passband or stopband when you select Passband or Stopband.
Stopband Shape
Stopband shape lets you specify how the stopband changes with
increasing frequency. Choose one of the following options:
Flat Specifies that the stopband is flat. The attenuation
does not change as the frequency increases.
Linear Specifies that the stopband attenuation changes
linearly as the frequency increases. Change the slope of the
stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in Stopband
decay.
Stopband Decay
When you set Stopband shape, Stopband decay specifies the
amount of decay applied to the stopband. the following conditions
apply to Stopband decay based on the value of Stopband Shape:
When you set Stopband shape to Flat, Stopband decay
has no affect on the stopband.
When you set Stopband shape to Linear, enter the slope of
the stopband in units of dB/rad/s. filterbuilder applies that
slope to the stopband.
4-762
filterbuilder
When you set Stopband shape to 1/f, enter a value for the
exponent n in the relation (1/f)n to define the stopband decay.
filterbuilder applies the (1/f)n relation to the stopband to
result in an exponentially decreasing stopband attenuation.
Wpass
Passband weight. This option only applies when Impulse
response is FIR and Order mode is Specify.
Wstop
Stopband weight. This option only applies when Impulse
response is FIR and Order mode is Specify.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
Notch
See Peak/Notch Filter Design Dialog Box Main Pane on page 4-781.
4-763
filterbuilder
4-764
filterbuilder
Filter specifications
Parameters in this group enable you to specify your filter format, such
as the impulse response and the filter order.
Band
Specifies the location of the center of the transition region between
the passband and the stopband. The center of the transition
region, bw, is calculated using the value for Band:
bw = Fs/(2*Band).
Impulse response
Select FIR or IIR from the drop-down list, where FIR is the default
impulse response. When you choose an impulse response, the
design methods and structures you can use to implement your
filter change accordingly.
Note The design methods and structures for FIR filters are not
the same as the methods and structures for IIR filters.
Order mode
Select Minimum (the default) or Specify from the drop-down list.
Selecting Specify enables the Order option (see the following
sections) so you can enter the filter order.
Filter type
Select Single-rate, Decimator, Interpolator, or Sample-rate
converter. Your choice determines the type of filter as well as the
design methods and structures that are available to implement
your filter. By default, filterbuilder specifies single-rate filters.
Selecting Decimator or Interpolator activates the
Decimation Factor or the Interpolation Factor options
respectively.
Selecting Sample-rate converter activates both factors.
4-765
filterbuilder
4-766
filterbuilder
4-767
filterbuilder
Input Fs
Fs, specified in the units you selected for Frequency units,
defines the sampling frequency at the filter input. When you
provide an input sampling frequency, all frequencies in the
specifications are in the selected units as well. This parameter is
available when you select one of the frequency options from the
Frequency units list.
Transition width
Specify the width of the transition between the end of the
passband and the edge of the stopband. Specify the value in
normalized frequency units or the absolute units you select in
Frequency units.
Magnitude specifications
The parameters in this group let you specify the filter response in the
passbands and stopbands.
Magnitude units
Specify the units for any parameter you provide in magnitude
specifications. Select one of the following options from the
drop-down list.
Linear Specify the magnitude in linear units.
dB Specify the magnitude in decibels (default)
Squared Specify the magnitude in squared units.
Astop
Enter the filter attenuation in the stopband in the units you
choose for Magnitude units, either linear or decibels.
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
4-768
filterbuilder
Design Method
Lists the design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter, such as changing the impulse response,
the methods available to design filters changes as well. The
default IIR design method is usually Butterworth, and the default
FIR method is equiripple.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Design Options
The options for each design are specific for each design method. This
section does not present all of the available options for all designs and
design methods. There are many more that you encounter as you select
different design methods and filter specifications. The following options
represent some of the most common ones available.
Density factor
Density factor controls the density of the frequency grid over
which the design method optimization evaluates your filter
response function. The number of equally spaced points in the grid
is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely
approximates an ideal equiripple filter but increases the time
required to design the filter. The default value of 16 represents a
reasonable trade between the accurate approximation to the ideal
filter and the time to design the filter.
4-769
filterbuilder
Minimum phase
To design a filter that is minimum phase, select Minimum
phase. Clearing the Minimum phase option removes the phase
constraintthe resulting design is not minimum phase.
Minimum order
When you select this parameter, the design method determines
and designs the minimum order filter to meet your specifications.
Some filters do not provide this parameter. Select Any, Even,
or Odd from the drop-down list to direct the design to be any
minimum order, or minimum even order, or minimum odd order.
Note Generally, Minimum order designs are not available for
IIR filters.
Match Exactly
Specifies that the resulting filter design matches either the
passband or stopband or both bands when you select passband or
stopband or both from the drop-down list.
Stopband Shape
Stopband shape lets you specify how the stopband changes with
increasing frequency. Choose one of the following options:
Flat Specifies that the stopband is flat. The attenuation
does not change as the frequency increases.
Linear Specifies that the stopband attenuation changes
linearly as the frequency increases. Change the slope of the
stopband by setting Stopband decay.
1/f Specifies that the stopband attenuation changes
exponentially as the frequency increases, where f is the
frequency. Set the power (exponent) for the decay in Stopband
decay.
4-770
filterbuilder
Stopband Decay
When you set Stopband shape, Stopband decay specifies the
amount of decay applied to the stopband. the following conditions
apply to Stopband decay based on the value of Stopband Shape:
When you set Stopband shape to Flat, Stopband decay
has no affect on the stopband.
When you set Stopband shape to Linear, enter the slope of
the stopband in units of dB/rad/s. filterbuilder applies that
slope to the stopband.
When you set Stopband shape to 1/f, enter a value for the
exponent n in the relation (1/f)n to define the stopband decay.
filterbuilder applies the (1/f)n relation to the stopband to
result in an exponentially decreasing stopband attenuation.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure, and IIR
filters use direct-form II filters with SOS.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-771
filterbuilder
4-772
filterbuilder
Filter specifications
Order
Specify filter order. Possible values are: 4, 6, 8, 10.
Bands per octave
Specify the number of bands per octave. Possible values are: 1,
3, 6, 12, 24.
Frequency units
Specify frequency units as Hz or kHz.
Input Fs
Specify the input sampling frequency in the frequency units
specified previously.
Center Frequency
Select from the drop-down list of available center frequency
values.
Algorithm
Design Method
Butterworth is the design method used for this type of filter.
Scale SOS filter coefficients to reduce chance of overflow
Select the check box to scale the filter coefficients.
Filter implementation
Structure
Specify filter structure. Choose from:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
4-773
filterbuilder
4-774
filterbuilder
4-775
filterbuilder
Filter specifications
Order mode
Select Minimum to design a minimum order filter that meets the
design specifications, or Specify to enter a specific filter order.
The order mode also affects the possible frequency constraints,
which in turn limit the gain specifications. For example, if you
specify a Minimum order filter, the available frequency constraints
are:
4-776
filterbuilder
4-777
filterbuilder
Passband width
The passband width determines the frequency points at which
the filter magnitude is attenuated by the value specified as the
Passband gain in the Gain specifications section. This option
is enabled only if the filter is of minimum order, and the frequency
constraint selected is Center frequency, bandwidth, passband
width.
Stopband width
The stopband width determines the frequency points at which
the filter magnitude is attenuated by the value specified as the
Stopband gain in the Gain specifications section. This option
is enabled only if the filter is of minimum order, and the frequency
constraint selected is Center frequency, bandwidth, stopband
width.
Low frequency
Enter the low frequency cutoff. This option is enabled only if the
filter order is user specified and the frequency constraint selected
is Low frequency, high frequency. The filter magnitude is
attenuated by the amount specified in Bandwidth gain.
High frequency
Enter the high frequency cutoff. This option is enabled only if the
filter order is user specified and the frequency constraint selected
is Low frequency, high frequency. The filter magnitude is
attenuated by the amount specified in Bandwidth gain.
Gain specifications
Depending on the filter order and frequency constraints, the possible
gain constraints change. Also, once you choose the gain constraints the
input boxes in this area change to reflect the selection.
Gain constraints
Select the specification array to represent gain constraints,
and remember that not all of these options are available for all
configurations. The following is a list of all available options:
4-778
filterbuilder
4-779
filterbuilder
Boost/cut gain
The boost/cut gain applies only when the designing a shelving
filter. Shelving filters include the Shelf type parameter in the
Frequency constraints specification. The gain in the passband
of the shelving filter is increased by Boost/cut gain dB from a
floor gain of 0 dB.
Algorithm
Design method
Select the design method from the drop-down list. Different IIR
design methods are available depending on the filter constraints
you specify.
Scale SOS filter coefficients to reduce chance of overflow
Select the check box to scale the filter coefficients.
Filter implementation
Structure
Select filter structure. The possible choices are:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-780
filterbuilder
4-781
filterbuilder
Filter specifications
In this area you can specify whether you want to design a peaking filter
or a notching filter, as well as the order of the filter.
Response
Select Peak or Notch from the drop-down box.
Order
Enter the filter order. The order must be even.
Frequency specifications
This group of parameters allows you to specify frequency constraints
and units.
Frequency Constraints
Select the frequency constraints for filter specification. There are
two choices as follows:
Center frequency and quality factor
Center frequency and bandwidth
Frequency units
The frequency units are normalized by default. If you specify
units other than normalized, filterbuilder assumes that you
wish to specify an input sampling frequency, and enables this
input box. The choice of frequency units are: Normalized (0 to
1), Hz, kHz, MHz, GHz.
Input Fs
This input box is enabled if Frequency units other than
Normalized (0 to 1) are specified. Enter the input sampling
frequency.
Center frequency
Enter the center frequency in the units you specified in
Frequency units.
4-782
filterbuilder
Quality Factor
This input box is enabled only when Center frequency and
quality factor is chosen for the Frequency Constraints.
Enter the quality factor.
Bandwidth
This input box is enabled only when Center frequency and
bandwidth is chosen for the Frequency Constraints. Enter
the bandwidth.
Magnitude specifications
This group of parameters allows you to specify the magnitude
constraints, as well as their values and units.
Magnitude Constraints
Depending on the choice of constraints, the other input boxes
are enabled or disabled. Select from four magnitude constraints
available:
Unconstrained
Passband ripple
Stopband attenuation
Passband ripple and stopband attenuation
Magnitude units
Select the magnitude units: either dB or squared.
Apass
This input box is enabled if the magnitude constraints selected
are Passband ripple or Passband ripple and stopband
attenuation. Enter the passband ripple.
Astop
This input box is enabled if the magnitude constraints selected
are Stopband attenuation or Passband ripple and stopband
attenuation. Enter the stopband attenuation.
4-783
filterbuilder
Algorithm
The parameters in this group allow you to specify the design method
and structure that filterbuilder uses to implement your filter.
Design Method
Lists all design methods available for the frequency and
magnitude specifications you entered. When you change the
specifications for a filter the methods available to design filters
changes as well.
Scale SOS filter coefficients to reduce chance of overflow
Selecting this parameter directs the design to scale the filter
coefficients to reduce the chances that the inputs or calculations
in the filter overflow and exceed the representable range of the
filter. Clearing this option removes the scaling. This parameter
applies only to IIR filters.
Filter implementation
Structure
Lists all available filter structures for the filter specifications and
design method you select. The typical options are:
Direct-form I SOS
Direct-form II SOS
Direct-form I transposed SOS
Direct-form II transposed SOS
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-784
filterbuilder
4-785
filterbuilder
Filter specifications
Parameters in this group enable you to specify the shape and length
of the filter.
Pulse shape
Select the shape of the impulse response from the following
options:
Raised Cosine
Square Root Raised Cosine
Gaussian
Order mode
This specification is only available for raised cosine and square
root raised cosine filters. For these filters, select one of the
following options:
Minimum This option will result in the minimum-length filter
satisfying the user-specified Frequency specifications.
Specify orderThis option allows the user to construct a
raised cosine or square root cosine filter of a specified order by
entering an even number in the Order input box. The length
of the impulse response will be Order+1 .
Specify symbolsThis option enables the user to specify the
length of the impulse response in an alternative manner. If
Specify symbols is chosen, the Order input box changes to
the Number of symbols input box.
Samples per symbol
Specify the oversampling factor. Increasing the oversampling
factor guards against aliasing and improves the FIR filter
approximation to the ideal frequency response. If Order is
specified in Number of symbols, the filter length will be
Number of symbols*Samples per symbol+1. The product
Number of symbols*Samples per symbol must be an even
number.
4-786
filterbuilder
4-787
filterbuilder
Magnitude specifications
If the Order mode is specified as Minimum, the Magnitude units may
be selected from:
dBSpecify the magnitude in decibels (default).
LinearSpecify the magnitude in linear units.
Algorithm
The only Design method available for FIR pulse-shaping filters is
the Window method.
Filter implementation
Structure
For the filter specifications and design method you select, this
parameter lists the filter structures available to implement your
filter. By default, FIR filters use direct-form structure.
Use a System object to implement filter
Selecting this check box gives you the choice of using a system
object to implement the filter. By default the check box is turned
off. When the current design method or structure is not supported
by a system object filter, then this check box is disabled.
4-788
filtstates.cic
Purpose
Description
Examples
See Also
4-789
fircband
Purpose
Syntax
b = fircband(n,f,a,w,c)
b = fircband(n,f,a,s)
b = fircband(...,'1')
b = fircband(...,'minphase')
b = fircband(..., 'check')
b = fircband(...,{lgrid})
[b,err] = fircband(...)
[b,err,res] = fircband(...)
Description
Minimum phase
Maximum phase
Minimum order (even or odd), extra ripple
Maximal ripple
Constrained ripple
Single-point band (notching and peaking)
Forced gain
Arbitrary shape frequency response curve filters
b = fircband(n,f,a,w,c) designs filters having constrained error
magnitudes (ripples). c is a cell array of strings of the same length as w.
The entries of c must be either c' to indicate that the corresponding
element in w is a constraint (the ripple for that band cannot exceed that
4-790
fircband
4-791
fircband
approximation error.
[b,err,res] = fircband(...) returns a structure res of optional
results computed by fircband, and contains the following fields:
4-792
Structure Field
Contents
res.fgrid
res.des
res.wt
Weights on fgrid
res.h
res.error
res.iextr
res.fextr
res.order
Filter order
res.edgecheck
fircband
Examples
Structure Field
Contents
res.iterations
res.evals
Example 1
design a 12th-order lowpass filter with a constraint on the filter
response.
b = fircband(12,[0 0.4 0.5 1], [1 1 0 0], ...
[1 0.2], {'w' 'c'});
Using fvtool to display the result b shows you the response of the
filter you designed.
4-793
fircband
Magnitude (dB)
20
40
60
80
100
120
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Example 2
design two filters of different order with the stopband constrained to 60
dB. Use excess order (80) in the second filter to improve the passband
ripple.
b1=fircband(60,[0 .2 .25 1],[1 1 0 0],...
[1 .001],{'w','c'});
b2=fircband(80,[0 .2 .25 1],[1 1 0 0],...
[1 .001],{'w','c'});
hfvt = fvtool(b1,1,b2,1);
legend(hfvt,'Filter Order 60','Filter Order 80');
4-794
fircband
20
Magnitude (dB)
40
60
80
100
120
140
See Also
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-795
fireqint
Purpose
Syntax
b
b
b
b
Description
=
=
=
=
fireqint(n,l,alpha)
fireqint(n,l,alpha,w)
fireqint('minorder',l,alpha,r)
fireqint({'minorder',initord},l,alpha,r)
4-796
fireqint
Examples
4-797
fireqint
Zerophase Response
6
Zerophase
1
0
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
For hm, the minimum order filter with the requested design
specifications, here is the filter information.
hm =
FilterStructure: 'Direct-Form FIR Polyphase Interpolator'
Arithmetic: 'double'
Numerator: [1x70 double]
InterpolationFactor: 6
PersistentMemory: false
See Also
4-798
firceqrip
Purpose
Syntax
B
B
B
B
B
B
B
B
Description
=
=
=
=
=
=
=
=
firceqrip(n,Fo,DEV)
firceqrip(...,'slope',r)
firceqrip(...,'passedge')
firceqrip(...,'stopedge')
firceqrip(...,'high')
firceqrip(...,'min')
firceqrip(...,'invsinc',C)
firceqrip(...,'invdiric',C)
of a lowpass filter.
B = firceqrip(...,'min') designs a minimum-phase filter.
4-799
firceqrip
passband that has the shape of an inverse Dirichlet sinc function. The
frequency response of the inverse Dirichlet sinc function is given by
{rC (
4-800
sin( f / 2r ) p
}
sin(Cf / 2)
firceqrip
Examples
Example 1
Design an order = 30 FIR filter.
b = firceqrip(30,0.4,[0.05 0.03]); fvtool(b)
When the plot appears in the Filter Visualization Tool window, select
Analysis > Overlay Analysis > Phase Response. Then select View
> Full View. This displays the following plot.
4-801
firceqrip
Example 2
Design an order = 30 FIR filter with the stopedge keyword to define
the response at the edge of the filter stopband.
b = firceqrip(30,0.4,[0.05 0.03],'stopedge'); fvtool(b)
Example 3
Design an order = 30 FIR filter with the slope keyword and r = 20.
b = firceqrip(30,0.4,[0.05 0.03],'slope',20,'stopedge'); fvtool(b)
Example 4
Design an order = 30 FIR filter defining the stopband and specifying
that the resulting filter is minimum phase with the min keyword.
b = firceqrip(30,0.4,[0.05 0.03],'stopedge','min'); fvtool(b)
4-802
firceqrip
Example 5
Design an order = 30 FIR filter with the invsinc keyword to shape the
filter passband with an inverse sinc function.
b = firceqrip(30,0.4,[0.05 0.03],'invsinc',[2 1.5]); fvtool(b)
4-803
firceqrip
Inverse-Dirichlet-SincShaped Passband
Design two order 30 constrained equiripple FIR filters with
inverse-Dirichlet-sinc-shaped passbands. The cutoff frequency in both
designs is /4 radians/sample. Set C=1 in one design C=2 in the second
design. The maximum passband and stopband ripple is 0.05. Set p=1 in
one design and p=2 in the second design.
Design the filters.
b1 = firceqrip(30,0.25,[0.05 0.05],'invdiric',[1 1]);
b2 = firceqrip(30,0.25,[0.05 0.05],'invdiric',[2 2]);
Obtain the filter frequency responses using freqz. Plot the magnitude
responses.
[h1,~] = freqz(b1,1);
[h2,w] = freqz(b2,1);
plot(w,abs(h1)); hold on;
plot(w,abs(h2),'r');
axis([0 pi 0 1.5]);
xlabel('Radians/sample');
4-804
firceqrip
ylabel('Magnitude');
legend('C=1 p=1','C=2 p=2');
Inspect the stopband ripple in the design with C=1 and p=1. The
constrained design sets the maximum ripple to be 0.05. Zoom in on
the stopband from the cutoff frequency of /4 radians/sample to 3/4
radians/sample.
figure;
plot(w,abs(h1));
set(gca,'xlim',[pi/4 3*pi/4]);
grid on;
See Also
4-805
fircls
Purpose
Syntax
hd
hd
hd
hd
Description
=
=
=
=
design(d,'fircls')
design(d,'fircls','FilterStructure',value)
design(d,'fircls','PassbandOffset',value)
design(d,'fircls','zerophase',value)
4-806
fircls
For complete help about using fircls, refer to the command line help
system. For example, to get specific information about using fircls
with d, the specification object, enter the following at the MATLAB
prompt.
help(d,'fircls')
Examples
4-807
fircls
30,0.4,0.6,60,1,60);
Hd = design(d, 'fircls');
fvtool(Hd)
See Also
4-808
firgr
Purpose
Syntax
b = firgr(n,f,a,w)
b = firgr(n,f,a,'hilbert')
b = firgr(m,f,a,r),
b = firgr({m,ni},f,a,r)
b = firgr(n,f,a,w,e)
b = firgr(n,f,a,s)
b = firgr(n,f,a,s,w,e)
b = firgr(...,'1')
b = firgr(...,'minphase')
b = firgr(..., 'check')
b = firgr(...,{lgrid}),
[b,err] = firgr(...)
[b,err,res] = firgr(...)
b = firgr(n,f,fresp,w)
b = firgr(n,f,{fresp,p1,p2,...},w)
b = firgr(n,f,a,w)
Description
Minimum phase
Maximum phase
Minimum order (even or odd)
Extra ripple
Maximal ripple
4-809
firgr
Constrained ripple
Single-point band (notching and peaking)
Forced gain
Arbitrary shape frequency response curve filters
b = firgr(n,f,a,w) returns a length n+1 linear phase FIR filter which
has the best approximation to the desired frequency response described
by f and a in the minimax sense. w is a vector of weights, one per band.
When you omit w, all bands are weighted equally. For more information
on the input arguments, refer to firpm in Signal Processing Toolbox
Users Guide.
b = firgr(n,f,a,'hilbert') and b =
firgr(n,f,a,'differentiator') design FIR Hilbert transformers
for different bands. Use this syntax to design extra ripple or maximal
ripple filters. These filters have interesting properties such as having
the minimum transition width. e is a cell array of strings specifying
the approximation errors to use. Its length must equal the number of
bands. Entries of e must be in the form e# where # indicates which
approximation error to use for the corresponding band. For example,
when e = {'e1','e2','e1'}, the first and third bands use the same
4-810
firgr
approximation error 'e1' and the second band uses a different one
'e2'. Note that when all bands use the same approximation error,
such as {'e1','e1','e1',...}, it is equivalent to omitting e, as in b
= firgr(n,f,a,w).
b = firgr(n,f,a,s) is used to design filters with special properties at
certain frequency points. s is a cell array of strings and must be the
same length as f and a. Entries of s must be one of:
4-811
firgr
transition-region anomalies.
b = firgr(...,{lgrid}), where {lgrid} is a scalar cell array. The
value of the scalar controls the density of the frequency grid by setting
the number of samples used along the frequency axis.
[b,err] = firgr(...) returns the unweighted approximation
error magnitudes. err contains one element for each independent
4-812
Structure Field
Contents
res.fgrid
res.des
res.wt
Weights on fgrid
res.h
res.error
res.iextr
res.fextr
firgr
Structure Field
Contents
res.order
Filter order
res.edgecheck
res.iterations
res.evals
where:
fresp is the string variable that identifies the function that you use
to define your desired filter frequency response.
n is the filter order.
f is the vector of frequency band edges which must appear
monotonically between 0 and 1, where 1 is one-half of the sampling
frequency. The frequency bands span f(k) to f(k+1) for k odd. The
intervals f(k+1) to f(k+2) for k odd are transition bands or dont
care regions during optimization.
4-813
firgr
gf is a vector of grid points that have been chosen over each specified
frequency band by firgr, and determines the frequencies at which
firgr evaluates the response function.
w is a vector of real, positive weights, one per band, for use during
optimization. w is optional in the call to firgr. If you do not specify
w, it is set to unity weighting before being passed to fresp.
dh and dw are the desired frequency response and optimization
weight vectors, evaluated at each frequency in grid gf.
firgr includes a predefined frequency response function named
'firpmfrf2'. You can write your own based on the simpler 'firpmfrf'.
See the help for private/firpmfrf for more information.
b = firgr(n,f,{fresp,p1,p2,...},w) specifies optional arguments
p1, p2,..., pn to be passed to the response function fresp.
b = firgr(n,f,a,w) is a synonym for b =
firgr(n,f,{'firpmfrf2',a},w), where a is a vector containing your
specified response amplitudes at each band edge in f. By default, firgr
designs symmetric (even) FIR filters. 'firpmfrf2' is the predefined
Examples
These examples demonstrate some filters you might design using firgr.
Example 1
design an FIR filter with two single-band notches at 0.25 and 0.55
4-814
firgr
Example 2
design a highpass filter whose gain at 0.06 is forced to be zero. The gain
at 0.055 is indeterminate since it should abut the band.
b2 = firgr(82,[0 0.055 0.06 0.1 0.15 1],[0 0 0 0 1 1],...
{'n' 'i' 'f' 'n' 'n' 'n'});
Example 3
design a second highpass filter with forced values and independent
approximation errors.
b3 = firgr(82,[0 0.055 0.06 0.1 0.15 1], [0 0 0 0 1 1], ...
{'n' 'i' 'f' 'n' 'n' 'n'}, [10 1 1] ,{'e1' 'e2' 'e3'});
Use the filter visualization tool to view the results of the filters created
in these examples.
fvtool(b1,1,b2,1,b3,1)
4-815
firgr
50
Magnitude (dB)
100
150
200
250
Filter b1
Filter b2
Filter b3
300
350
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
References
See Also
4-816
firhalfband
Purpose
Syntax
b
b
b
b
b
b
b
Description
=
=
=
=
=
=
=
firhalfband(n,fp)
firhalfband(n,win)
firhalfband(n,dev,'dev')
firhalfband('minorder',fp,dev)
firhalfband('minorder',fp,dev,'kaiser')
firhalfband(...,'high')
firhalfband(...,'minphase')
method.
b = firhalfband(...,'high') returns a highpass halfband FIR filter.
b = firhalfband(...,'minphase') designs a minimum-phase FIR
4-817
firhalfband
banks. The minphase option for firhalfband is not available for the
window-based halfband filter designs b = firhalfband(n,win) and
b = firhalfband('minorder ',fp,dev,'kaiser').
In the minimum phase cases, the filter order must be odd.
Examples
4-818
firhalfband
References
See Also
4-819
firlp2lp
Purpose
Syntax
g = firlp2lp(b)
Description
Examples
References
See Also
firlp2hp | zerophase
4-820
firlp2hp
Purpose
Syntax
g = firlp2hp(b)
g = firlp2hp(b,'narrow')
g = firlp2hp(b,'wide')
Description
with zero-phase response Hr(w) into a Type I wide band highpass FIR
filter g with zero-phase response 1 - Hr(w). Note the restriction that b
must be a Type I linear-phase filter.
For this case, the passband and stopband ripples of g will be equal to
the stopband and passband ripples of b.
Examples
Overlay the original narrowband lowpass (the prototype filter) and the
post-conversion narrowband highpass and wideband highpass filters
to compare and assess the conversion. The following plot shows the
results.
b = firgr(36,[0 .2 .25 1],[1 1 0 0],[1 3]);
h = firlp2hp(b);
hfvt = fvtool(b,1,h,1);
legend(hfvt,'Prototype Lowpass','Narrowband Highpass');
4-821
firlp2hp
References
See Also
firlp2lp | zerophase
4-822
firlpnorm
Purpose
Syntax
b = firlpnorm(n,f,edges,a)
b = firlpnorm(n,f,edges,a,w)
b = firlpnorm(n,f,edges,a,w,p)
b = firlpnorm(n,f,edges,a,w,p,dens)
b = firlpnorm(n,f,edges,a,w,p,dens,initnum)
b = firlpnorm(...,'minphase')
[b,err] = firlpnorm(...)
Description
the error in the vicinity of each frequency point relative to the other
points. For example,
b = firlpnorm(20,[0 .15 .4 .5 1],[0 .4 .5 1],...
[1 1.6 1 0 0],[1 1 1 10 10])
4-823
firlpnorm
designs a lowpass filter with a peak of 1.6 within the passband, and
with emphasis placed on minimizing the error in the stopband.
b = firlpnorm(n,f,edges,a,w,p) where p is a two-element vector
[pmin pmax] lets you specify the minimum and maximum values of p
used in the least-pth algorithm. Default is [2 128] which essentially
yields the L-infinity, or Chebyshev, norm. pmin and pmax should be
even numbers. The design algorithm starts optimizing the filter with
pmin and moves toward an optimal filter in the pmax sense. When p is
the string inspect, firlpnorm does not optimize the resulting filter.
You might use this feature to inspect the initial zero placement.
b = firlpnorm(n,f,edges,a,w,p,dens) specifies the grid density
dens used in the optimization. The number of grid points is
[dens*(n+1)]. The default is 20. You can specify dens as a
Examples
4-824
firlpnorm
[1 1 1 2 2]);
fvtool(b)
From the figure you see the resulting filter is lowpass, with the desired
1.4 peak in the passband (notice the 1.4 specified in vector a).
Now for the minimum-phase filter.
% Highpass minimum-phase filter optimized for the 4-norm.
b = firlpnorm(44,[0 .4 .45 1],[0 .4 .45 1],[0 0 1 1],[5 1 1 1],...
[2 4],'minphase');
fvtool(b)
160
60
320
100
480
Magnitude (dB)
Phase (degrees)
20
140
180
0.1
0.2
0.3
0.4
0.5
rad/sample
0.6
0.7
0.8
0.9
640
800
4-825
firlpnorm
The next zero-pole plot shows the minimum phase nature more clearly.
ZeroPole Plot of Minimum Phase FIR Filter
2
1.5
Imaginary Part
0.5
44
0.5
1.5
1.5
0.5
0
0.5
Real Part
1.5
2.5
References
See Also
4-826
firls
Purpose
Syntax
b
b
b
b
Description
=
=
=
=
firls(n,f,a)
firls(n,f,a,w)
firls(n,f,a,ftype)
firls(n,f,a,w,ftype)
'hilbert'
'differentiator'
b = firls(n,f,a,w,ftype) uses the weights in vector w to weigh the
error. It also specifies a filter type where ftype is:
'hilbert'
'differentiator'
Input
Arguments
n - Filter order
Order of the filter, specified as an integer scalar. For odd orders, the
frequency response at the Nyquist frequency is necessarily 0. For this
reason, firls always uses an even filter order for configurations with
a passband at the Nyquist frequency. If you specify an odd-valued n,
firls increments it by 1.
Example: 8
4-827
firls
Data Types
int8 | int16 | int32 | int64
f - Pairs of frequency points
4-828
firls
Weights to weigh the fit for each frequency band, specified as a vector
of length half the length of f and a, so there is exactly one weight per
band. w indicates how much emphasis to put on minimizing the integral
squared error in each band, relative to the other bands.
Example: [0.5 1]
Data Types
double | single
ftype - Filter type
'hilbert' and 'differentiator'
Output
Arguments
b - Filter coefficients
vector of numeric values
symmetry (type III and type IV). The output coefficients, or taps, in
b obey the relation:
4-829
firls
Examples
Use firls to obtain the n+1 coefficients of the order n lowpass FIR filter.
b = firls(255,f,a);
Plot the ideal amplitude response along with the transition regions.
4-830
firls
plot(f.*pi,a,'o','markerfacecolor',[1 0 0]);
hold on;
plot(f.*pi,a,'r--','linewidth',2);
Use freqz to obtain the frequency response of the designed filter and
plot the magnitude response of the filter.
[H,F] = freqz(b,1);
plot(F,abs(H));
set(gca,'xlim',[0 pi])
legend('Filter Specification','Transition Regions','Magnitude Response
4-831
firls
Algorithms
4-832
firls
This function designs type I, II, III, and IV linear-phase filters. Type I
and II are the defaults for n even and odd respectively. The 'hilbert'
and 'differentiator' flags produce type III (n even) and IV (n
odd) filters. The various filter types have different symmetries and
constraints on their frequency responses (see [2] for details).
Linear
Phase
Filter Type
Filter
Order
Type I
Even
Type II
Type III
Response
H(f), f = 0
Response
H(f), f = 1
(Nyquist)
No
restriction
No
restriction
No
restriction
H(1) = 0
H(0) = 0
H(1) = 0
H(0) = 0
No
restriction
Symmetry of Coefficients
Even
Odd
b(k) = b(n+2-k), k=1,..., n+1
Type IV
Odd
b(k) = b(n+2-k), k=1,..., n+1
Definitions
Diagnostics
Error and warning messages
One of the following diagnostic messages is displayed when an incorrect
argument is used:
F must be even length.
F and A must be equal lengths.
Requires symmetry to be 'hilbert' or 'differentiator'.
Requires one weight per band.
Frequencies in F must be nondecreasing.
Frequencies in F must be in range [0,1].
4-833
firls
This tends to happen when the product of the filter length and
transition width grows large. In this case, the filter coefficients b might
not represent the desired filter. You can check the filter by looking
at its frequency response.
References
[1] Parks, T.W., and C.S. Burrus, Digital Filter Design, John Wiley
& Sons, 1987, pp. 54-83.
[2] Oppenheim, A.V., and R.W. Schafer, Discrete-Time Signal
Processing, Prentice-Hall, 1989, pp. 256-266.
See Also
4-834
firminphase
Purpose
Syntax
h = firminphase(b)
h = firminphase(b,nz)
Description
Examples
References
=
=
=
=
=
=
=
4-835
firminphase
See Also
4-836
firnyquist
Purpose
Syntax
b
b
b
b
b
Description
=
=
=
=
=
firnyquist(n,l,r)
firnyquist('minorder',l,r,dev)
firnyquist(n,l,r,decay)
firnyquist(n,l,r,'nonnegative')
firnyquist(n,l,r,'minphase')
4-837
firnyquist
Examples
Example 1
This example designs a minimum phase factor of a Nyquist filter.
bmin = firnyquist(47,10,.45,'minphase');
b = firnyquist(2*47,10,.45,'nonnegative');
[h,w,s] = freqz(b); hmin = freqz(bmin);
fvtool(b,1,bmin,1);
Example 2
This example compares filters with different decay rates.
b1 = firnyquist(72,8,.3,0); % Equiripple
b2 = firnyquist(72,8,.3,15);
b3 = firnyquist(72,8,.3,25);
fvtool(b1,1,b2,1,b3,1);
References
See Also
4-838
firpr2chfb
Purpose
Syntax
[h0,h1,g0,g1] = firpr2chfb(n,fp)
[h0,h1,g0,g1] = firpr2chfb(n,dev,'dev')
[h0,h1,g0,g1] = firpr2chfb('minorder',fp,dev)
Description
Examples
4-839
firpr2chfb
20
Magnitude (dB)
40
60
80
100
120
140
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Use the following stem plots to verify perfect reconstruction using the
filter bank created by firpr2chfb.
stem(1/2*conv(g0,h0)+1/2*conv(g1,h1))
n=0:n;
stem(1/2*conv((-1).^n.*h0,g0)+1/2*conv((-1).^n.*h1,g1))
stem(1/2*conv((-1).^n.*g0,h0)+1/2*conv((-1).^n.*g1,h1))
stem(1/2*conv((-1).^n.*g0,(-1).^n.*h0)+...
1/2*conv((-1).^n.*g1,(-1).^n.*h1))
stem(conv((-1).^n.*h1,h0)-conv((-1).^n.*h0,h1))
See Also
4-840
firtype
Purpose
Syntax
t = firtype(b)
t = firtype(d)
Description
Input
Arguments
b - Filter coefficients
vector
object
FIR filter, specified as any of the following:
A digitalFilter object. Use designfilt to generate a digital filter
based on frequency-response specifications.
A Filter System object. You can use this input if you have a license
for DSP System Toolbox software. firtype supports the following
Filter System objects.
dsp.AllpassFilter
dsp.AllpoleFilter
dsp.BiquadFilter
dsp.CICDecimator
4-841
firtype
dsp.CICInterpolator
dsp.CoupledAllpassFilter
dsp.FIRDecimator
dsp.FIRFilter
dsp.FIRInterpolator
dsp.FIRRateConverter
dsp.IIRFilter
A dfilt filter object. You can use this input if you have a license for
DSP System Toolbox software.
A multirate mfilt filter object. You can use this input if you have
a license for DSP System Toolbox software.
Output
Arguments
t - Filter type
1|2|3|4
Examples
4-842
firtype
subplot(2,1,2)
b = fir1(9,0.5);
impz(b), title(['Type ' int2str(firtype(b))])
4-843
firtype
subplot(2,1,2)
b = firpm(9,[0.2 0.8],[1 1],'hilbert');
impz(b), title(['Type ' int2str(firtype(b))])
4-844
firtype
See Also
is
is
is
is
of
of
of
of
type
type
type
type
1
2
3
4
4-845
freqrespest
Purpose
Syntax
[h,w] = freqrespest(H,L)
[h,w] = freqrespest(H,L,param1,value1,param2,value2,...)
[h,w] = freqrespest(H,L,opts)
freqrespest(H,...)
Description
and then forming the ratio between output data and input data. The
test input data comprises sinusoids with uniformly distributed random
frequencies.
Use this technique for comparing the performance of fixed-point
filters to that of another filter type. You can, for example, compare
fixedpoint frequency response estimate to that of a similar filter
that uses quantized coefficients, but applies floating-point arithmetic
internally. Such comparison determines whether the fixed-point filter
performance closely matches the floating-point, quantized coefficients
version of the filter.
L is the number of trials to use to compute the estimate. If you do
not specify this value, L defaults to 10. More trials generates a more
4-846
freqrespest
Parameter Name
Default
Value
Description
NFFT
512
NormalizedFrequency true
Fs
normalized
SpectrumRange
half
CenterDC
false
Arithmetic (only
for filter System
objects)
ARITH
4-847
freqrespest
Parameter Name
Default
Value
Description
filter when the arithmetic input
is not specified and the filter
System object is in an unlocked
state.
System Object
State
ARITH = 'double'
Unlocked
Rule
freqrespest
performs
double-precision
analysis.
Locked
freqrespest
performs
double-precision
analysis.
4-848
freqrespest
Value
System Object
State
ARITH = `single'
Unlocked
Rule
freqrespest
performs
single-precision
analysis.
Locked
freqrespest
performs
single-precision
analysis.
ARITH = `fixed'
Unlocked
freqrespest
produces an
error because the
fixed-point input data
type is unknown.
Locked
4-849
freqrespest
Because opts is an object, you use set to change the parameter values
in opts before you use it with freqrespest. For example, you could
specify a new sample rate with
set(opts,'fs',48e3); % Same as opts.fs=48e3
Examples
4-850
freqrespest
4-851
freqrespest
20
Frequency response estimated by filtering
Frequency response computed by quantizing coefficients only
0
Magnitude (dB)
20
40
60
80
100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Normalized Frequency ( rad/sample)
0.8
0.9
Example 2
freqrespest works with state-space filters as well. This example
estimates the frequency response of a state-space filter.
fs = 315000;
wp = [320 3800]/(fs/2);
ws = [50 19000]/(fs/2);
rp=0.15; rs=60;
[n,wn]=cheb1ord(wp,ws,rp,rs);
[a,b,c,d] = cheby1(n,rp,wn);
hd = dfilt.statespace(a,b,c,d);
% Compare the following to freqz(hd,8192)
freqrespest(hd,1,'nfft',8192);
4-852
freqrespest
See Also
4-853
freqrespopts
Purpose
Syntax
opts = freqrespopts(H)
Description
Examples
4-854
freqrespopts
hd2=design(d,'cheby2')
hd2.arithmetic='fixed';
opts=freqrespopts(hd)
opts =
NFFT:
NormalizedFrequency:
Fs:
SpectrumRange:
CenterDC:
512
true
'Normalized'
'Half'
false
256
false
1500
'Whole'
true
See Also
4-855
freqsamp
Purpose
Syntax
hd = design(d,'freqsamp')
hd = design(...,'filterstructure',structure)
hd = design(...,'window',window)
Description
structures.
Structure String
dffir
dffirt
dfsymfir
dfasymfir
fftfir
4-856
freqsamp
Examples
4-857
freqsamp
Magnitude (dB)
10
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-858
freqsamp
Magnitude (dB)
10
15
20
25
30
35
See Also
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
4-859
freqz
Purpose
Syntax
[h,w] = freqz(hfilt)
[h,w] = freqz(hfilt,n)
freqz(hfilt)
[h,w] = freqz(hs)
[h,w] = freqz(hs,n)
[h,w] = freqz(hs,Name,Value)
freqz(hs)
Description
with the filter to calculate the frequency response of the filter with the
current coefficient values.
freqz(hfilt) uses FVTool to plot the magnitude and unwrapped phase
of the frequency response of the filter hfilt. If hfilt is a vector of
filters, freqz plots the magnitude response and phase for each filter in
the vector.
[h,w] = freqz(hs) returns a frequency response for the filter System
4-860
freqz
Input
Arguments
hfilt
hfilt is either:
4-861
freqz
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
Details for Fixed-Point Arithmetic
4-862
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
freqz
System Object
State
Coefficient Data
Type
Rule
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
4-863
freqz
Output
Arguments
Tips
Algorithms
freqz calculates the frequency response for a filter from the filter
transfer function Hq(z). The complex-valued frequency response is
calculated by evaluating Hq(ej) at discrete values of w specified by the
syntax you use. The integer input argument n determines the number of
equally-spaced points around the upper half of the unit circle at which
freqz evaluates the frequency response. The frequency ranges from 0 to
radians per sample when you do not supply a sampling frequency as
an input argument. When you supply the scalar sampling frequency fs
as an input argument to freqz, the frequency ranges from 0 to fs/2 Hz.
Examples
4-864
freqz
freqz(hd);
If you have more than one filter, you can plot them on the same figure
using a vector of filters.
b = fir1(40,0.5,kaiser(41,6));
hd2 = dfilt.dffir(b);
h = [hd hd2];
freqz(h);
4-865
freqz
See Also
4-866
gain
Purpose
Syntax
gain(hm)
gain(hm,j)
gain(hs)
Description
filter.
When hm is a decimator, gain returns the gain for the overall CIC
decimator.
When hm is an interpolator, the CIC interpolator inserts zeros into the
input data stream, reducing the filter overall gain by 1/R, where R is
the interpolation factor, to account for the added zero valued samples.
Therefore, the gain of a CIC interpolator is (RM)N/R, where N is the
number of filter sections and M is the filter differential delay. gain(hm)
returns this value. The next example presents this case.
gain(hm,j) returns the gain of the jth section of a CIC interpolation
filter. When you omit j, gain assumes that j is 2*N, where N is the
number of sections, and returns the gain of the last section of the filter.
This syntax does not apply when hm is a decimator.
gain(hs) returns the gain of the filter System object hs. The function
supports the dsp.CICDecimator and dsp.CICInterpolator filter
structures.
Examples
4-867
gain
hm = design(d,'multistage');
ym = filter(hm,x);
r = 4; % Interpolation factor for the CIC filter.
d = fdesign.interpolator(r,'cic');
hcic = design(d,'multisection');
ycic = filter(hcic,x);
gaincic = gain(hcic);
subplot(211);
plot(1:length(ym),[ym; double(ycic)]);
subplot(212)
plot(1:length(ym),[ym; double(ycic)/gain(hcic)]);
After correcting for the gain induced by the CIC interpolator, the figure
shows the filters provide nearly identical interpolation.
See Also
4-868
scale
grpdelay
Purpose
Syntax
[gd,w]=grpdelay(hfilt)
[gd,w]=grpdelay(hfilt,n)
grpdelay(hfilt)
[gd,w] = grpdelay(hs)
[gd,w] = grpdelay(hs,n)
[gd,w] = grpdelay(hs,Name,Value)
grpdelay(hs)
Description
d
(angle(w))
dw
4-869
grpdelay
object hs.
Input
Arguments
hfilt
hfilt is either:
4-870
grpdelay
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-871
grpdelay
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-872
grpdelay
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
gd
See Also
phasez | zerophase
4-873
help
Purpose
Syntax
help(d,'designmethod')
Description
Examples
Get specific help for designing lowpass Butterworth filters. The first
lowpass filter uses the default specification string Fp,Fst,Ap,Ast' and
returns help text specific to the specification string.
d = fdesign.lowpass;
designmethods(d)
Design Methods for class fdesign.lowpass (Fp,Fst,Ap,Ast):
butter
cheby1
cheby2
ellip
equiripple
ifir
kaiserwin
multistage
help(d,'butter')
DESIGN Design a Butterworth IIR filter.
HD = DESIGN(D, 'butter') designs a Butterworth filter specified
by the FDESIGN object D.
HD = DESIGN(..., 'FilterStructure', STRUCTURE) returns a filter
with the structure STRUCTURE.
4-874
help
'df1sos'
'df2sos'
'df1tsos'
'df2tsos'
HD = DESIGN(..., 'MatchExactly', MATCH) designs a Butterworth
filter and matches the frequency and magnitude specification for
the band MATCH exactly. The other band will exceed the
specification.
'stopband' by default.
% Example #1 - Compare passband and stopband MatchExactly.
h
Hd
Note the discussion of the MatchExactly input option. When you use a
design object that uses a different specification string, such as N,F3dB,
the help content for the butter design method changes.
In this case, the MatchExactly option does not appear in the help
because it is not an available input argument for the specification string
N,F3dB'.
d=fdesign.lowpass('N,F3dB')
d =
Response: 'Lowpass'
Specification: 'N,F3dB'
Description: {'Filter Order';'3dB Frequency'}
NormalizedFrequency: true
FilterOrder: 10
F3dB: 0.5
4-875
help
designmethods(d)
Design Methods for class fdesign.lowpass (N,F3dB):
butter
help(d,'butter
DESIGN Design a Butterworth IIR filter.
HD = DESIGN(D, 'butter') designs a Butterworth filter
specified by the FDESIGN object D.
HD = DESIGN(..., 'FilterStructure', STRUCTURE) returns a
filter with the structure STRUCTURE. STRUCTURE is 'df2sos'
by default and can be any of the following.
'df1sos'
'df2sos'
'df1tsos'
'df2tsos'
% Example #1 - Design a lowpass Butterworth filter in the
DF2TSOS structure.
h = fdesign.lowpass('N,F3dB');
Hd = design(h, 'butter', 'FilterStructure', 'df2tsos');
See Also
4-876
ifir
Purpose
Syntax
[h,g] = ifir(l,type,f,dev)
[h,g,d] = ifir(l,type,f,dev)
[...] = ifir(...,str)
hd = ifir(d)
hd = design(d,'ifir',designoption1,value1,designoption2,value2,...)
Description
4-877
ifir
returns an interpolated FIR filter using the design options you specify.
To determine the available design options, use designopts with the
specification object and the design method as input arguments:
designopts(d,'method')
Examples
4-878
ifir
4-879
ifir
4-880
ifir
4-881
ifir
apass = 1;
d2 = fdesign.highpass(fstop,fpass,astop,apass);
hd2 = design(d2,'ifir');
fvtool(hd1,hd2)
See Also
4-882
iirbpc2bpc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirbpc2bpc(B,A,Wo,Wt)
Description
[Num,Den,AllpassNum,AllpassDen] = iirbpc2bpc(B,A,Wo,Wt)
returns the numerator and denominator vectors, Num and Den
Examples
4-883
iirbpc2bpc
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
Using FVTool to plot the filters shows you the comparison, presented in
this figure.
Magnitude Response (dB)
0
Prototype
Target
50
Magnitude (dB)
100
150
200
250
300
350
1
4-884
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
iirbpc2bpc
Arguments
Variable
Description
Wo
Wt
Num
Den
AllpassNum
AllpassDen
See Also
4-885
iircomb
Purpose
Syntax
[num,den] = iircomb(n,bw)
[num,den] = iircomb(n,bw,ab)
[num,den] = iircomb(...,'type')
Description
For the notching filter, the transfer function takes the form
H ( z) = b
1 z n
1 z n
where and b are the positive scalars and n is the filter order or the
number of notches in the filter minus 1.
The quality factor (Q factor) q for the filter is related to the filter
bandwidth by q = 0/bw where 0 is the frequency to remove from the
signal.
[num,den] = iircomb(n,bw,ab) returns a digital notching filter
whose bandwidth, bw, is specified at a level of -ab decibels. Including
the optional input argument ab lets you specify the magnitude response
bandwidth at a level that is not the default -3 dB point, such as -6 dB
or 0 dB.
[num,den] = iircomb(...,'type') returns a digital filter of the
specified type. The input argument type can be either
4-886
iircomb
H ( z) = b
Examples
1 z n
1 + az n
Design and plot an IIR notch filter with 11 notches (equal to filter order
plus 1) that removes a 60 Hz tone (f0) from a signal at 600 Hz (fs). For
this example, set the Q factor for the filter to 35 and use it to specify
the filter bandwidth.
fs = 600; fo = 60; q = 35; bw = (fo/(fs/2))/q;
[b,a] = iircomb(fs/fo,bw,'notch'); % Note type flag 'notch'
fvtool(b,a);
4-887
iircomb
See Also
4-888
iirftransf
Purpose
Syntax
[OutNum,OutDen] = iirftransf(OrigNum,OrigDen,FTFNum,FTFDen)
Description
[OutNum,OutDen] = iirftransf(OrigNum,OrigDen,FTFNum,FTFDen)
returns the numerator and denominator vectors, OutNum and OutDen,
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
4-889
iirftransf
20
30
Magnitude (dB)
40
50
60
70
80
90
100
Arguments
See Also
4-890
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
OrigNum
OrigDen
FTFNum
FTFDen
OutNum
OutDen
zpkftransf
iirgrpdelay
Purpose
Syntax
[num,den] = iirgrpdelay(n,f,edges,a)
[num,den] = iirgrpdelay(n,f,edges,a,w)
[num,den] = iirgrpdelay(n,f,edges,a,w,radius)
[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p)
[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens)
[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens,initden)
[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens,initden,tau)
[num,den,tau] = iirgrpdelay(n,f,edges,a,w)
Description
4-891
iirgrpdelay
the initial estimate of the group delay offset to be specified by the value
of tau, in samples.
[num,den,tau] = iirgrpdelay(n,f,edges,a,w) returns the resulting
group delay offset. In all cases, the resulting filter has a group delay
that approximates [a + tau]. Allpass filters can have only positive
group delay and a non-zero value of tau accounts for any additional
group delay that is needed to meet the shape of the contour specified by
(f,a). The default for tau is max(a).
Hint: If the zeros or poles cluster together, your filter order may be
too low or the pole radius may be too small (overly constrained). Try
increasing n or radius.
For group-delay equalization of an IIR filter, compute a by subtracting
the filters group delay from its maximum group delay. For example,
[be,ae] = ellip(4,1,40,0.2);
f = 0:0.001:0.2;
g = grpdelay(be,ae,f,2);
% Equalize only the passband.
a = max(g)-g;
[num,den]=iirgrpdelay(8, f, [0 0.2], a);
4-892
iirgrpdelay
References
See Also
4-893
iirlinphase
Purpose
Syntax
hd = design(d,'iirlinphase')
hd = design(...,'filterstructure',structure)
Description
Examples
Structure String
Filter Structure
df1sos
df2sos
df1tsos
df2tsos
4-894
iirlinphase
measure(hd)
See Also
fdesign.halfband
4-895
iirlp2bp
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2bp(B,A,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2bp(Hd,Wo,Wt)
Description
4-896
iirlp2bp
Examples
Create the real bandpass filter by placing the cutoff frequencies of the
prototype filter at the band edge frequencies Wt1=0.25 and Wt2=0.75:
[num,den] = iirlp2bp(b,a,0.5,[0.25,0.75]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b,a,num,den);
You can compare the results in this figure to verify the transformation.
4-897
iirlp2bp
50
Magnitude (dB)
100
150
200
250
300
350
Arguments
4-898
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
Wo
Wt
Num
Den
AllpassNum
AllpassDen
iirlp2bp
References
See Also
4-899
iirlp2bpc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2bpc(B,A,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2bpc(Hd,Wo,Wt)
Description
[Num,Den,AllpassNum,AllpassDen] = iirlp2bpc(B,A,Wo,Wt)
returns the numerator and denominator vectors, Num and Den
4-900
iirlp2bpc
Examples
Move the cutoffs of the prototype filter to the new locations Wt1=0.25
and Wt2=0.75 creating a complex bandpass filter:
[num, den] = iirlp2bpc(b, a, 0.5, [0.25, 0.75]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
Plotting the prototype and target filters together in FVTool lets you
compare the filters.
4-901
iirlp2bpc
50
Magnitude (dB)
100
150
200
250
300
350
1
Arguments
4-902
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
Variable
Description
Wo
Wt
Num
iirlp2bpc
Variable
Description
Den
See Also
4-903
iirlp2bs
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2bs(B,A,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2bs(Hd,Wo,Wt)
Description
4-904
iirlp2bs
filter for mapping the prototype filter frequency Wo and the target
frequencies vector Wt. Note that in this syntax Hd is a dfilt object
with a lowpass magnitude response.
Design a prototype real IIR halfband filter using a standard elliptic
approach:
[b, a] = ellip(3, 0.1, 30, 0.409);
Create the real bandstop filter by placing the cutoff frequencies of the
prototype filter at the band edge frequencies Wt1=0.25 and Wt2=0.75:
[num, den] = iirlp2bs(b, a, 0.5, [0.25, 0.75]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
Magnitude Response (dB)
0
Prototype
Target
50
100
Magnitude (dB)
Examples
150
200
250
300
350
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-905
iirlp2bs
With both filters plotted in the figure, you see clearly the results of
the transformation.
Arguments
Variable
Description
Wo
Wt
Num
Den
AllpassNum
AllpassDen
References
4-906
iirlp2bs
See Also
4-907
iirlp2bsc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2bsc(B,A,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2bsc(Hd,Wo,Wt)
Description
[Num,Den,AllpassNum,AllpassDen] = iirlp2bsc(B,A,Wo,Wt)
returns the numerator and denominator vectors, Num and Den
4-908
iirlp2bsc
Examples
Move the cutoffs of the prototype filter to the new locations Wt1=0.25
and Wt2=0.75 creating a complex bandstop filter:
[num, den] = iirlp2bsc(b, a, 0.5, [0.25, 0.75]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
The last command in the example plots both filters in the same window
so you can compare the results.
4-909
iirlp2bsc
50
Magnitude (dB)
100
150
200
250
300
350
1
Arguments
4-910
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
Variable
Description
Wo
Wt
iirlp2bsc
See Also
Variable
Description
Num
Den
AllpassNum
AllpassDen
4-911
iirlp2hp
Purpose
Syntax
[num,den] = iirlp2hp(b,a,wc,wd)
[G,AllpassNum,AllpassDen] = iirlp2hp(Hd,Wo,Wt)
Description
4-912
iirlp2hp
Examples
4-913
iirlp2hp
Magnitude Response
20
20
Magnitude (dB)
40
60
80
100
120
Filter #1: Lowpass filter magnitude
Filter #2: Highpass filter magnitude
140
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
In the figure showing the magnitude responses for the two filters, the
transition band for the highpass filter is essentially the mirror image
of the transition for the lowpass filter from 0.0175 to 0.025, stretched
out over a wider frequency range. In the passbands, the filter share
common ripple characteristics and magnitude.
References
See Also
4-914
iirlp2lp
Purpose
Syntax
[num,den] = iirlp2lp(b,a,wc,wd)
[G,AllpassNum,AllpassDen] = iirlp2lp(Hd,Wo,Wt)
Description
4-915
iirlp2lp
Examples
Moving the edge of the passband from 0.0175 to 0.2 results in a new
lowpass filter whose peak response in-band is the same as the original
filter: same ripple, same absolute magnitude.
4-916
iirlp2lp
Magnitude Response
20
20
Magnitude (dB)
40
60
80
100
120
Filter #1: Original lowpass filter magnitude
Filter #2: Transformed filter magnitude
140
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
The rolloff is slightly less steep and the stopband profiles are the same
for both filters; the new filter stopband is a stretched version of the
original, as is the passband of the new filter.
References
See Also
4-917
iirlp2mb
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2mb(B,A,Wo,Wt)
[Num,Den,AllpassNum,AllpassDen]=iirlp2mb(B,A,Wo,Wt,Pass)
[G,AllpassNum,AllpassDen] = iirlp2mb(Hd,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2mb(...,Pass)
Description
4-918
iirlp2mb
Mobility. In the first case the Nyquist feature stays at its original
location and the DC feature is free to move. In the second case the
DC feature is kept at an original frequency and the Nyquist feature
is allowed to move.
The coefficients AllpassNum and AllpassDen represent the allpass
mapping filter for mapping the prototype filter frequency Wo and the
target frequencies vector Wt. Note that in this syntax Hd is a dfilt
object with a lowpass magnitude response.
Examples
Example 1
Create the real multiband filter with two passbands:
[num1, den1] = iirlp2mb(b, a, 0.5, [2 4 6 8]/10);
[num2, den2] = iirlp2mb(b, a, 0.5, [2 4 6 8]/10, 'pass');
4-919
iirlp2mb
The second code snippet uses the pass option to select the Nyquist
mobility option. In this case the resulting filter is the same.
Example 2
Create the real multiband filter with two stopbands:
[num3, den3] = iirlp2mb(b, a, 0.5, [2 4 6 8]/10, 'stop');
Verify the result by comparing the prototype filter with target filters:
fvtool(b, a, num1, den1, num2, den2, num3, den3);
Combining all of the filters, prototypes and targets, on one figure makes
comparing them straightforward. Passbands for the filters in example 1
appear separately in the figure, although they overlap to a degree that
makes them hard to identify they have identical coefficients.
4-920
iirlp2mb
50
Magnitude (dB)
100
150
200
250
Prototype
Multiple Passband Filter with DC Mobility
Multiple Passband with Nyquist Mobility Option
Multiple Stopband Filter
300
350
Arguments
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
Wo
Wt
Pass
Num
4-921
iirlp2mb
Variable
Description
Den
AllpassNum
AllpassDen
References
See Also
4-922
iirlp2mbc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2mbc(B,A,Wo,Wc)
[G,AllpassNum,AllpassDen] = iirlp2mbc(Hd,Wo,Wt)
Description
[Num,Den,AllpassNum,AllpassDen] = iirlp2mbc(B,A,Wo,Wc)
returns the numerator and denominator vectors, Num and Den
4-923
iirlp2mbc
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num1, den1);
4-924
iirlp2mbc
50
Magnitude (dB)
100
150
200
250
300
Prototype Lowpass Filter
Target Multiband Filter
350
1
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
You see in the figure that iirlp2mbc replicates the desired feature at
0.5 in the lowpass filter at four locations in the multiband filter.
Arguments
Variable
Description
Wo
Wc
Num
4-925
iirlp2mbc
See Also
4-926
Variable
Description
Den
AllpassNum
AllpassDen
iirlp2xc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2xc(B,A,Wo,Wt)
[G,AllpassNum,AllpassDen] = iirlp2xc(Hd,Wo,Wt)
Description
4-927
iirlp2xc
Examples
Create the complex bandpass filter from the real lowpass filter:
[num, den] = iirlp2xc(b, a, [-0.5 0.5], [-0.25 0.25]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
4-928
iirlp2xc
50
Magnitude (dB)
100
150
200
250
Prototype Filter
Target Filter
300
350
1
Arguments
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
Variable
Description
Wo
Wt
Num
4-929
iirlp2xc
Variable
Description
Den
See Also
4-930
iirlp2xn
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirlp2xn(B,A,Wo,Wt)
[Num,Den,AllpassNum,AllpassDen] = iirlp2xn(B,A,Wo,Wt,Pass)
[G,AllpassNum,AllpassDen] = iirlp2bpc(Hd,Wo,Wt),
where Hd is a dfilt object
[G,AllpassNum,AllpassDen] = iirlp2bpc(...,Pass)
Description
between using the "DC Mobility" and the "Nyquist Mobility." In the
first case the Nyquist feature stays at its original location and the DC
feature is free to move. In the second case the DC feature is kept at an
original frequency and the Nyquist feature is allowed to move.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen, of the allpass mapping filter. The prototype lowpass
filter is given with the numerator specified by B and the denominator
specified by A.
Parameter N also specifies the number of replicas of the prototype
filter created around the unit circle after the transformation. This
transformation effectively places N features of an original filter, located
at frequencies Wo1,...,WoN, at the required target frequency locations,
Wt1,...,WtM.
Relative positions of other features of an original filter are the same
in the target filter for the Nyquist mobility and are reversed for the
DC mobility. For the Nyquist mobility this means that it is possible to
select two features of an original filter, F1 and F2, with F1 preceding F2.
Feature F1 will still precede F2 after the transformation. However,
the distance between F1 and F2 will not be the same before and after
4-931
iirlp2xn
Mobility." In the first case the Nyquist feature stays at its original
location and the DC feature is free to move. In the second case the
DC feature is kept at an original frequency and the Nyquist feature
is allowed to move.
The coefficients AllpassNum and AllpassDen represent the allpass
mapping filter for mapping the prototype filter frequency Wo and the
target frequencies vector Wt. Note that in this syntax Hd is a dfilt
object with a lowpass magnitude response.
4-932
iirlp2xn
Examples
Move the cutoffs of the prototype filter to the new locations Wt1=0.25
and Wt2=0.75 creating a real bandpass filter:
[num, den] = iirlp2xn(b, a, [-0.5 0.5], [0.25 0.75], ...
pass');
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
iirlp2xn has created the desired bandpass filter with the cutoff
locations specified in the command.
4-933
iirlp2xn
Magnitude Response in dB
0
10
20
Magnitude (dB)
30
40
50
60
70
Prototype Filter
Target Filter from Shifting Frequency
80
90
Arguments
4-934
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
Wo
Wt
Pass
Num
iirlp2xn
Variable
Description
Den
AllpassNum
AllpassDen
References
See Also
4-935
iirlpnorm
Purpose
Syntax
[num,den] = iirlpnorm(n,d,f,edges,a)
[num,den] = iirlpnorm(n,d,f,edges,a,w)
[num,den] = iirlpnorm(n,d,f,edges,a,w,p)
[num,den] = iirlpnorm(n,d,f,edges,a,w,p,dens)
[num,den] = iirlpnorm(n,d,f,edges,a,w,p,dens,initnum,initden)
[num,den,err] = iirlpnorm(...)
[num,den,err,sos,g] = iirlpnorm(...)
Description
4-936
iirlpnorm
Hints
References
4-937
iirlpnorm
See Also
4-938
iirlpnormc
Purpose
Syntax
[num,den]
[num,den]
[num,den]
[num,den]
=
=
=
=
iirlpnormc(n,d,f,edges,a)
iirlpnormc(n,d,f,edges,a,w)
iirlpnormc(n,d,f,edges,a,w,radius)
iirlpnormc(n,d,f,edges,a,w,radius,p)
[num,den] = iirlpnormc(n,d,f,edges,a,w,radius,p,dens)
[num,den] = iirlpnormc(n,d,f,edges,a,w,radius,p,dens,initnum,initden)
[num,den,err] = iirlpnormc(...)
[num,den,err,sos,g] = iirlpnormc(...)
Description
4-939
iirlpnormc
defaults to 0.999999. Filters that have a reduced pole radius may retain
better transfer function accuracy after you quantize them.
[num,den] = iirlpnormc(n,d,f,edges,a,w,radius,p) where p is
a two-element vector [pmin pmax] allows for the specification of the
minimum and maximum values of p used in the least-pth algorithm.
the grid density dens used in the optimization. The number of grid
points is (dens*(n+d+1)). The default is 20. dens can be specified as a
single-element cell array. The grid is not equally spaced.
[num,den] =
iirlpnormc(n,d,f,edges,a,w,radius,p,dens,initnum,initden)
allows for the specification of the initial estimate of the filter numerator
and denominator coefficients in vectors initnum and initden. This
may be useful for difficult optimization problems. The pole-zero
editor in Signal Processing Toolbox software can be used for
generating initnum and initden.
[num,den,err] = iirlpnormc(...) returns the least-Pth
Hints
4-940
iirlpnormc
Similarly, if several poles have a large radius and the zeros are well
inside of the unit circle, try increasing the order of the denominator
or reducing the error weight in the passband.
If you reduce the pole radius, you might need to increase the order
of the denominator.
The message
Poorly conditioned matrix. See the "help" file.
Examples
From the magnitude response shown here you see the lowpass nature
of the filter. The pole/zero plot following shows that the poles are
constrained to 0.8 as specified in the command.
4-941
iirlpnormc
Magnitude (dB)
20
40
60
80
100
120
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Pole/Zero Plot
1
0.8
0.6
Imaginary Part
0.4
0.2
0
0.2
0.4
0.6
0.8
1
4-942
0.5
0
Real Part
0.5
1.5
iirlpnormc
References
See Also
4-943
iirls
Purpose
Syntax
hd = design(d,'iirls')
hd = design(d,'iirls',designoption,value,designoption,value,...)
Description
Note The iirls algorithm might not be well behaved in all cases.
Experience is your best guide to determining if the resulting filter
meets your needs. When you use iirls to design a filter, review the
filter carefully to ensure that it is appropriate for your use.
hd =
design(d,'iirls',designoption,value,designoption,value,...)
For complete help about using iirls, refer to the command line help
system. For example, to get specific information about using iirls with
d, the specification object, enter the following at the MATLAB prompt.
help(d,'iirls')
Examples
4-944
iirls
d =
Response: 'Arbitrary Magnitude and Phase'
Specification: 'N,F,H'
Description: {'Filter Order';'Frequency Vector';'
Complex Desired Frequency Response'
NormalizedFrequency: true
FilterOrder: 5
Frequencies: [1x655 double]
FreqResponse: [1x655 double]
design(d,'iirls'); % Opens FVTool to show the filter.
8.4799
Magnitude
Phase
5.7153
15.5628
2.9507
24.303
0.1861
33.0433
2.5785
Magnitude (dB)
Phase (radians)
6.8225
41.7835
1
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
5.3431
4-945
iirls
See Also
4-946
iirnotch
Purpose
Syntax
[num,den] = iirnotch(w0,bw)
[num,den] = iirnotch(w0,bw,ab)
Description
The quality factor (Q factor) q for the filter is related to the filter
bandwidth by q w0/bw where 0 is w0, the frequency to remove from
the signal.
[num,den] = iirnotch(w0,bw,ab) returns a digital notching filter
whose bandwidth, bw, is specified at a level of -ab decibels. Including
the optional input argument ab lets you specify the magnitude response
Examples
Design and plot an IIR notch filter that removes a 60 Hz tone (f0) from
a signal at 300 Hz (fs). For this example, set the Q factor for the filter
to 35 and use it to specify the filter bandwidth:
wo = 60/(300/2); bw = wo/35;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
Shown in the next plot, the notch filter has the desired bandwidth with
the notch located at 60 Hz, or 0.4 radians per sample. Compare this
plot to the comb filter plot shown on the reference page for iircomb.
4-947
iirnotch
See Also
4-948
iirpeak
Purpose
Syntax
[num,den] = iirpeak(w0,bw)
[num,den] = iirpeak(w0,bw,ab)
Description
The quality factor (Q factor) q for the filter is related to the filter
bandwidth by q = w0/bw where 0 is w0 the signal frequency to boost.
[num,den] = iirpeak(w0,bw,ab) returns a digital peaking filter
whose bandwidth, bw, is specified at a level of +ab decibels. Including
the optional input argument ab lets you specify the magnitude response
bandwidth at a level that is not the default +3 dB point, such as
+6 dB or 0 dB.
Examples
Design and plot an IIR peaking filter that boosts the frequency at 1.75
Khz in a signal and has bandwidth of 500 Hz at the -3 dB point:
fs = 10000; wo = 1750/(fs/2);
[b,a] = iirpeak(wo,bw);
fvtool(b,a);
bw = 500/(fs/2);
Shown in the next plot, the peak filter has the desired gain and
bandwidth at 1.75 KHz.
4-949
iirpeak
See Also
4-950
iirpowcomp
Purpose
Syntax
[bp,ap] = iirpowcomp(b,a)
[bp,ap,c] = iirpowcomp(b,a)
Description
Examples
[b,a]=cheby1(10,.5,.4);
[bp,ap]=iirpowcomp(b,a);
Hd1 = dfilt.df2(b,a);
Hd2 = dfilt.df2(bp,ap);
hfvt = fvtool([Hd1,Hd2],'MagnitudeDisplay','Magnitude');
legend(hfvt,'Original Filter','Power Complementary Version');
4-951
iirpowcomp
See Also
4-952
iirrateup
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirrateup(B,A,N)
Description
frequency response.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen, of the allpass mapping filter. The prototype lowpass filter
is given with a numerator specified by B and a denominator specified
by A.
The relative positions of other features of an original filter do not change
in the target filter. This means that it is possible to select two features
of an original filter, F1 and F2, with F1 preceding F2. Feature F1 will still
precede F2 after the transformation. However, the distance between F1
and F2 will not be the same before and after the transformation.
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
4-953
iirrateup
Magnitude Response in dB
0
50
Magnitude (dB)
100
150
200
250
300
350
Arguments
4-954
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
Num
Den
AllpassNum
AllpassDen
iirrateup
See Also
4-955
iirshift
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirshift(B,A,Wo,Wt)
Description
Examples
4-956
iirshift
Perform the real frequency shift by defining where the selected feature
of the prototype filter, originally at Wo=0.5, should be placed in the
target filter, Wt=0.75:
Wo = 0.5; Wt = 0.75;
[num, den] = iirshift(b, a, Wo, Wt);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
Shifting the specified feature from the prototype to the target generates
the response shown in the figure.
Magnitude Response in dB
0
10
20
Magnitude (dB)
30
40
50
60
70
Prototype Filter
Target Filter from Shifting Frequency
80
90
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
4-957
iirshift
Arguments
Variable
Description
Wo
Wt
Num
Den
AllpassNum
AllpassDen
See Also
4-958
iirshiftc
Purpose
Syntax
[Num,Den,AllpassNum,AllpassDen] = iirshiftc(B,A,Wo,Wc)
[Num,Den,AllpassNum,AllpassDen] = iirshiftc(B,A,0,0.5)
[Num,Den,AllpassNum,AllpassDen] = iirshiftc(B,A,0,-0.5)
Description
[Num,Den,AllpassNum,AllpassDen] = iirshiftc(B,A,Wo,Wc)
returns the numerator and denominator vectors, Num and Den
calculates the allpass filter for doing the Hilbert transformation, i.e. a
90 degree counterclockwise rotation of an original filter in the frequency
domain.
[Num,Den,AllpassNum,AllpassDen] = iirshiftc(B,A,0,-0.5)
Examples
4-959
iirshiftc
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, num, den);
After applying the shift, the selected feature from the original filter is
just where it should be, at Wt = 0.25.
Magnitude Response in dB
0
50
Magnitude (dB)
100
150
Prototype Filter
Target Filter
200
250
300
350
1
Arguments
4-960
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
Variable
Description
iirshiftc
Variable
Description
Wo
Wt
Num
Den
AllpassNum
AllpassDen
References
See Also
4-961
impz
Purpose
Syntax
[h,t] = impz(hfilt)
[h,t] = impz(hfilt,n)
[h,t] = impz(hfilt,n,fs)
[h,t] = impz(hfilt,[],fs)
impz(hfilt)
[h,t] = impz(hs)
[h,t] = impz(hs,Name,Value)
impz(hs)
Description
can also provide the optional input arguments n and fs with this syntax.
[h,t] = impz(hs) returns the impulse response for the filter
4-962
impz
Note You can use impz for both real and complex filters. When you
omit the output arguments, impz plots only the real part of the impulse
response.
Input
Arguments
hfilt
hfilt is either:
4-963
impz
hs
Number of samples.
Default: 10
fs
Sampling frequency.
Default: 1
4-964
impz
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-965
impz
System Object
State
Coefficient Data
Type
Rule
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
4-966
impz
Examples
4-967
impz
See Also
4-968
filter | stepz
info
Purpose
Syntax
info(h)
info(h,'short')
info(h,'long')
s = info(h)
Description
info(h) returns very basic information about the filter. The particulars
Input
Arguments
4-969
info
Output
Arguments
Examples
>> d = fdesign.lowpass;
4-970
info
>> f = design(d);
>> info(f)
Discrete-Time FIR Filter (real)
------------------------------Filter Structure : Direct-Form FIR
Filter Length
: 43
Stable
: Yes
Linear Phase
: Yes (Type 1)
>> info (f)
Discrete-Time FIR Filter (real)
------------------------------Filter Structure : Direct-Form FIR
Filter Length
: 43
Stable
: Yes
Linear Phase
: Yes (Type 1)
>> info(f,'long')
Discrete-Time FIR Filter (real)
------------------------------Filter Structure : Direct-Form FIR
Filter Length
: 43
Stable
: Yes
Linear Phase
: Yes (Type 1)
Design Method Information
Design Algorithm : equiripple
Design Options
DensityFactor :
MinOrder
:
MinPhase
:
StopbandDecay :
StopbandShape :
16
any
false
0
flat
Design Specifications
Sampling Frequency : N/A (normalized frequency)
4-971
info
Response
Specification
Passband Edge
Stopband Edge
Passband Ripple
Stopband Atten.
:
:
:
:
:
:
Lowpass
Fp,Fst,Ap,Ast
0.45
0.55
1 dB
60 dB
Measurements
Sampling Frequency
Passband Edge
3-dB Point
6-dB Point
Stopband Edge
Passband Ripple
Stopband Atten.
Transition Width
:
:
:
:
:
:
:
:
Implementation Cost
Number of Multipliers
Number of Adders
Number of States
MultPerInputSample
AddPerInputSample
See Also
4-972
:
:
:
:
:
43
42
42
43
42
int
Purpose
Syntax
integerstates = int(hm.states)
Description
Examples
For many users, the states of multirate filters are most useful as a
matrix, but the CIC filters store the states as objects. Here is how you
get the states from you CIC filter as a matrix.
hm = mfilt.cicdecim;
hs = hm.states; % Returns a FILTSTATES.CIC object hs.
states = int(hs); % Convert object hs to a signed integer matrix.
After using int to convert the states object to a matrix, here is what
you get.
Before converting:
hm.states
ans =
Integrator: [2x1 States]
Comb: [2x1 States]
4-973
int
See Also
4-974
isallpass
Purpose
Syntax
flag
flag
flag
flag
flag
flag
flag
Description
=
=
=
=
=
=
=
isallpass(b,a)
isallpass(sos)
isallpass(d)
isallpass(...,tol)
isallpass(hs,...)
isallpass(hs,'Arithmetic',arithtype)
isallpass(hd)
specifications.
flag = isallpass(...,tol) uses the tolerance, tol, to determine
4-975
isallpass
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
4-976
'Same as input'
isallpass
System Object
State
Coefficient Data
Type
Rule
based on this
assumption.
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
flag = isallpass(hd) returns true if the filter object, hd, is an
allpass filter.
Examples
Allpass Filters
Create an allpass filter and verify that the frequency response is allpass.
b = [1/3 1/4 1/5 1];
a = fliplr(b);
flag = isallpass(b,a)
fvtool(b,a)
flag =
1
4-977
isallpass
Create a lattice allpass filter and verify that the filter is allpass.
k = [1/2 1/3 1/4 1/5];
[b,a] = latc2tf(k,'allpass');
flag_isallpass = isallpass(b,a)
fvtool(b,a)
flag_isallpass =
1
4-978
isallpass
See Also
4-979
isfir
Purpose
Syntax
isfir(h)
isfir(hs)
Description
Examples
d = fdesign.lowpass;
h = design(d);
isfir(h)
ans =
1
returns 1 for the status of filter h. The filter is an FIR structure with
denominator reference coefficient equal to 1.
For multirate filters, isfir works the same way.
d = fdesign.interpolator(5); % Interpolate by 5.
h = design(d); % Use the default design method.
isfir(h)
ans =
1
4-980
isfir
See Also
4-981
islinphase
Purpose
Syntax
flag
flag
flag
flag
flag
flag
flag
Description
=
=
=
=
=
=
=
islinphase(b,a)
islinphase(sos)
islinphase(d)
islinphase(...,tol)
islinphase(hs,...)
islinphase(hs,'Arithmetic',arithtype)
islinphase(h)
order sections matrix, sos, has linear phase. sos is a K-by-6 matrix,
where the number of sections, K, must be greater than or equal to
2. Each row of sos corresponds to the coefficients of a second order
(biquad) filter. The ith row of the sos matrix corresponds to [bi(1)
bi(2) bi(3) ai(1) ai(2) ai(3)].
flag = islinphase(d) returns true if the digital filter, d, has linear
phase. Use designfilt to generate d based on frequency-response
specifications.
flag = islinphase(...,tol) uses the tolerance, tol, to determine
4-982
islinphase
object is locked or unlocked. You must have the DSP System Toolbox to
use islinphase with a System object.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
4-983
islinphase
System Object
State
Coefficient Data
Type
Rule
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
flag = islinphase(h) determines if the filter object h has linear
phase. islinphase accepts an adapfilt, dfilt, or mfilt object. To
create an adapfilt or mfilt object, you must have the DSP System
Toolbox software.
Examples
flag =
1
4-984
islinphase
IIR filters in general do not have linear phase. Verify the statement by
constructing eighth-order Butterworth, Chebyshev, and elliptic filters
with similar specifications.
ord = 8; Wcut = 0.35; atten = 20; rippl = 1;
[zb,pb,kb] = butter(ord,Wcut);
sosb = zp2sos(zb,pb,kb);
[zc,pc,kc] = cheby1(ord,rippl,Wcut);
sosc = zp2sos(zc,pc,kc);
[zd,pd,kd] = cheby2(ord,atten,Wcut);
sosd = zp2sos(zd,pd,kd);
[ze,pe,ke] = ellip(ord,rippl,atten,Wcut); sose = zp2sos(ze,pe,ke);
fv = fvtool(sosb,sosc,sosd,sose,'Analysis','phase');
4-985
islinphase
phs =
0
See Also
4-986
ismaxphase
Purpose
Syntax
flag
flag
flag
flag
flag
flag
flag
Description
=
=
=
=
=
=
=
ismaxphase(b,a)
ismaxphase(sos)
ismaxphase(d)
ismaxphase(...,tol)
ismaxphase(hs,...)
ismaxphase(hs,'Arithmetic',arithtype)
ismaxphase(h)
4-987
ismaxphase
object is locked or unlocked. You must have the DSP System Toolbox
software to use this syntax.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-988
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
ismaxphase
System Object
State
Coefficient Data
Type
Rule
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
flag = ismaxphase(h) returns true if the dfilt filter object h is a
maximum phase filter. If you have the DSP System Toolbox software,
ismaxphase works with adapfilt and mfilt objects.
Examples
max_flag =
1
min_flag =
1
4-989
ismaxphase
max_flag1 =
0
max_flag2 =
1
See Also
4-990
isminphase
Purpose
Syntax
flag = isminphase(b,a)
flag = isminphase(sos)
flag = isminphase(d)
flag = isminphase(...,tol)
flag = isminphase(hs,...)
isminphase(hs,'Arithmetic',arithtype)
flag = isminphase(h)
Description
A filter is minimum phase when all the zeros of its transfer function are
on or inside the unit circle, or the numerator is a scalar. An equivalent
definition for a minimum phase filter is a causal and stable system
with a causal and stable inverse.
flag = isminphase(b,a) returns a logical output, flag, equal to true
4-991
isminphase
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-992
isminphase
System Object
State
Coefficient Data
Type
Rule
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
flag = isminphase(h) determines if the dfilt filter object h is
Examples
4-993
isminphase
SOS = zp2sos(z,p,k);
min_flag = isminphase(SOS)
min_flag =
1
Redesign the filter using designfilt. Check that the zeros and poles of
the transfer function are on or within the unit circle.
d = designfilt('lowpassiir','DesignMethod','butter','FilterOrder',6, ...
'HalfPowerFrequency',0.25);
d_flag = isminphase(d)
zplane(d)
d_flag =
1
4-994
isminphase
min_flag1 =
0
4-995
isminphase
min_flag2 =
1
See Also
4-996
isreal
Purpose
Syntax
isreal(hd)
isreal(hs)
Description
isreal(hd) returns 1 (or true) if all filter coefficients for the filter hd
are real, and returns 0 (or false) otherwise. Complex filters have one or
Note Quantizing a filter cannot make a real filter into a complex filter.
Examples
See Also
4-997
issos
Purpose
Syntax
issos(hd)
issoss(hs)
Description
Examples
By default, fdesign and design return SOS filters when possible. This
example designs a lowpass SOS filter that uses fixed-point arithmetic.
d=fdesign.lowpass('n,fp,ap,ast',40,0.55,0.1,60);
hd=design(d,'ellip');
hd.arithmetic='fixed';
IsSOS=issos(hd);
See Also
4-998
isstable
Purpose
Syntax
flag
flag
flag
flag
flag
flag
Description
=
=
=
=
=
=
isstable(b,a)
isstable(sos)
isstable(d)
isstable(hs)
isstable(hs,'Arithmetic',arithtype)
isstable(h)
order sections matrix, sos, is stable. sos is a K-by-6 matrix, where the
number of sections, K, must be greater than or equal to 2. Each row of
sos corresponds to the coefficients of a second order (biquad) filter. The
ith row of the sos matrix corresponds to [bi(1) bi(2) bi(3) ai(1)
ai(2) ai(3)].
flag = isstable(d) returns true if the digital filter, d, is stable. Use
designfilt to generate d based on frequency-response specifications.
flag = isstable(hs) returns true if the filter System object hs is
stable. You must have the DSP System Toolbox software to use this
syntax.
flag = isstable(hs,'Arithmetic',arithtype) analyzes the filter
System object hs based on the specified arithtype. arithtype can
be 'double', 'single', or 'fixed'. When you specify 'double' or
'single', the function performs double- or single-precision analysis.
When you specify 'fixed' , the arithmetic changes depending on the
setting of the CoefficientDataType property and whether the System
object is locked or unlocked. You must have the DSP System Toolbox
software to use this syntax.
4-999
isstable
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1000
isstable
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
flag = isstable(h) returns true if the filter object, h, is stable. If you
have the DSP System Toolbox, you can use isstable with adaptfilt
and mfilt objects.
Examples
Filter Stability
Design a sixth-order Butterworth highpass IIR filter using second order
sections. Specify a normalized 3-dB frequency of 0.7. Determine if the
filter is stable.
[z,p,k] = butter(6,0.7,'high');
SOS = zp2sos(z,p,k);
flag = isstable(SOS)
zplane(z,p)
flag =
1
4-1001
isstable
d = designfilt('highpassiir','DesignMethod','butter','FilterOrder',6, ...
'HalfPowerFrequency',0.7);
dflg = isstable(d)
zplane(d)
dflg =
4-1002
isstable
Create a filter and determine its stability at double and single precision.
b = [1 -0.5];
a = [1 -0.999999999];
act_flag1 = isstable(b,a)
act_flag2 = isstable(single(b),single(a))
act_flag1 =
1
4-1003
isstable
act_flag2 =
0
See Also
4-1004
kaiserwin
Purpose
Syntax
h = design(d,'kaiserwin')
h = design(d,'kaiserwin',designoption,value,designoption,...
value,...)
Description
arguments and the design process uses the Kaiser window technique.
To determine the available design options, use designopts with the
specification object and the design method as input arguments as
shown.
designopts(d,'method')
For complete help about using kaiserwin, refer to the command line
help system. For example, to get specific information about using
kaiserwin with d, the specification object, enter the following at the
MATLAB prompt.
help(d,'kaiserwin')
Examples
This example designs a direct form FIR filter from a halfband filter
specification object.
d=fdesign.halfband('n,tw',200,0.01)
hd= design(d,'kaiserwin','filterstructure','dffir')
4-1005
kaiserwin
See Also
4-1006
equiripple | firls
lagrange
Purpose
Syntax
Hd = design(d,'lagrange')
hd = design(d,'lagrange',FilterStructure,structure)
Description
Examples
This example uses a fractional delay of 0.30 samples. The help and
designopts commands provide the details about designing fractional
delay filters.
d=fdesign.fracdelay(.30)
d =
Response:
Specification:
Description:
FracDelay:
NormalizedFrequency:
FilterOrder:
'Fractional Delay'
'N'
{'Filter Order'}
0.3
true
3
designmethods(d)
4-1007
lagrange
Design a cubic Lagrange fractional delay filter with filter order equal
to 3..
Fs = 8000;
% Sampling frequency of 8 kHz.
fdelay = 50e-6; % Fractional delay of 50 microseconds.
h = fdesign.fracdelay(fdelay,'N',3,Fs);
hd = design(h,'lagrange','FilterStructure','fd');
4-1008
lagrange
References
See Also
4-1009
liblinks
Purpose
Check model for blocks from specific DSP System Toolbox libraries
Syntax
liblinks(lib)
liblinks(lib,sys)
liblinks(lib,sys,c)
Description
liblinks(lib) returns a cell array of strings that lists the blocks in the
current model that are linked to the specified libraries. The input lib
provides a cell array of strings with the library names. Use the library
name visible in the title bar when you open a library model.
liblinks(lib,sys) acts on the named model sys.
liblinks(lib,sys,c) changes the foreground color of the returned
blocks to the color c. Possible values of c are 'blue', 'green', 'red',
'cyan, 'magenta', 'yellow', or 'black'.
Examples
Check for blocks from the Sources library in the specified model:
rlsdemo
liblinks('dspsrcs4',gcs)
See Also
4-1010
dsp_links
limitcycle
Purpose
Syntax
report = limitcycle(hd)
report = limitcycle(hd,ntrials,inputlengthfactor,stopcriterion)
Description
By default, the input vector has length equal to twice the impulse
response length of the filter.
limitcycle returns a structure whose elements contain the details
about the limit cycle testing. As shown in this table, the report includes
the following details.
Output Object
Property
Description
LimitCycleType
Zi
Output
Trial
4-1011
limitcycle
Using an input vector longer than the filter impulse response ensures
that the filter is in steady-state operation during the limit cycle testing.
limitcycle ignores output that occurs before the filter reaches the
steady state. For example, if the filter impulse length is 500 samples,
limitcycle ignores the filter output from the first 500 input samples.
To perform limit cycle testing on your IIR filter, you must set the filter
Arithmetic property to fixed and hd must be a fixed-point IIR filter of
one of the following forms:
df1 direct-form I
df1t direct-form I transposed
df1sos direct-form I with second-order sections
df1tsos direct-form I transposed with second-order sections
df2 direct-form II
df2t direct-form II transposed
df2sos direct-form II with second-order sections
df2tsos direct-form II transposed with second-order sections
When you use limitcycle without optional input arguments, the
default settings are
Run 20 Monte Carlo trials
Use an input vector twice the length of the filter impulse response
Stop testing if the simulation process encounters either a granular or
overflow limit cycle
To determine the length of the filter impulse response, use impzlength:
impzlength(hd)
During limit cycle testing, if the simulation runs reveal both overflow
and granular limit cycles, the overflow limit cycle takes precedence and
is the limit cycle that appears in the report.
4-1012
limitcycle
Description
either
granular
overflow
4-1013
limitcycle
Examples
greport =
LimitCycle: 'granular'
Zi: [2x1 double]
Output: [1303x1 embedded.fi]
Trial: 1
oreport =
LimitCycle: 'overflow'
Zi: [2x1 double]
Output: [1303x1 embedded.fi]
4-1014
limitcycle
Trial: 2
The plots shown in this figure present both limit cycle types the
first displays the small amplitude granular limit cycle, the second the
larger amplitude overflow limit cycle.
x 10
10
12
Output Sample
14
16
18
20
14
16
18
20
0.6792
0.6791
0.679
0.6789
0.6788
0.6787
10
12
Output Sample
As you see from the plots, and as is generally true, overflow limit cycles
are much greater magnitude than granular limit cycles. This is why
limitcycle favors overflow limit cycle detection and reporting.
See Also
freqz | noisepsd
4-1015
maxflat
Purpose
Syntax
hd = design(d,'maxflat')
hd = design(d,'maxflat','FilterStructure',structure)
Description
Examples
4-1016
maximizestopband
Purpose
Syntax
Hq = maximizestopband(Hd,Wordlength)
Hq = maximizestopband(Hd,Wordlength,'Ntrials',N)
Description
vector, each stage uses the corresponding element in the vector. The
vector length must equal the number of stages. maximizestopband
uses a stochastic noise-shaping procedure by default to minimize the
wordlength. To obtain repeatable results on successive function calls,
initialize the uniform random number generator rand
Hq = maximizestopband(Hd,Wordlength,'Ntrials',N) specifies the
number of Monte Carlo trials to use in the maximization. Hq is the
Examples
4-1017
maximizestopband
See Also
Tutorials
4-1018
maxstep
Purpose
Syntax
mumax = maxstep(ha,x)
[mumax,mumaxmse] = maxstep(ha,x)
Description
adaptfilt.blms
adaptfilt.blmsfft
adaptfilt.lms
adaptfilt.nlms (uses a different syntax. Refer to the text below.)
adaptfilt.se
Note With adaptfilt.nlms filter objects, maxstep uses the following
slightly different syntax:
mumax = maxstep(ha)
[mumax,mumaxmse] = maxstep(ha)
The maximum step size for convergence is fully defined by the filter
object ha. Matrix x is not necessary. If you include an x input matrix,
MATLAB returns an error.
4-1019
maxstep
Examples
ha = adaptfilt.lms(32,mu);
[mumax,mumaxmse] = maxstep(ha,x);
Warning: Step size is not in the range 0 < mu < mumaxmse/2:
Erratic behavior might result.
mumax
mumax =
0.0623
mumaxmse
mumaxmse =
0.0530
4-1020
maxstep
See Also
4-1021
measure
Purpose
Syntax
measure(hd)
measure(hm)
measure(hs)
measure(hs)
Description
specify one or more values that define your desired filter response.
measure(hd) tests the filter to determine the actual values in the
4-1022
Lowpass Filter
Specification
Description
Sampling Frequency
Passband Edge
measure
Lowpass Filter
Specification
Description
3-dB Point
6-dB Point
Stopband Edge
Passband Ripple
Stopband Atten.
Transition Width
Description
Sampling Frequency
First Passband
Edge
First Stopband
Edge
Second Stopband
Edge
4-1023
measure
Bandstop Filter
Specification
Description
Second Passband
Edge
First Passband
Ripple
Stopband Atten.
Second Passband
Edge
First Transition
Width
Second Transition
Width
measure(hm) returns measurements for the multirate filter hm. The set
of filter specifications that measure returns for multirate filters might
be different from those for discrete-time filters.
4-1024
Interpolator Filter
Specification
Description
First Passband
Edge
3-dB Point
measure
Interpolator Filter
Specification
Description
6-dB Point
Stopband Edge
Passband Ripple
Stopband Atten.
Transition Width
'Interpolator'
6
'Lowpass'
'Fp,Fst,Ap,Ast'
{4x1 cell}
true
0.133333333333333
0.166666666666667
1
60
4-1025
measure
Tips
returns values of Unknown for the passband edge, passband ripple, and
transition width measurements, but
f = fdesign.lowpass('N,F3dB,Ast',8,0.5,80);
H = design(f,'cheby2','SystemObject',true);
measure(H,'Fpass',0.4)
Input
Arguments
hd
4-1026
measure
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1027
measure
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1028
measure
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Examples
For the first example, create a lowpass filter and check whether the
actual filter meets the specifications. For this case, use normalized
frequency for Fs, the default setting.
d2=fdesign.lowpass('Fp,Fst,Ap,Ast',0.45,0.55,0.1,80)
d2 =
Response:
Specification:
Description:
NormalizedFrequency:
Fpass:
Fstop:
Apass:
Astop:
'Lowpass'
'Fp,Fst,Ap,Ast'
{4x1 cell}
true
0.45
0.55
0.1
80
designmethods(d2)
butter
cheby1
cheby2
ellip
equiripple
ifir
kaiserwin
multistage
4-1029
measure
'Direct-Form FIR'
'double'
[1x68 double]
false
measure(hd2)
ans =
Sampling Frequency
Passband Edge
3-dB Point
6-dB Point
Stopband Edge
Passband Ripple
Stopband Atten.
Transition Width
:
:
:
:
:
:
:
:
4-1030
'Bandpass'
'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
{7x1 cell}
true
0.35
measure
Fpass1:
Fpass2:
Fstop2:
Astop1:
Apass:
Astop2:
0.45
0.55
0.65
60
1
60
:
:
:
:
:
:
:
:
:
:
:
:
:
:
1.5 kHz
0.2625 kHz
0.31996 kHz
0.32497 kHz
0.3375 kHz
0.4125 kHz
0.42503 kHz
0.43004 kHz
0.4875 kHz
60 dB
0.17985 dB
60 dB
0.075 kHz
0.075 kHz
See Also
4-1031
mfilt
Purpose
Multirate filter
Syntax
hm = mfilt.structure(input1,input2,...)
Description
Structures
Each of the following multirate filter structures has a reference page
of its own.
Filter Structure
String
4-1032
Description of
Resulting Multirate
Filter
Coefficient
Mapping
Support in
realizemdl and
block
mfilt.cascade
Cascade multirate
filters to form another
filter
Supported
mfilt.cicdecim
Cascaded
integrator-comb
decimator
Not supported
mfilt.cicinterp
Cascaded
integrator-comb
interpolator
Not supported
mfilt.farrowsrc
Supported.
mfilt
Filter Structure
String
Description of
Resulting Multirate
Filter
Coefficient
Mapping
Support in
realizemdl and
block
mfilt.fftfirinterp
Overlap-add FIR
polyphase interpolator
Not supported
mfilt.firdecim
Direct-form FIR
polyphase decimator
Supported
mfilt.firinterp
Direct-form FIR
polyphase interpolator
Supported
mfilt.firsrc
Direct-form FIR
polyphase sample rate
converter
Supported
mfilt.firtdecim
Direct-form transposed
FIR polyphase
decimator
Supported
mfilt.holdinterp
Not supported
mfilt.iirdecim
IIR decimator
Supported
mfilt.iirinterp
IIR interpolator
Supported
mfilt.linearinterp
Supported
mfilt.iirwdfdecim
Supported
mfilt.iirwdfinterp
Supported
4-1033
mfilt
Note The syntax hd2 = hd copies only the object handle. It does not
create a new object. hd2 and hd are not independent. If you change
the property value for one of the two, such as hd2, you are changing
the property for both.
Examples
4-1034
mfilt
Note Multirate filters can also have complex coefficients. For example,
you can specify complex coefficients in the argument num passed to the
filter structure. This works for all multirate filter structures.
m = 2;
num = [0.5 0.5+1j*0.2];
Hm = mfilt.firdecim(m, num);
y = filter(Hm, [1:10]);
See Also
4-1035
mfilt.cascade
Purpose
Syntax
hm = cascade(hm1,hm2,...,hmn)
Description
In block diagram form, the cascade looks like this, with x as the input to
the filter hm and y the output from the cascade filter hm:
Examples
See Also
4-1036
dfilt.cascade
mfilt.cicdecim
Purpose
Syntax
hm = mfilt.cicdecim(r,m,n,iwl,owl,wlps)
Description
Description
iwl
4-1037
mfilt.cicdecim
Input
Arguments
Description
owl
wlps
4-1038
mfilt.cicdecim
When you specify the word lengths correctly, the most significant bit
Bmax stays the same throughout the filter, while the word length of
each section either decreases or stays the same. This can cause the
fraction length to change throughout the filter as least significant bits
are truncated to decrease the word length, as shown in Algorithms
on page 4-1052.
Values
Default
Description
Arithmetic
fixed
fixed
DecimationFactor
DifferentialDelay
mfilt structure
None
FilterStructure
string
FilterInternals
FullPrecision,
FullPrecision
MinWordLengths,
SpecifyPrecision,
SpecifyWordLengths
4-1039
mfilt.cicdecim
Name
Values
Default
Description
InputFracLength
15
InputOffset
0
Integers in the
range
0 InputOffset r-1
Contains a value
derived from the
number of input
samples and the
decimation factor
InputOffset =
mod(length(nx),m)
See InputOffset on
page 5-125 for more
information.
InputWordLength
4-1040
16
mfilt.cicdecim
Name
Values
Default
Description
NumberOfSections
Number of sections
used in the decimator.
Generally called n.
Reflects either the
number of decimator
or comb sections, not
the total number of
sections in the filter.
OutputFracLength
15
OutputWordLength
16
PersistentMemory
false or true
false
Determines whether
the filter states get
restored to their
starting values for each
filtering operation.
The starting values
are the values in place
when you create the
filter if you have not
changed the filter since
you constructed it.
PersistentMemory
4-1041
mfilt.cicdecim
Name
Values
Default
Description
that the filter does
not change are not
affected. When
PersistentMemory
is false, you cannot
Values
Default
Description
SectionWord
Lengths
Any integer or a
vector of length 2*n.
16
as a scalar or vector
of length 2*n, where
n is the number
of sections. When
SectionWordLengths
is a vector of values,
4-1042
mfilt.cicdecim
Name
Values
Default
Description
the values apply
to the sections in
order. The default is
16 for each section
in the decimator.
Available when
FilterInternals is
'SpecifyWordLengths'.
States
filtstates.cic
object
m+1-by-n matrix of
4-1043
mfilt.cicdecim
Usage Modes
There are four modes of usage for this which are set using the
FilterInternals property
FullPrecision All word and fraction lengths set to
Bmax + 1, called Baccum by Fred Harris in [3]. Full Precision is the
default setting.
MinWordLengths Automatically set the sections for minimum
word lengths.
SpecifyWordLengths Specify the word lengths for each section.
SpecifyPrecision Specify precision by providing values for the
word and fraction lengths for each section.
Full Precision
In full precision mode, the word lengths of all sections and the output
are set to Baccum as defined by
4-1044
mfilt.cicdecim
Minimum Wordlengths
In minimum word length mode, you control the output word length
explicitly. When the output word length is less than Baccum, roundoff
noise is introduced at the output of the filter. Hogenauers bit pruning
theory (refer to [1]) states that one valid design criterion is to make the
word lengths of the different sections of the filter smaller than Baccum
as well, so that the roundoff noise introduced by all sections does not
exceed the roundoff noise introduced at the output.
In this mode, the design calculates the word lengths of each section to
meet the Hogenauer criterion. The algorithm subtracts the number
of bits computed using eq. 21 in Hogenauers paper from Baccum to
determine the word length each section.
To compute the fraction lengths of the different sections, the algorithm
notes that the bits thrown out for this word length criterion are least
significant bits (LSB), therefore each bit thrown out at a particular
section decrements the fraction length of that section by one bit
compared to the input fraction length. Setting the output wordlength
for the filter automatically sets the output fraction length as well.
Here is the display for this mode:
FilterStructure: 'Cascaded Integrator-Comb Decimator'
Arithmetic: 'fixed'
DifferentialDelay: 1
NumberOfSections: 2
DecimationFactor: 4
PersistentMemory: false
InputWordLength: 16
InputFracLength: 15
FilterInternals: 'MinWordLengths'
OutputWordLength: 16
4-1045
mfilt.cicdecim
In this mode, the design algorithm discards the LSBs, adjusting the
fraction length so that unrecoverable overflow does not occur, always
producing a reasonable output.
You can specify the word lengths for all sections and the output, but you
cannot control the fraction lengths for those quantities.
To specify the word lengths, you enter a vector of length
2*(NumberOfSections), where each vector element represents the
word length for a section. If you specify a scalar, such as Baccum, the
full-precision output word length, the algorithm expands that scalar to a
vector of the appropriate size, applying the scalar value to each section.
The CIC design does not check that the specified word lengths are
monotonically decreasing. There are some cases where the word lengths
are not necessarily monotonically decreasing, for example
hcic=mfilt.cicdecim;
hcic.FilterInternals='minwordlengths';
hcic.Outputwordlength=14;
which are valid CIC filters but the word lengths do not decrease
monotonically across the sections.
Here is the display for the SpecifyWordLengths mode.
FilterStructure: 'Cascaded Integrator-Comb Decimator'
Arithmetic: 'fixed'
DifferentialDelay: 1
NumberOfSections: 2
DecimationFactor: 4
PersistentMemory: false
InputWordLength: 16
InputFracLength: 15
FilterInternals: 'SpecifyWordLengths'
SectionWordLengths: [19 18 18 17]
4-1046
mfilt.cicdecim
OutputWordLength: 16
Specify precision
In this mode, you have full control over the word length and fraction
lengths of all sections and the filter output.
When you elect the SpecifyPrecision mode, you must enter a vector
of length 2*(NumberOfSections) with elements that represent the
word length for each section. When you enter a scalar such as Baccum,
mfilt.cicdecim expands that scalar to a vector of the appropriate size
and applies the scalar value to each section and the output. The design
does not check that this vector is monotonically decreasing.
Also, you must enter a vector of length 2*(NumberOfSections) with
elements that represent the fraction length for each section as well.
When you enter a scalar such as Baccum, mfilt.cicdecim applies scalar
expansion as done for the word lengths.
Here is the SpecifyPrecision display.
FilterStructure: 'Cascaded Integrator-Comb Decimator'
Arithmetic: 'fixed'
DifferentialDelay: 1
NumberOfSections: 2
DecimationFactor: 4
PersistentMemory: false
InputWordLength: 16
InputFracLength: 15
FilterInternals: 'SpecifyPrecision'
SectionWordLengths: [19 18 18 17]
SectionFracLengths: [14 13 13 12]
OutputWordLength: 16
OutputFracLength: 11
4-1047
mfilt.cicdecim
STS is an integer matrix that int returns from the contents of the
filtstates.cic object in hm.
Design Considerations
When you design your CIC decimation filter, remember the following
general points:
The filter output spectrum has nulls at = k * 2/rm radians,
k = 1,2,3....
Aliasing and imaging occur in the vicinity of the nulls.
n, the number of sections in the filter, determines the passband
attenuation. Increasing n improves the filter ability to reject aliasing
and imaging, but it also increases the droop (or rolloff) in the filter
passband. Using an appropriate FIR filter in series after the CIC
decimation filter can help you compensate for the induced droop.
4-1048
mfilt.cicdecim
Examples
=
=
=
=
4-1049
mfilt.cicdecim
Decimated Signal
3000
2500
Amplitude
2000
1500
1000
500
10
Samples
12
14
16
18
20
The next example demonstrates one way to compute the filter frequency
response, using a 4-section decimation filter with the decimation factor
set to 7:
hm = mfilt.cicdecim(7,1,4);
fvtool(hm)
FVTool provides ways for you to change the title and x labels to match
the figure shown. Heres the frequency response plot for the filter.
For details about the transfer function used to produce the frequency
response, refer to [1] in the References section.
4-1050
mfilt.cicdecim
This final example demonstrates the decimator for converting from 44.1
kHz audio to 22.05 kHz decimation by two. To overlay the before and
after signals, scale the output and plot the signals on a stem plot.
r = 2;
% Decimation factor.
n = 0:10239;
4-1051
mfilt.cicdecim
y = y/max(abs(y));
stem(n(1:44)/fs,x(2:45)); hold on;
1
Original Signal
Decimated Signal
0.8
0.6
0.4
Signal value
0.2
0.2
0.4
0.6
0.8
Algorithms
0.1
0.2
0.3
0.4
0.5
Time (sec)
0.6
0.7
0.8
0.9
1
3
x 10
4-1052
mfilt.cicdecim
References
See Also
mfilt | mfilt.cicinterp
4-1053
mfilt.cicinterp
Purpose
Syntax
hm = mfilt.cicinterp(R,M,N,ILW,OWL,WLPS)
hm = mfilt.cicinterp
hm = mfilt.cicinterp(R,...)
Description
4-1054
Description
mfilt.cicinterp
Input
Arguments
Description
IWL
OWL
WLPS
as input arguments.
4-1055
mfilt.cicinterp
2 j ,
G j = 22 N j ( RM ) j N
,
j = 1, 2,, N
j = N + 1,, 2 N
WN = Bin + N 1 if M = 1
The conversions denoted by the cast blocks in the integrator diagrams
in Algorithms on page 4-1064 perform the changes between the word
lengths of each section. When you specify word lengths that do not
follow the constraints described in this section, mfilt.cicinterp
returns an error.
The fraction lengths and scalings of the filter sections do not change. At
each section the word length is either staying the same or increasing.
The signal scaling can change at the output after the final filter section
if you choose the output word length to be less than the word length
of the final filter section.
4-1056
mfilt.cicinterp
Values
Default
Description
Arithmetic
fixed
fixed
mfilt structure
None
DifferentialDelay
FilterStructure
string
FilterInternals
FullPrecision,
MinWordLengths,
SpecifyWordLengths,
SpecifyPrecision
InputFracLength
16
4-1057
mfilt.cicinterp
Name
Values
Default
Description
InputWordLength
16
NumberOfSections
Number of sections
used in the interpolator.
Generally called n.
Reflects either the number
of interpolator or comb
sections, not the total
number of sections in the
filter.
OutputFracLength
15
OutputWordLength
16
PersistentMemory
false or true
false
4-1058
mfilt.cicinterp
Name
Values
Default
Description
States that the filter
does not change are
not affected. When
PersistentMemory is
false, you cannot access
the filter states. Setting
PersistentMemory to
true reveals the States
property so you can modify
the filter states.
SectionWordLengths
Any integer or a
vector of length 2N,
where N is a positive
integer.
This property only
applies when the
FilterInternals is
SpecifyWordLengths.
16
as a scalar or vector of
length 2*n, where n is the
number of sections. When
SectionWordLengths
4-1059
mfilt.cicinterp
Name
Values
Default
Description
when FilterInternals is
'SpecifyWordLengths'.
States
filtstates.cic
object
m+1-by-n
matrix of
zeros, after
you call
function int.
Usage Modes
There are usage modes which are set using the FilterInternals
property:
FullPrecision In this mode, the word and fraction lengths of the
filter sections and outputs are automatically selected for you. The
output and last section word lengths are set to:
4-1060
mfilt.cicinterp
4-1061
mfilt.cicinterp
hm = mfilt.cicinterp(2,1,2,16,16,16);
% get initial states-all zero
sts=int(hm.states)
set(hm,'InputFracLength',0); % Integer input specified
y=filter(hm,x);
sts=int(hm.states)
%sts =
%
%
-1
-1
%
-1
-1
Design Considerations
When you design your CIC interpolation filter, remember the following
general points:
The filter output spectrum has nulls at =
k * 2/rm radians, k = 1,2,3....
Aliasing and imaging occur in the vicinity of the nulls.
n, the number of sections in the filter, determines the passband
attenuation. Increasing n improves the filter ability to reject aliasing
and imaging, but it also increases the droop or rolloff in the filter
passband. Using an appropriate FIR filter in series after the CIC
interpolation filter can help you compensate for the induced droop.
The DC gain for the filter is a function of the interpolation factor.
Raising the interpolation factor increases the DC gain.
Examples
% Interpolation factor.
hm = mfilt.cicinterp(R);
fs = 22.05e3;
4-1062
n = 0:5119;
x = sin(2*pi*1e3/fs*n);
mfilt.cicinterp
As you expect, the plot shows that the interpolated signal matches the
input sine shape, with additional samples between each original sample.
1
Original Signal
Interpolated Signal
0.8
0.6
0.4
Signal value
0.2
0.2
0.4
0.6
0.8
0.1
0.2
0.3
0.4
0.5
Time (sec)
0.6
0.7
0.8
0.9
1
3
x 10
4-1063
mfilt.cicinterp
Use the filter visualization tool (FVTool) to plot the response of the
interpolator object. For example, to plot the response of an interpolator
with an interpolation factor of 7, 4 sections, and 1 differential delay,
do something like the following:
hm = mfilt.cicinterp(7,1,4)
fvtool(hm)
Algorithms
When you select MinWordLengths, the filter section word lengths are
automatically set to the minimum number of bits possible in a valid
CIC interpolator. mfilt.cicinterp computes the wordlength for each
section so the roundoff noise introduced by all sections is less than the
roundoff noise introduced by the quantization at the output.
References
4-1064
mfilt.cicinterp
4-1065
mfilt.farrowsrc
Purpose
Syntax
hm = mfilt.farrowsrc(L,M,C)
hm = mfilt.farrowsrc
hm = mfilt.farrowsrc(l,...)
Description
Note You can use the realizemdl method to create a Simulink block
of a filter created using mfilt.farrowsrc.
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
Description
4-1066
mfilt.farrowsrc
Values
Description
FilterStructure
String
Arithmetic
String
Coefficients
Vector
InterpolationFactor Integer
4-1067
mfilt.farrowsrc
Examples
Name
Values
Description
DecimationFactor
Integer
PersistentMemory
false or
true
Fs = 44.1e3;
n = 0:9407;
= sin(2*pi*1e3/Fs*n);
y = filter(Hm,x);
stem(n(1:45)/Fs,x(1:45))
hold on
% Plot fractionally interpolated signal (48kHz) in red
stem((n(2:50)-1)/(Fs*L/M),y(2:50),'r','filled')
xlabel('Time (sec)');ylabel('Signal value')
legend('44.1 kHz sample rate','48kHz sample rate')
4-1068
mfilt.farrowsrc
4-1069
mfilt.fftfirinterp
Purpose
Syntax
hm = mfilt.fftfirinterp(l,num,bl)
hm = mfilt.fftfirinterp
hm = mfilt.fftfirinterp(l,...)
Description
The input arguments are optional. To enter any optional value, you
must include all optional values to the left of your desired value.
When you omit one or more input options, the omitted option applies
the default values shown in the table below.
The number of FFT points is given by [bl+ceil(length(num)/l)-1]. It
is to your advantage to choose bl such that the number of FFT points is
a power of twousing powers of two can improve the efficiency of the
FFT and the associated interpolation process.
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
4-1070
Description
num
bl
mfilt.fftfirinterp
Values
Description
FilterStructure
Numerator
InterpolationFactor
BlockLength
4-1071
mfilt.fftfirinterp
Name
Values
Description
PersistentMemory
false or
true
States
Examples
% Interpolation factor
hm = mfilt.fftfirinterp(l);
n = 8192;
% Number of points
hm.blocklength = n;
fs = 44.1e3;
n = 0:n-1;
x = sin(2*pi*n*22e3/fs);
y = filter(hm,x);
% Interpolated sinusoid
xu = l*upsample(x,8);
4-1072
mfilt.fftfirinterp
plot(f,10*log10(([fs*px,l*fs*py])))
legend('22
'22
kHz',...
kHz')
See Also
4-1073
mfilt.firdecim
Purpose
Syntax
hm = mfilt.firdecim(m)
hm = mfilt.firdecim(m,num)
Description
the decimation filter. This lets you specify more completely the FIR
filter to use for the decimator.
Make this filter a fixed-point or single-precision filter by changing the
value of the Arithmetic property for the filter hm as follows:
To change to single-precision filtering, enter
set(hm,'arithmetic','single');
Input Arguments
The following table describes the input arguments for creating hm.
4-1074
mfilt.firdecim
Input
Argument
Object
Properties
Description
num
Values
Description
Arithmetic
Double,
single,
fixed
DecimationFactor
Integer
4-1075
mfilt.firdecim
Name
Values
Description
the input signal. It must be
an integer.
4-1076
FilterStructure
String
InputOffset
Integers
Numerator
Vector
PersistentMemory
false, true
mfilt.firdecim
Name
Values
Description
true allows you to modify the
States, InputOffset, and
PolyphaseAccum properties.
PolyphaseAccum
0 in double,
single, or
fixed for the
different filter
arithmetic
settings.
States
Double,
single, or
fi matching
the filter
arithmetic
setting.
4-1077
mfilt.firdecim
Note The table lists all of the properties that a fixed-point filter can
have. Many of the properties listed are dynamic, meaning they exist
only in response to the settings of other properties. To view all of the
characteristics for a filter at any time, use info(hm) where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits
[32]
AccumWordLength
Any integer
number of bits
[39]
Arithmetic
fixed for
fixed-point filters
CoeffAutoScale
[true], false
CoeffWordLength
Any integer
number of bits
[16]
4-1078
mfilt.firdecim
Name
Values
Description
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits
[15]
InputWordLength
Any integer
number of bits[16]
OutputFracLength
Any positive or
negative integer
number of bits
[32]
OutputWordLength
Any integer
number of bits
[39]
4-1079
mfilt.firdecim
Name
Values
Description
OverflowMode
saturate, [wrap]
RoundMode
[convergent],
ceil, fix, floor,
nearest, round
4-1080
mfilt.firdecim
Name
Values
Description
[true], false
States
fi object
Filter
Structure
4-1081
mfilt.firdecim
Notice the order of the states in the filter flow diagram. States 1 through
9 appear in the diagram above each delay element. State 1 applies to
the first delay element in phase 2. State 2 applies to the first delay
element in phase 1. State 3 applies to the first delay element in phase
0. State 4 applies to the second delay in phase 2, and so on. When you
provide the states for the filter as a vector to the States property, the
above description explains how the filter assigns the states you specify.
In property value form, the states for a filter hm are
hm.states=[1:9];
Examples
Convert an input signal from 44.1 kHz to 22.05 kHz using decimation
by a factor of 2. In the figure that appears after the example code, you
see the results of the decimation.
m = 2;
% Decimation factor.
hm = mfilt.firdecim(m);
fs = 44.1e3;
n = 0:10239;
% signal.
4-1082
= sin(2*pi*1e3/fs*n);
mfilt.firdecim
y = filter(hm,x);
stem(n(1:44)/fs,x(1:44))
hold on
stem(n(1:22)/(fs/m),y(13:34),'r','filled')
xlabel('Time (sec)');ylabel('Signal Value')
1
Original Signal
Decimated Signal
0.8
0.6
0.4
Signal Value
0.2
0.2
0.4
0.6
0.8
See Also
0.1
0.2
0.3
0.4
0.5
Time (sec)
0.6
0.7
0.8
0.9
1
3
x 10
4-1083
mfilt.firfracdecim (Obsolete)
Purpose
Syntax
hm = mfilt.firfracdecim(l,m,num)
Description
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
4-1084
Description
num
mfilt.firfracdecim (Obsolete)
Input
Argument
Description
filter with gain equal to l and cutoff frequency equal
to /max(l,m) by default.
Values
Description
FilterStructure
String
InputOffset
Integers
Numerator
Vector
4-1085
mfilt.firfracdecim (Obsolete)
Name
Values
RateChangeFactors [l,m]
Description
Reports the decimation (m) and
interpolation (l) factors for the
filter object. Combining these
factors results in the final rate
change for the signal.
PersistentMemory
false or
true
States
Matrix
4-1086
mfilt.firfracdecim (Obsolete)
Examples
= 2; m = 3;
% Interpolation/decimation factors.
= 0:10239;
= sin(2*pi*1e3/fs*n);
= filter(hm,x);
% signal
4-1087
mfilt.firfracdecim (Obsolete)
References
Fliege, N.J., Multirate Digital Signal Processing, John Wiley & Sons,
Ltd., 1994
See Also
4-1088
mfilt.firfracinterp (Obsolete)
Purpose
Syntax
hm = mfilt.firfracinterp(l,m,num)
Description
Input Arguments
The following table describes the input arguments for creating hm.
4-1089
mfilt.firfracinterp (Obsolete)
Input
Argument
Description
num
4-1090
Values
Description
FilterStructure
Numerator
mfilt.firfracinterp (Obsolete)
Examples
Name
Values
Description
RateChangeFactors
[ l ,m ]
PersistentMemory
false or true
States
Matrix
= 3; m = 2;
% Interpolation/decimation factors.
hm = mfilt.firfracinterp(l,m);
fs = 32e3;
n = 0:6799;
= sin(2*pi*1e3/fs*n);
4-1091
mfilt.firfracinterp (Obsolete)
y = filter(hm,x);
0.8
0.6
0.4
Signal Value
0.2
0.2
0.4
0.6
0.8
0.2
0.4
0.6
Time (sec)
See Also
4-1092
0.8
1
3
x 10
mfilt.firinterp
Purpose
Syntax
Hm = mfilt.firinterp(L)
Hm = mfilt.firinterp(L,num)
Description
2 if unspecified.
Hm = mfilt.firinterp(L,num) uses the values in the vector num as
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
Description
num
4-1093
mfilt.firinterp
Object
Properties
Values
Description
Arithmetic
Double, single,
fixed
FilterStructure
String
InterpolationFactor
Integer
Numerator
Vector
4-1094
mfilt.firinterp
Name
Values
Description
PersistentMemory
[false], true
States
Double, single,
matching the filter
arithmetic setting.
where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
4-1095
mfilt.firinterp
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits. [32]
AccumWordLength
Arithmetic
CoeffAutoScale
[true], false
CoeffWordLength
4-1096
mfilt.firinterp
Name
Values
Description
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits [15]
InputWordLength
NumFracLength
Any positive or
negative integer
number of bits [14]
OutputFracLength
Any positive or
negative integer
number of bits [32]
OutputWordLength
4-1097
mfilt.firinterp
Name
Values
Description
OverflowMode
saturate, [wrap]
RoundMode
[convergent], ceil,
fix, floor, nearest,
round
4-1098
mfilt.firinterp
Name
Values
Description
[true], false
States
fi object to match
the filter arithmetic
setting.
Filter
Structure
4-1099
mfilt.firinterp
Examples
% Interpolation factor.
Hm = mfilt.firinterp(L);
fs = 22.05e3;
n = 0:5119;
x
= sin(2*pi*1e3/fs*n);
y = filter(Hm,x);
4-1100
mfilt.firinterp
See Also
4-1101
mfilt.firsrc
Purpose
Syntax
hm = mfilt.firsrc(l,m,num)
Description
4-1102
mfilt.firsrc
Note You can use the realizemdl method to create a Simulink block
of a filter created using mfilt.firsrc.
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
Object
Properties
Description
num
4-1103
mfilt.firsrc
Values
Description
Arithmetic
[Double], single,
fixed
FilterStructure
String
InputOffset
Integers
Numerator
Vector
PersistentMemory
false, true
4-1104
mfilt.firsrc
Name
Values
Description
RateChangeFactors
Positive integers.
[2 3]
States
Double, single,
matching the filter
arithmetic setting.
where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits.
[32]
AccumWordLength
Any integer
number of bits
[39]
4-1105
mfilt.firsrc
Name
Values
Description
Arithmetic
fixed for
fixed-point filters
CoeffAutoScale
[true], false
CoeffWordLength
Any integer
number of bits
[16]
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
Any positive or
negative integer
number of bits [15]
InputWordLength
Any integer
number of bits
[16]
4-1106
mfilt.firsrc
Name
Values
Description
NumFracLength
Any positive or
negative integer
number of bits [14]
OutputFracLength
Any positive or
negative integer
number of bits [32]
OutputWordLength
Any integer
number of bits
[39]
OverflowMode
saturate, [wrap]
RateChangeFactors
Positive integers
[2 3]
4-1107
mfilt.firsrc
Name
Values
Description
RoundMode
[convergent],
ceil, fix, floor,
nearest, round
4-1108
mfilt.firsrc
Name
Values
Description
Signed
[true], false
States
fi object
Examples
= 147; m = 160;
hm = mfilt.firsrc(l,m);
% Interpolation/decimation factors.
% Use the default FIR filter.
fs = 48e3;
n = 0:10239;
= sin(2*pi*1e3/fs*n);
y = filter(hm,x);
stem(n(1:49)/fs,x(1:49))
hold on
% Plot fractionally decimated signal (44.1 kHz) in red
stem(n(1:45)/(fs*l/m),y(13:57),'r','filled')
xlabel('Time (sec)');ylabel('Signal Value')
Fractional decimation provides you the flexibility to pick and choose the
sample rates you want by carefully selecting l and m, the interpolation
and decimation factors, that result in the final fractional decimation.
4-1109
mfilt.firsrc
The following figure shows the signal after applying the rate change
filter hm to the original signal.
1
Original Signal
Signal After Rate Change
0.8
0.6
0.4
Signal Value
0.2
0.2
0.4
0.6
0.8
See Also
4-1110
0.1
0.2
0.3
0.4
0.5
Time (sec)
0.6
0.7
0.8
0.9
1
3
x 10
mfilt.firtdecim
Purpose
Syntax
hm = mfilt.firtdecim(m)
hm = mfilt.firtdecim(m,num)
Description
Input Arguments
The following table describes the input arguments for creating hm.
4-1111
mfilt.firtdecim
Input
Argument
Object
Properties
Description
num
Values
Description
Arithmetic
DecimationFactor
Integer
4-1112
mfilt.firtdecim
Name
Values
Description
FilterStructure
String
InputOffset
Integers
Numerator
Vector
PersistentMemory
[false], true
4-1113
mfilt.firtdecim
Name
Values
Description
PolyphaseAccum
States
Double, single
matching the filter
arithmetic setting.
where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
4-1114
mfilt.firtdecim
Name
Values
Description
AccumFracLength
Any positive or
negative integer
number of bits.
[32]
AccumWordLength
Any integer
number of bits
[39]
Arithmetic
fixed for
fixed-point
filters
CoeffAutoScale
[true], false
CoeffWordLength
Any integer
number of bits
[16]
4-1115
mfilt.firtdecim
Name
Values
FilterInternals
InputFracLength
Any positive or
negative integer
number of bits
[15]
InputWordLength
Any integer
number of bits
[16]
NumFracLength
Any positive or
negative integer
number of bits
[14]
OutputFracLength
Any positive or
negative integer
number of bits
[32]
OutputWordLength
Any integer
number of bits
[39]
4-1116
Description
mfilt.firtdecim
Name
Values
Description
OverflowMode
saturate, [wrap]
PolyphaseAccum
fi object with
zeros to start
RoundMode
[convergent],
ceil, fix,
floor, nearest,
round
4-1117
mfilt.firtdecim
Name
Values
Description
round - Round toward nearest. Ties round
toward negative infinity for negative
numbers, and toward positive infinity for
positive numbers.
The choice you make affects only the
accumulator and output arithmetic. Coefficient
and input arithmetic always round. Finally,
products never overflow they maintain full
precision.
Signed
[true], false
States
fi object
Filter
Structure
4-1118
mfilt.firtdecim
Notice the order of the states in the filter flow diagram. States 1
through 3 appear in the following diagram at each delay element. State
1 applies to the third delay element in phase 2. State 2 applies to the
second delay element in phase 2. State 3 applies to the first delay
element in phase 2. When you provide the states for the filter as a
vector to the States property, the above description explains how the
filter assigns the states you specify.
In property value form, the states for a filter hm are
hm.states=[1:3];
Examples
% Decimation factor.
n = 0:10239;
y = filter(hm,x);
4-1119
mfilt.firtdecim
stem(n(1:22)/(fs/m),y(13:34),'r','filled')
xlabel('Time (sec)');ylabel('Signal Value');
legend('Original signal','Decimated signal','location','best');
See Also
4-1120
mfilt.holdinterp
Purpose
Syntax
hm = mfilt.holdinterp(l)
Description
When you use this hold interpolator, each sample added to the input
signal between existing samples has the value of the most recent sample
from the original signal. Thus you see something like a staircase profile
where the interpolated samples form a plateau between the previous
and next original samples. The example demonstrates this profile
clearly. Compare this to the interpolation process for other interpolators
in the toolbox, such as mfilt.linearinterp.
Make this filter a fixed-point or single-precision filter by changing the
value of the Arithmetic property for the filter hm as follows:
To change to single-precision filtering, enter
set(hm,'arithmetic','single');
Input Arguments
The following table describes the input arguments for creating hm.
Input
Argument
l
Description
Interpolation factor for the filter. l specifies the
amount to increase the input sampling rate. It
must be an integer. When you do not specify a
value for l it defaults to 2.
4-1121
mfilt.holdinterp
Object
Properties
4-1122
Name
Values
Description
Arithmetic
Double, single,
fixed
FilterStructure
String
InterpolationFactor
Integer
mfilt.holdinterp
Name
Values
Description
PersistentMemory
false or true
States
Double or single
array
where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
4-1123
mfilt.holdinterp
4-1124
Name
Values
Description
Arithmetic
Double,
single, fixed
FilterStructure
String
InputFracLength
Any positive
or negative
integer
number of bits
[15]
InputWordLength
Any integer
number of bits
[16]
InterpolationFactor
Integer
PersistentMemory
'false' or
'true'
States
fi object
mfilt.holdinterp
Name
Values
Description
associated properties from
those objects. For details,
refer to fixed-point objects
in Fixed-Point Designer
documentation.
Filter
Structure
Examples
% Interpolation factor
hm = mfilt.holdinterp(l);
fs = 22.05e3;
n = 0:5119;
= sin(2*pi*1e3/fs*n);
y = filter(hm,x);
stem(n(1:22)/fs,x(1:22),'filled')
hold on
% 22.05 kHz
stem(n(1:44)/(fs*l),y(1:44),'r')
legend('Original Signal','Interpolated Signal','Location','best');
xlabel('Time (sec)');ylabel('Signal Value')
The following figure shows clearly the step nature of the signal
that comes from interpolating the signal using the hold algorithm
approach. Compare the output to the linear interpolation used in
mfilt.linearinterp.
4-1125
mfilt.holdinterp
See Also
4-1126
mfilt.iirdecim
Purpose
IIR decimator
Syntax
hm = mfilt.iirdecim(c1,c2,...)
Description
Examples
When the coefficients are known, you can construct the IIR decimator
directly using mfilt.iirdecim. For example, if the filters coefficients
are [0.6 0.5] for the first phase in the first stage, 0.7 for the second phase
in the first stage and 0.8 for the third phase in the first stage; as well as
0.5 for the first phase in the second stage and 0.4 for the second phase
in the second stage, construct the filter as shown here.
Hm = mfilt.iirdecim({[0.6 0.5] 0.7 0.8},{0.5 0.4})
4-1127
mfilt.iirdecim
= 100;
= 60;
= 2000;
2;
%
%
%
%
4-1128
mfilt.iirdecim
Phase 1 model
4-1129
mfilt.iirdecim
Phase 2 model
4-1130
mfilt.iirdecim
Overall model
See Also
4-1131
mfilt.iirinterp
Purpose
IIR interpolator
Syntax
hm = mfilt.iirinterp(c1,c2,...)
Description
filter given the coefficients specified in the cell arrays C1, C2, etc.
The IIR interpolator is a polyphase IIR filter where each phase is a
cascade allpass IIR filter.
Each cell array ci contains a set of vectors representing a cascade
of allpass sections. Each element in one cell array is one section.
For more information about the contents of each cell array, refer to
dfilt.cascadeallpass. The contents of the cell arrays are the same
for both filter constructors and mfilt.iirdecim interprets them same
way as mfilt.cascadeallpass.
The following exception applies to interpreting the contents of a cell
arrayif one of the cell arrays ci contains only one vector, and that
vector comprises a series of 0s and a unique element equal to 1, that
cell array represents a dfilt.delay section with latency equal to the
number of zeros, rather than a dfilt.cascadeallpass section. This
exception case occurs with quasi-linear phase IIR interpolators.
Although the first example shows how to construct an IIR interpolator
explicitly, one usually constructs an IIR interpolator filter as a result of
designing an interpolator, as shown in the subsequent examples.
Examples
When the coefficients are known, you can construct the IIR interpolator
directly using mfilt.iirinterp. In the following example, a cascaded
polyphase IIR interpolator filter is constructed using 2 phases for each
of three stages. The coefficients are given below:
Phase1Sect1=0.0603;Phase1Sect2=0.4126; Phase1Sect3=0.7727;
Phase2Sect1=0.2160; Phase2Sect2=0.6044; Phase2Sect3=0.9239;
4-1132
mfilt.iirinterp
4-1133
mfilt.iirinterp
The toolbox creates a Simulink model for hm, shown here. Phase1,
Phase2, and InterpCommutator are all subsystem blocks.
4-1134
mfilt.iirinterp
See Also
4-1135
mfilt.iirwdfdecim
Purpose
Syntax
hm = mfilt.iirwdfdecim(c1,c2,...)
Description
decimator given the coefficients specified in the cell arrays c1, c2, and so
on. The IIR decimator hm is a polyphase IIR filter where each phase is a
cascade wave digital allpass IIR filter.
Each cell array ci contains a set of vectors representing a cascade
of allpass sections. Each element in one cell array is one section.
For more information about the contents of each cell array, refer to
dfilt.cascadewdfallpass. The contents of the cell arrays are the
same for both filter constructors and mfilt.iirwdfdecim interprets
them same way as mfilt.cascadewdfallpass.
The following exception applies to interpreting the contents of a cell
array if one of the cell arrays ci contains only one vector, and that
vector comprises a series of 0s and one element equal to 1, that cell
array represents a dfilt.delay section with latency equal to the
number of zeros, rather than a dfilt.cascadewdfallpass section.
This exception occurs with quasi-linear phase IIR decimators.
Usually you do not construct IIR wave digital filter decimators
explicitly. Instead, you obtain an IIR wave digital filter decimator as
a result of designing a halfband decimator. The first example in the
following section illustrates this case.
Examples
4-1136
=
=
=
=
100;
80;
2000;
2;
%
%
%
%
mfilt.iirwdfdecim
d = fdesign.decimator(m,'halfband','tw,ast',tw,ast,fs);
4-1137
mfilt.iirwdfdecim
The models that realizemdl returns for each example appear below. At
this level, the realizations of the filters are identical. The differences
appear in the subsystem blocks Phase1 and Phase2.
4-1138
mfilt.iirwdfdecim
4-1139
mfilt.iirwdfdecim
See Also
4-1140
mfilt.iirwdfinterp
Purpose
Syntax
hm = mfilt.iirwdfinterp(c1,c2,...)
Description
Examples
4-1141
mfilt.iirwdfinterp
If you have Simulink installed, you can realize your filter as a model
built from DSP System Toolbox blocks.
% Note that realizemdl requires Simulink
realizemdl(hm)
% Build model of the filter.
Now perform the actual design process with d. Filter hm is an IIR wave
digital filter interpolator. As in the previous example, realizemdl
returns a Simulink model of the filter if you have Simulink installed.
hm = design(d,'iirlinphase','filterstructure',...
'iirwdfinterp');
% Note that realizemdl requires Simulink
realizemdl(hm)
% Build model of the filter.
See Also
4-1142
mfilt.linearinterp
Purpose
Linear interpolator
Syntax
hm = mfilt.linearinterp(l)
Description
The default value for the interpolation factor is 2 when you do not
include the input argument l.
When you use this linear interpolator, the samples added to the input
signal have values between the values of adjacent samples in the
original signal. Thus you see something like a smooth profile where the
interpolated samples continue a line between the previous and next
original samples. The example demonstrates this smooth profile clearly.
Compare this to the interpolation process for mfilt.holdinterp, which
creates a stairstep profile.
Make this filter a fixed-point or single-precision filter by changing the
value of the Arithmetic property for the filter hm as follows:
To change to single-precision filtering, enter
set(hm,'arithmetic','single');
Input Arguments
The following table describes the input argument for
mfilt.linearinterp.
Input
Argument
l
Description
Interpolation factor for the filter. l specifies the
amount to increase the input sampling rate. It must
be an integer. When you do not specify a value for l
it defaults to 2.
4-1143
mfilt.linearinterp
Object
Properties
Values
Description
Arithmetic
Double, single,
fixed
FilterStructure
String
InterpolationFactor Integer
4-1144
PersistentMemory
false or true
States
Double or single
array
mfilt.linearinterp
where hm is a filter.
For further information about the properties of this filter or any mfilt
object, refer to Multirate Filter Properties on page 5-115.
Name
Values
Description
AccumFracLength
AccumWordLength
Arithmetic
4-1145
mfilt.linearinterp
Name
Values
Description
CoeffAutoScale
[true], false
CoeffWordLength
FilterInternals
[FullPrecision],
SpecifyPrecision
InputFracLength
InputWordLength
NumFracLength
4-1146
mfilt.linearinterp
Name
Values
Description
OutputFracLength
OutputWordLength
OverflowMode
saturate, [wrap]
4-1147
mfilt.linearinterp
Name
Values
Description
RoundMode
4-1148
mfilt.linearinterp
Name
Values
Description
Signed
[true], false
States
fi object
4-1149
mfilt.linearinterp
Filter
Structure
Examples
% Interpolation factor
hm = mfilt.linearinterp(l);
fs = 22.05e3;
n = 0:5119;
= sin(2*pi*1e3/fs*n);
y = filter(hm,x);
4-1150
mfilt.linearinterp
stem(n(1:44)/(fs*l),y(2:45),'r')
xlabel('Time (s)');ylabel('Signal Value')
See Also
4-1151
midicallback
Purpose
Syntax
oldfh = midicallback(h,newfh)
oldfh = midicallback(h,[])
fh= midicallback(h)
Description
Input
Arguments
function handle
Output
Arguments
function handle
4-1152
midicallback
Examples
See Also
4-1153
midicontrols
Purpose
Syntax
h
h
h
h
h
Description
=
=
=
=
=
midicontrols
midicontrols(ControlNumbers)
midicontrols(ControlNumbers,InitialValues)
midicontrols( ___ ,'MIDIDevice',devicename)
midicontrols( ___ ,'OutputMode',mode)
the double scalar value of the MIDI control that recently moved after
the object was created. The value is normally in the range [0 1]. See
OutputMode for an alternative. This object can only determine a
controls value if the control is moved after the midicontrols object
is created. If midiread is called before the control is moved, midiread
returns a default initial value of 0.
h = midicontrols(ControlNumbers) returns an object that responds
to the MIDI controls specified by ControlNumbers. Calling midiread
with the object, returns a double array of the same shape as
ControlNumbers. Use midiid to interactively identify the control
number of individual MIDI controls.
h = midicontrols(ControlNumbers,InitialValues) returns an
object that uses the specified InitialValues when controls are not
moved after the object is created. Because initial values are quantized
for the underlying MIDI protocol, sometimes midiread returns an
initial value that is slightly different from InitialValues.
h = midicontrols( ___ ,'MIDIDevice',devicename) specifies the
MIDI device to which the object responds. Use midiid to interactively
identify the name of a specific MIDI device. If you do not specify the
'MIDIDevice' name-value pair, the default MIDI device is used. The
MATLAB preference midi 'DefaultDevice' determines the default
device.
4-1154
midicontrols
name-value pair is optional, and you can insert it only at the end of the
argument list.
Input
Arguments
integer values
character string
4-1155
midicontrols
character string
Example: 'rawmidi'
Data Types
char
Output
Arguments
4-1156
midicontrols
Examples
4-1157
midicontrols
See Also
4-1158
midiid
Purpose
Syntax
Description
Output
Arguments
integer values
character string
Example: 'nanoKontrol'
Data Types
char
Examples
4-1159
midiid
See Also
4-1160
midiread
Purpose
Syntax
v = midiread(h)
Description
it can determine the values of its MIDI controls if they are moved.
Calling midiread before the controls are moved, returns the initial
values specified to midicontrols. In this case, when h is created. (or 0
if no initial values are specified).
Input
Arguments
Output
Arguments
Examples
4-1161
midiread
See Also
4-1162
midisync
Purpose
Syntax
midisync(h)
midisync(h,Values)
Description
Input
Arguments
4-1163
midisync
Data Types
double | single | int8 | int16 | int32 | int64 | uint8 |
uint16 | uint32 | uint64
Examples
See Also
4-1164
minimizecoeffwl
Purpose
Syntax
Hq
Hq
Hq
Hq
Hq
Hq
Description
=
=
=
=
=
=
minimizecoeffwl(Hd)
minimizecoeffwl(Hd,...,'NoiseShaping',NSFlag)
inimizecoeffwl(Hd,...,'NTrials',N)
minimizecoeffwl(Hd,...'Apasstol',Apasstol)
minimizecoeffwl(Hd,...,'Astoptol',Astoptol)
minimizecoeffwl(Hd,...,'MatchrefFilter',RefFiltFlag)
Hq = minimizecoeffwl(Hd,...,'NoiseShaping',NSFlag) enables or
disables the stochastic noise-shaping procedure in the minimization of
the wordlength. By default NSFlag is true. Setting NSFlag to false
minimizes the wordlength without using noise-shaping.
Hq = inimizecoeffwl(Hd,...,'NTrials',N) specifies the number of
Monte Carlo trials to use in the minimization. Hq is the filter with the
minimum wordlength among the N trials that meets the specifications
in Hd. 'NTrials' defaults to one.
Hq = minimizecoeffwl(Hd,...'Apasstol',Apasstol) specifies the
passband ripple tolerance in dB. 'Apasstol' defaults to 1e-4.
Hq = minimizecoeffwl(Hd,...,'Astoptol',Astoptol) specifies the
stopband tolerance in dB. 'Astoptol' defaults to 1e-2.
Hq = minimizecoeffwl(Hd,...,'MatchrefFilter',RefFiltFlag)
determines whether the fixed-point filter matches the filter order and
transition width of the floating-point design. Setting 'MatchRefFilter'
to true returns a fixed-point filter with the same order and transition
width as Hd. The 'MatchRefFilter' property defaults to false and the
4-1165
minimizecoeffwl
Examples
4-1166
minimizecoeffwl
See Also
Tutorials
4-1167
msepred
Purpose
Syntax
[mmse,emse] = msepred(ha,x,d)
[mmse,emse,meanw,mse,tracek] = msepred(ha,x,d)
[mmse,emse,meanw,mse,tracek] = msepred(ha,x,d,m)
Description
4-1168
msepred
Examples
% Initialize variables
ha = fir1(31,0.5);
x = filter(sqrt(0.75),[1 -0.5],sign(randn(size(x))));
n = 0.1*randn(size(x));
d = filter(ha,1,x)+n;
% desired signal
l = 32;
% Filter length
mu = 0.008;
= 5;
ha = adaptfilt.lms(l,mu);
[mmse,emse,meanW,mse,traceK] = msepred(ha,x,d,m);
[simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m);
nn = m:m:size(x,1);
subplot(2,1,1);
plot(nn,meanWsim(:,12),'b',nn,meanW(:,12),'r',nn,...
meanWsim(:,13:15),'b',nn,meanW(:,13:15),'r');
PlotTitle ={'Average Coefficient Trajectories for';...
'W(12), W(13), W(14), and W(15)'};
title(PlotTitle);
legend('Simulation','Theory');
xlabel('Time Index'); ylabel('Coefficient Value');
subplot(2,2,3);
semilogy(nn,simmse,[0 size(x,1)],[(emse+mmse)...
(emse+mmse)],nn,mse,[0 size(x,1)],[mmse mmse]);
title('Mean-Square Error Performance');
axis([0 size(x,1) 0.001 10]);
legend('MSE (Sim.)','Final MSE','MSE','Min. MSE');
4-1169
msepred
Viewing the plots in this figure you see the various error values plotted
in both simulation and theory. Each subplot reveals more information
about the results as the simulation converges with the theoretical
performance.
See Also
4-1170
msesim
Purpose
Syntax
mse = msesim(ha,x,d)
[mse,meanw,w,tracek] = msesim(ha,x,d)
[mse,meanw,w,tracek] = msesim(ha,x,d,m)
Description
error of the adaptive filter at each time instant during adaptation. The
length of mse is equal to size(x,1). The columns of matrix x contain
individual input signal sequences, and the columns of the matrix d
contain corresponding desired response signal sequences.
[mse,meanw,w,tracek] = msesim(ha,x,d) calculates three
defaults to one.
Examples
4-1171
msesim
x = zeros(2000,25); d = x;
% Initialize variables
ha = fir1(31,0.5);
x = filter(sqrt(0.75),[1 -0.5],sign(randn(size(x))));
n = 0.1*randn(size(x));
d = filter(ha,1,x)+n;
% Desired signal
l = 32;
% Filter length
mu = 0.008;
= 5;
Calculating the mean squared error for an adaptive filter is one measure
of the performance of the adapting algorithm. In this figure, you see a
variety of measures of the filter, including the error values.
4-1172
msesim
See Also
filter | msepred
4-1173
multistage
Purpose
Syntax
hd
hd
hd
hd
Description
=
=
=
=
design(d,'multistage')
design(...,'filterstructure',structure)
design(...,'nstages',nstages)
design(...,'usehalfbands',hb)
structure String
firdecim
firtdecim
firinterp
lowpass
algorithm minimizes the cost for the number of stages you specify.
hd = design(...,'usehalfbands',hb) uses halfband filters when you
set hb to true. The default value for hb is false.
4-1174
multistage
Note To see a list of the design methods available for your filter, use
designmethods(hd).
Examples
d = fdesign.interpolator(l,'nyquist',l,'tw,ast',tw,ast);
hm = design(d,'multistage');
fvtool(hm);
4-1175
multistage
d = fdesign.interpolator(m,'lowpass');
% Use halfband filters if possible.
hm = design(d,'multistage','Usehalfbands',true);
fvtool(hm);
See Also
4-1176
design | designopts
noisepsd
Purpose
Syntax
hpsd = noisepsd(H,L)
hpsd = noisepsd(H,L,param1,value1,param2,value2,...)
hpsd = noisepsd(H,L,opts)
noisepsd(H,...)
Description
at the prompt. Plot the PSD data with plot(hpsd). The average power
of the output noise (the integral of the PSD) can be computed with
avgpower, a method of dspdata objects:
avgpwr = avgpower(hpsd).
hpsd = noisepsd(H,L,param1,value1,param2,value2,...) where H
can be either a dfilt object or a filter System object, specifies optional
parameters via propertyname/propertyvalue pairs. Valid psd object
4-1177
noisepsd
Property Name
Default Value
Nfft
512
NormalizedFrequency
true
Fs
normalized
SpectrumType
onesided
4-1178
noisepsd
Property Name
Default Value
CenterDC
false
ARITH
Note If the spectrum data you specify is calculated over half the
Nyquist interval and you do not specify a corresponding frequency
vector, the default frequency vector assumes that the number of points
in the whole FFT was even. Also, the plot option to convert to a whole
or two-sided spectrum assumes the original whole FFT length is even.
System object
If H is a filter System object, noisepsd requires knowledge of the input
data type. Analysis cannot be performed if the input data type is not
available. If you do not specify the Arithmetic parameter, i.e., use the
4-1179
noisepsd
System Object
State
Rule
ARITH = 'double'
Unlocked
noisepsd performs
double-precision
analysis.
Locked
noisepsd performs
double-precision
analysis.
Unlocked
noisepsd performs
single-precision
analysis.
Locked
noisepsd performs
single-precision
analysis.
ARITH = `single'
4-1180
noisepsd
Value
System Object
State
Rule
ARITH = `fixed'
Unlocked
noisepsd produces
an error because the
fixed-point input data
type is unknown.
Locked
4-1181
noisepsd
Examples
4-1182
noisepsd
References
See Also
4-1183
noisepsdopts
Purpose
Syntax
opts = noisepsdopts(H)
Description
contains specified options for computing the output noise PSD. You can
pass opts to the scale method as an input argument to apply scaling
settings to a second-order filter.
noisepsdopts returns the options object, opts, with which you can set
the following properties for noisepsd:
Property Name
Default Value
Nfft
512
NormalizedFrequency
true
Fs
normalized
4-1184
noisepsdopts
Property Name
Default Value
SpectrumType
onesided
CenterDC
false
4-1185
noisepsdopts
Property Name
Default Value
See Also
4-1186
noisepsd
ARITH
norm
Purpose
P-norm of filter
Syntax
l
l
l
l
l
l
Description
All of the variants of norm return the filter p-norm for the object in the
syntax, either an adaptive filter, a digital filter, or a multirate filter.
When you omit the pnorm argument, norm returns the L2-norm for
the object.
=
=
=
=
=
=
norm(ha)
norm(ha,pnorm)
norm(hd)
norm(hd,pnorm)
norm(hm)
norm(hm,pnorm)
4-1187
norm
specify the tolerance for the accuracy in the computation. For l1, l2,
L2, and linf, norm uses the tolerance to truncate the infinite impulse
response that it uses to calculate the norm. For L1, norm passes the
tolerance to the numerical integration algorithm. Refer to Examples
to see this in use. You cannot specify Linf for the norm and include
the tol option.
Examples
Adaptfilt Objects
For the adaptive filter example, compute the 2-norm of an adaptfilt
object, here an LMS-based adaptive filter.
Ha = adaptfilt.lms; % norm(ha) is zero because all coeffs are zero
% Create some data to filter to generate filter coeffs
x = randn(100,1);
d = x + randn(100,1);
[y,e] = filter(Ha,x,d);
L2 = norm(Ha); % Now norm(ha) is nonzero
Dfilt Objects
To demonstrate the tolerance option used with an IIR filter (dfilt
object), compute the 2-norm of filter hd with a tolerance of 1e-10.
H =fdesign.lowpass('n,fc',5,0.4);
Hd = butter(H);
L2=norm(Hd,'l2',1e-10);
4-1188
norm
Mfilt Objects
In this example, compute the infinity norm of an FIR polyphase
interpolator, which is an mfilt object.
Hm = mfilt.firinterp;
Linf = norm(Hm,'linf');
See Also
4-1189
normalize
Purpose
Syntax
normalize(hq)
g = normalize(hd)
Description
always returns the gain returned by the first call to normalize the filter.
Examples
4-1190
normalize
See Also
denormalize
4-1191
normalizefreq
Purpose
Syntax
normalizefreq(d)
normalizefreq(d,flag)
normalizefreq(d,false,fs)
Description
When you do not provide the input argument flag, it defaults to true.
If you set flag to false, affected frequency specifications are multiplied
by fs/2 to remove the normalization. Use this syntax to switch your
4-1192
normalizefreq
Examples
4-1193
normalizefreq
d=fdesign.bandstop(0.25,0.35,0.55,0.65,50,60);
normalizefreq(d,false)
See Also
4-1194
nstates
Purpose
Syntax
n = nstates(hd)
n = nstates(hm)
Description
Discrete-Time Filters
n = nstates(hd) returns the number of states n in the discrete-time
filter hd. The number of states depends on the filter structure and the
coefficients.
Multirate Filters
n = nstates(hm) returns the number of states n in the multirate
filter hm. The number of states depends on the filter structure and the
coefficients.
Examples
Check the number of states for two different filters, one a direct form
FIR filter, the other a multirate filter.
h = firls(30,[0 .1 .2 .5]*2,[1 1 0 0]);
hd = dfilt.dffir(h);
NstateDF = nstates(hd);
hm = mfilt.firsrc(2,3);
NstateMR = nstates(hm);
See Also
mfilt
4-1195
order
Purpose
Syntax
n = order(hq)
n = order(hs)
Description
4-1196
order
Examples
4-1197
parallel
Purpose
Syntax
hmp = parallel(hm1,hm2,...,hmn)
Description
structure. Each filter in the structure is one stage and all stages must
have the same rate change factor.
Access the individual filters in the parallel structure by
See Also
4-1198
dfilt.parallel | mfilt
phasedelay
Purpose
Syntax
[phi,w]=phasedelay(hfilt)
[phi,w]=phasedelay(hfilt,n)
phasedelay(hfilt)
[phi,w] = phasedelay(hs)
[phi,w] = phasedelay(hs,n)
[phi,w] = phasedelay(hs,Name,Value)
phasedelay(hs)
Description
4-1199
phasedelay
Input
Arguments
hfilt
hfilt is either:
4-1200
phasedelay
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
4-1201
phasedelay
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1202
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
phasedelay
System Object
State
Coefficient Data
Type
Rule
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
phi
Algorithms
See Also
4-1203
phasez
Purpose
Syntax
[phi,w]=phasez(hfilt)
[phi,w]=phasez(hfilt,n)
phasez(hfilt)
[phi,w] = phasez(hs)
[phi,w] = phasez(hs,n)
[phi,w] = phasez(hs,Name,Value)
phasez(hs)
Description
4-1204
phasez
phasez(hs) uses FVTool to plot the phase response of the filter System
object hs.
Input
Arguments
hfilt
hfilt is either:
4-1205
phasez
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
4-1206
phasez
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
4-1207
phasez
System Object
State
Coefficient Data
Type
Rule
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
phi
See Also
4-1208
polyphase
Purpose
Syntax
p = polyphase(hm)
polyphase(hm)
p = polyphase(hs)
p = polyphase(hs,Name,Value)
polyphase(hs)
Description
filter hm.
polyphase(hm) launches the Filter Visualization Tool (FVTool) with
all the polyphase subfilters to allow you to analyze each component
subfilter individually.
p = polyphase(hs) returns the polyphase matrix p of the multirate
filter System object hs.
p = polyphase(hs,Name,Value) returns the polyphase matrix p of the
multirate filter System object hs.
polyphase(hs) launches the Filter Visualization Tool (FVTool) with
all the polyphase subfilters to allow you to analyze each component
subfilter individually.
Input
Arguments
hm
4-1209
polyphase
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
Details for Fixed-Point Arithmetic
4-1210
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
polyphase
System Object
State
Coefficient Data
Type
Rule
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
4-1211
polyphase
Output
Arguments
Examples
In this syntax, the matrix p contains all of the subfilters for hm, one
filter per matrix row.
p=polyphase(hm)
p =
Columns 1 through 8
4-1212
-0.0000
0.0002
-0.0006
0.0013
-0.0026
0.0048
-0.0081
0.0133
-0.0001
0.0004
-0.0012
0.0026
-0.0052
0.0094
-0.0160
0.0261
-0.0001
0.0006
-0.0017
0.0038
-0.0074
0.0132
-0.0223
0.0361
-0.0002
0.0008
-0.0020
0.0045
-0.0086
0.0153
-0.0257
0.0415
-0.0002
0.0008
-0.0021
0.0045
-0.0086
0.0151
-0.0252
0.0406
polyphase
-0.0002
0.0007
-0.0018
0.0038
-0.0071
0.0124
-0.0205
0.0330
-0.0001
0.0004
-0.0011
0.0022
-0.0041
0.0072
-0.0118
0.0189
Columns 9 through 16
1.0000
-0.0212
0.0342
-0.0594
0.1365
0.9741
-0.1048
0.0511
-0.0303
-0.0416
0.0673
-0.1189
0.2958
0.8989
-0.1730
0.0878
-0.0527
-0.0576
0.0938
-0.1691
0.4659
0.7814
-0.2038
0.1071
-0.0648
-0.0661
0.1084
-0.2003
0.6326
0.6326
-0.2003
0.1084
-0.0661
-0.0648
0.1071
-0.2038
0.7814
0.4659
-0.1691
0.0938
-0.0576
-0.0527
0.0878
-0.1730
0.8989
0.2958
-0.1189
0.0673
-0.0416
-0.0303
0.0511
-0.1048
0.9741
0.1365
-0.0594
0.0342
-0.0212
Columns 17 through 24
0.0189
-0.0118
0.0072
-0.0041
0.0022
-0.0011
0.0004
-0.0001
0.0330
-0.0205
0.0124
-0.0071
0.0038
-0.0018
0.0007
-0.0002
0.0406
-0.0252
0.0151
-0.0086
0.0045
-0.0021
0.0008
-0.0002
0.0415
-0.0257
0.0153
-0.0086
0.0045
-0.0020
0.0008
-0.0002
0.0361
-0.0223
0.0132
-0.0074
0.0038
-0.0017
0.0006
-0.0001
0.0261
-0.0160
0.0094
-0.0052
0.0026
-0.0012
0.0004
-0.0001
0.0133
-0.0081
0.0048
-0.0026
0.0013
-0.0006
0.0002
-0.0000
In the following figure, FVTool shows the magnitude responses for the
subfilters.
4-1213
polyphase
See Also
4-1214
mfilt
qreport
Purpose
Syntax
rlog = qreport(h)
Description
rlog = qreport(h) returns the logging report stored in the filter object
h in the object rlog. The ability to log features of the filtering operation
is integrated in the fixed-point filter object and the filter method.
Each time you filter a signal with h, new log data overwrites the results
in the filter from the previous filtering operation. To save the log from a
filtering simulation, change the name of the output argument for the
operation before subsequent filtering runs.
Note qreport requires Fixed-Point Designer software and that
filter h is a fixed-point filter. Data logging for fi operations is a
preference you set for each MATLAB session. To learn more about
logging, LoggingMode, and fi object preferences, refer to fipref in the
Fixed-Point Designer documentation.
Also, you cannot use qreport to log the filtering operations from a
fixed-point Farrow filter.
Enable logging during filtering by setting LoggingMode to on for fi
objects for your MATLAB session. Trigger logging by setting the
Arithmetic property for h to fixed, making h a fixed-point filter and
filtering an input signal.
4-1215
qreport
object.
qreport provides a way to instrument your fixed-point filters and
the resulting data log offers insight into how the filter responds to a
particular input data signal.
Examples
4-1216
qreport
do that only once for a MATLAB session, unless you reset the mode
to off during the session.
fipref('loggingmode','on');
hd = design(fdesign.lowpass,'ellip');
hd.arithmetic = 'fixed';
y = filter(hd,rand(100,1));
rlog = qreport(hd)
See Also
dfilt | mfilt
4-1217
realizemdl
Purpose
Syntax
realizemdl(hq)
realizemdl(hq,Name,Value)
Description
block using sum, gain, and delay blocks from Simulink. The properties
and values of hq define the resulting subsystem block parameters.
realizemdl requires Simulink. To accurately realize models of
Input
Arguments
hq
4-1218
realizemdl
Provide the name for the new subsystem block. By default the block
is named Filter.
MapCoeffstoPorts
'off' (default) | 'on'
Specify whether to map the coefficients of the filter to the ports of the
block.
MapStates
4-1219
realizemdl
Specify whether to apply the current filter states to the realized model.
Such specification allows you to save states from a filter object you may
have used or configured in a specific way. The default setting of 'off'
means the states are not transferred to the model. Setting the property
to 'on' preserves the current filter states in the realized model.
OverwriteBlock
'off' (default) | 'on'
4-1220
realizemdl
RateOption
'enforce single rate' (default) | 'allow multirate'
Specify how the block adjusts the rate at the output to accommodate
the reduced number of samples. This parameter applies only when
InputProcessing is 'columns as channels'.
Arithmetic
`double' | 'single' | 'fixed'
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1221
realizemdl
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1222
realizemdl
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Examples
In this case, the filter is an IIR filter with a direct form II second-order
sections structure. Setting MapCoeffstoPorts to 'on' exports the
numerator coefficients, the denominator coefficients, and the gains to
the MATLAB workspace using the default variable names Num, Den, and
g. Each column of Num and Den represents one second-order section. You
can modify the filter coefficients directly in the MATLAB workspace
providing tunability to the realized Simulink model.
4-1223
realizemdl
See Also
4-1224
design | fdesign
rebuffer_delay
Purpose
Syntax
d = rebuffer_delay(f,n,v)
d = rebuffer_delay(f,n,v,'mode')
Description
Input
Arguments
The tasking mode of the model. Specify one of the following options:
'singletasking'
'multitasking'
4-1225
rebuffer_delay
Default: 'multitasking'
Definitions
Multitasking
When you run a model in MultiTasking mode, Simulink processes
groups of blocks with the same execution priority through each stage of
simulation based on task priority. Multitasking mode helps to create
valid models of real-world multitasking systems, where sections of your
model represent concurrent tasks. The Tasking mode for periodic
sample times parameter on the Solver pane of the Configuration
Parameters dialog box controls this setting.
Singletasking
When you run a model in SingleTasking mode, Simulink processes
all blocks through each stage of simulation together. The Tasking
mode for periodic sample times parameter on the Solver pane of the
Configuration Parameters dialog box controls this setting.
Examples
command line.
2 Double-click the Buffer block to open the block mask. Verify that
4-1226
rebuffer_delay
3 To determine the frame size of the input signal to the Buffer block,
open the Signal From Workspace block mask. Verify that you have
the following settings:
Signal = sp_examples_src
Sample time = 1
Samples per frame = 4
Because Samples per frame = 4, you know the f input to the
rebuffer_delay function is 4.
4 After you verify the values of all the inputs to the rebuffer_delay
function, determine the delay that the Buffer block introduces in this
multitasking model. To do so, type the following at the MATLAB
command line:
d = rebuffer_delay(4,3,1)
d =
8
4-1227
rebuffer_delay
See Also
Buffer | Unbuffer
How To
4-1228
reffilter
Purpose
Syntax
href = reffilter(hd)
Description
href = reffilter(hd) returns a new filter href that has the same
structure as hd, but uses the reference coefficients and has its arithmetic
property set to double. Note that hd can be either a fixed-point filter
(arithmetic property set to fixed, or a single-precision floating-point
filter whose arithmetic property is single).
reffilter(hd) differs from double(hd) in that
Examples
h1.arithmetic = 'fixed';
h2.arithmetic = 'fixed';
h.CoeffWordLength
= 16;
h1.CoeffWordLength = 12;
h2.CoeffWordLength =
% arithmetic.
% coefficients.
% coefficients.
8;
% coefficients.
href = reffilter(h);
hfvt = fvtool(href,h,h1,h2);
4-1229
reffilter
The following plot, taken from FVTool, shows href, the reference filter,
and the effects of using three different word lengths to represent the
coefficients.
See Also
4-1230
double
reorder
Purpose
Syntax
reorder(hd,order)
reorder(hd,numorder,denorder)
reorder(hd,numorder,denorder,svorder)
reorder(hd,filter_type)
reorder(hd,dir_flag)
reorder(hd,dir_flag,sv)
reorder(hs,...)
reorder(hs,...,Name,Value)
Description
specified filter type. This reordering mode can be especially helpful for
fixed-point implementations where the order of the filter sections can
significantly affect your filter performance.
reorder(hd,dir_flag) specifies rearranges the sections according to
4-1231
reorder
Input
Arguments
hd
Vector of indices used to reorder the filter sections. order does not need
to contain all of the indices of the filter. Omitting one or more filter
section indices removes the omitted sections from the filter. You can use
a logical array to remove sections from the filter, but not to reorder it.
numorder
Filter type. The 'auto' option and automatic ordering only apply to
filters that you used fdesign to create. With the 'auto' option as an
input argument, reorder automatically rearranges the filter sections
depending on the specification response type of the design.
4-1232
reorder
dir_flag
'down' | 'up'
Pole direction flag. When dir_flag is 'up', the first filter section
contains the poles closest to the origin, and the last section contains the
poles closest to the unit circle. When ir_flag is 'down', the sections
are ordered in the opposite direction. reorder always pairs zeros with
the poles closest to them.
sv
'poles' | 'zeros'
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1233
reorder
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1234
reorder
Examples
For another example of using reorder, create an SOS filter in the direct
form II implementation.
[z,p,k] = butter(15,.5);
[sos, g] = zp2sos(z,p,k);
hd = dfilt.df2sos(sos,g);
reorder(hd, [1 3:7 2 8]);
hfvt = fvtool(hd, 'analysis', 'coefficients');
Move the first filter to the end, and remove the eighth section
4-1235
reorder
hd2 = copy(hd);
reorder(hd2, [2:7 1]);
setfilter(hfvt, hd2);
References
See Also
4-1236
reset
Purpose
Syntax
reset(ha)
reset(hd)
reset(hm)
Description
reset(ha) resets all the properties of the adaptive filter ha that are
updated when filtering to the value specified at construction. If you
do not specify a value for any particular property when you construct
an adaptive filter, the property value for that property is reset to the
default value for the property.
reset(hd) resets all the properties of the discrete-time filter hd to their
factory values that are modified when you run the filter. In particular,
the States property is reset to zero.
reset(hm) resets all the properties of the multirate filter hm to their
factory value that are modified when the filter is run. In particular, the
States property is reset to zero when hm is a decimator. Additionally,
the filter internal properties are also reset to their factory values.
Examples
Denoise a sinusoid and reset the filter after filtering with it.
h = adaptfilt.lms(5,.05,1,[0.5,0.5,0.5,0.5,0.5]);
n = filter(1,[1 1/2 1/3],.2*randn(1,2000));
d = sin((0:1999)*2*pi*0.005) + n; % Noisy sinusoid
x = n;
[y,e]= filter(h,x,d);
% e has denoised signal
disp(h)
reset(h); % Reset the coefficients and states.
disp(h)
See Also
set
4-1237
scale
Purpose
Syntax
scale(hd)
scale(hd,pnorm)
scale(hd,pnorm,Name,Value)
scale(hd,pnorm,opts)
scale(hs)
Description
arithmetic mode.
scale(hd,pnorm) specifies the norm used to scale the filter.
scale(hd,pnorm,Name,Value) scales the SOS filter with additional
options specified by one or more Name,Value pair arguments.
scale(hd,pnorm,opts) uses an input scale options object opts
Input
Arguments
hd
4-1238
scale
pnorm
Scale options object. You can create the opts object using the scaleopts
function.
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1239
scale
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1240
scale
Sets the way the filter handles arithmetic overflow situations during
scaling. If your device does not have guard bits available, and you
are using saturation arithmetic for filtering, use 'satall' instead of
'saturate'. The default is `wrap'.
4-1241
scale
ScaleValueConstraint
Specify whether to constrain the filter scale values, and how to constrain
them. Choosing 'unit' for the constraint disables the MaxScaleValue
property setting. 'po2' constrains the scale values to be powers of 2,
while 'none' removes any constraint on the scale values. `unit' is
the default value.
sosReorder
Examples
References
See Also
4-1242
scalecheck
Purpose
Syntax
s = scalecheck(hd,pnorm)
s = scalecheck(hs,pnorm)
s = scalecheck(hs,pnorm,Name,Value)
Description
Input
Arguments
hd
4-1243
scalecheck
value. Name must appear inside single quotes (' '). You can
specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Arithmetic
`double' | 'single' | 'fixed'
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1244
scalecheck
System Object
State
Coefficient Data
Type
Rule
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic, the function uses
double-precision arithmetic if the filter System object is in an unlocked
state. If the System object is locked, the function performs analysis
based on the locked input data type.
Output
Arguments
Filter scaling for a given p-norm. An optimally scaled filter has partial
norms equal to one. In such cases, s contains all ones.
For direct-form I (dfilt.df1sos) and direct-form II transposed
(dfilt.df2tsos) filters, the function returns the p-norm of the filter
computed from the filter input to the output of each second-order
section. Therefore, the number of elements in s is one less than the
number of sections in the filter. This p-norm computation does not
include the trailing scale value of the filter, which you can find by
entering hd.scalevalue(end) at the MATLAB prompt.
4-1245
scalecheck
Examples
In another form:
[b,a]=ellip(10,.5,20,0.5);
[s,g]=tf2sos(b,a);
hd=dfilt.df1sos(s,g)
hd =
FilterStructure: 'Direct-Form I, Second-Order Sections'
Arithmetic: 'double'
sosMatrix: [5x6 double]
ScaleValues: [6x1 double]
4-1246
scalecheck
PersistentMemory: false
States: [1x1 filtstates.dfiir]
1x1 struct array with no fields.
scalecheck(hd,'Linf')
ans =
0.7631
See Also
0.9627
0.9952
0.9994
1.0000
4-1247
scaleopts
Purpose
Syntax
opts = scaleopts(hd)
opts = scaleopts(hs)
opts = scaleopts(hs,Name,Value)
Description
Input
Arguments
hd
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
4-1248
scaleopts
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
4-1249
scaleopts
System Object
State
Coefficient Data
Type
Rule
based on this
assumption.
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic, the function uses
double-precision arithmetic if the filter System object is in an unlocked
state. If the System object is locked, the function performs analysis
based on the locked input data type.
Output
Arguments
opts
Parameter
Default
MaxNumerator
MaxScaleValue
No default value
to a numerical value
automatically changes the
ScaleValueConstraint
setting to none.
4-1250
scaleopts
Examples
Parameter
Default
NumeratorConstraint
none
Specifies whether
and how to constrain
numerator coefficient
values. Options are none,
normalize, po2, and
unit.
OverflowMode
wrap
ScaleValueConstraint unit
Specify whether to
constrain the filter
scale values, and how
to constrain them. Valid
options are none, po2, and
unit.
From a filter hd, you can create an options scaling object that contains
the scaling options settings you require.
[b,a]=ellip(10,.5,20,0.5);
[s,g]=tf2sos(b,a);
hd=dfilt.df1sos(s,g)
opts=scaleopts(hd)
opts =
MaxNumerator:
NumeratorConstraint:
OverflowMode:
ScaleValueConstraint:
2
'none'
'wrap'
'unit'
4-1251
scaleopts
See Also
4-1252
set2int
Purpose
Syntax
set2int(h)
set2int(h,coeffwl)
set2int(...,inwl)
g = set2int(...)
Description
power of 2.
Note set2int does not work with CIC decimators or interpolators
because they do not have coefficients.
Examples
4-1253
set2int
Note that yint and yfrac are fi objects. Later in this example, you
use the fi object properties WordLength and FractionLength to work
with the output data.
Now use the gain g to rescale the output from the integer mode filter
operation. Verify that the scaled integer output is equal to the fractional
output.
yints = double(yint)/g;
MaxDiff=max(abs(yints-double(yfrac)));
Verify that the scaled integer output is equal to the fractional output.
max(abs(yints-double(yfrac)))
In part two, the example reinterprets the output binary data, putting
the input and the output on the same scale by weighting the most
significant bits in the input and output data equally.
WL = yint.WordLength;
FL = yint.Fractionlength + log2(g);
4-1254
set2int
yints2 = fi(zeros(size(yint)),true,WL,FL);
yints2.bin = yint.bin;
MaxDiff=max(abs(double(yints2)-double(yfrac)));
Note that yint and yfrac are fi objects. In part 2 of this example,
you use the fi object properties WordLength and FractionLength to
work with the output data.
Now use the gain g to rescale the output from the integer mode filter
operation.
yints = double(yint)/g;
Verify that the scaled integer output is equal to the fractional output.
max(abs(yints-double(yfrac)))
4-1255
set2int
yints2 = fi(zeros(size(yint)),true,wl,fl);
yints2.bin = yint.bin;
max(abs(double(yints2)-double(yfrac)))
See Also
4-1256
mfilt
setspecs
Purpose
Syntax
setspecs(D,specvalue1,specvalue2,...)
setspecs(D,Specification,specvalue1,specvalue2,...)
setspecs(...Fs)
setspecs(...,MAGUNITS)
Description
Examples
Construct a lowpass filter with specifications for the filter order and
cutoff frequency (-6 dB). Use setspecs after construction to set the
values of the filter order and cutoff frequency. Display the values in
the MATLAB command window.
D = fdesign.lowpass('N,Fc');
setspecs(D,10,0.2);
D.FilterOrder
D.Fcutoff
4-1257
setspecs
See Also
4-1258
sos
Purpose
Syntax
Hq2 = sos(Hq)
Hq2 = sos(Hq, order)
Hq2 = sos(Hq, order, scale)
Description
4-1259
sos
Examples
[b,a]=butter(8,.5);
Hq = dfilt.df2t(b,a);
Hq.arithmetic = 'fixed';
Hq1 = sos(Hq)
Hq1 =
See Also
4-1260
specifyall
Purpose
Syntax
specifyall(hd)
specifyall(hd,false)
specifyall(hd,true)
specifyall(hs)
specifyall(hs,false)
Description
Property Name
Default
Setting After
Applying specifyall
CoeffAutoScale
true
false
OutputMode
AvoidOverflow
SpecifyPrecision
ProductMode
FullPrecision
SpecifyPrecision
AccumMode
KeepMSB
SpecifyPrecision
RoundMode
convergent
convergent
OverflowMode
wrap
wrap
you must supply the property values for the mode- and scaling related
properties.
specifyall provides an alternative to changing all these properties
individually. Using specifyall changes all of the settings. To set some
but not all of the modes, set each property as you require.
specifyall(hd,false) performs the opposite operation of
specifyall(hd) by setting all of the autoscale options to true; all
4-1261
specifyall
of the modes to their default values; and hiding the fraction length
properties in the display, meaning you cannot access them to set them
or view them.
specifyall(hd,true) is equivalent to specifyall(hd).
specifyall(hs) sets all the data type fixed-point properties of the
filter System object hs to 'Custom' so that you can easily specify all
the fixed-point settings. If the object has a FullPrecisionOverride
property, its value is set to false. specifyall is intended as a shortcut
to changing all the fixed-point properties one by one.
specifyall(hs,false) sets all fixed-point properties of the filter
System object hs to their default values and sets the filter to
full-precision mode, if possible.
Examples
See Also
4-1262
double | reffilter
stepz
Purpose
Syntax
[h,t] = stepz(hfilt)
[h,t] = stepz(hfilt,n)
[h,t] = stepz(hfilt,n,fs)
[h,t] = stepz(hfilt,[],fs)
stepz(hfilt)
[h,t] = stepz(hs)
[h,t] = stepz(hs,Name,Value)
stepz(hs)
Description
stepz returns the step response based on the current filter coefficients.
This section describes common stepz operation with adaptive filters,
discrete-time filters, multirate filters, and filter System objects. For
more input options, refer to stepz in Signal Processing Toolbox
documentation.
[h,t] = stepz(hfilt) returns the impulse response h and the
corresponding time points w at which the step response of hfilt
is computed. The step response is evaluated at 10 1-second
intervals(0:9)'.
[h,t] = stepz(hfilt,n) returns the step response evaluated at
floor(n) 1-second intervals(0:floor(n)-1)'.
[h,t] = stepz(hfilt,n,fs) returns the step response evaluated at
floor(n) 1/fs-second intervals(0:floor(n)-1)'/fs.
[h,t] = stepz(hfilt,[],fs) returns the step response evaluated at
10 1/fs-second intervals(0:9)'/fs.
stepz(hfilt) uses FVTool to plot the step response of the filter. You
can also provide the optional input arguments n and fs with this syntax.
[h,t] = stepz(hs) returns the step response for the filter System
4-1263
stepz
object hs.
Note stepz works for both real and complex filters. When you omit the
output arguments, stepz plots only the real part of the step response.
Input
Arguments
hfilt
hfilt is either:
4-1264
stepz
Number of samples.
Default: 10
fs
Sampling frequency.
Default: 1
4-1265
stepz
value. Name must appear inside single quotes (' '). You can
specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Arithmetic
`double' | 'single' | 'fixed'
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
Details for Fixed-Point Arithmetic
System Object
State
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1266
stepz
System Object
State
Coefficient Data
Type
Rule
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
4-1267
stepz
See Also
4-1268
freqz | impz
sysobj
Purpose
Syntax
hs = sysobj(hfilt)
Description
Lattice AR(dfilt.latticear)
dsp.AllpoleFilter
Coupled-allpass,
power-complementary lattice
filter (dfilt.calatticepc)
dsp.CoupledAllpassFilter
dsp.CoupledAllpassFilter
dsp.CoupledAllpassFilter
dsp.IIRFilter
dsp.IIRFilter
dsp.IIRFilter
dsp.IIRFilter
dsp.FIRFilter
dsp.FIRFilter
dsp.FIRFilter
4-1269
sysobj
4-1270
dsp.FIRFilter
Discrete-time, lattice,
moving-average
(dfilt.latticemamin)
dsp.FIRFilter
Discrete-time, second-order
section, direct-form I
(dfilt.df1sos)
dsp.BiquadFilter
Discrete-time, second-order
section, direct-form I transposed
(dfilt.df1tsos)
dsp.BiquadFilter
Discrete-time, second-order
section, direct-form II
(dfilt.df2sos)
dsp.BiquadFilter
Discrete-time, second-order
section, direct-form II transposed
(dfilt.df2tsos)
dsp.BiquadFilter
dsp.FIRDecimator
Direct-form transposed
FIR polyphase decimator
(mfilt.firtdecim)
dsp.FIRDecimator
dsp.CICDecimator
dsp.FIRInterpolator
dsp.FIRInterpolator
sysobj
Input
Arguments
dsp.CICInterpolator
dsp.FIRRateConverter
hfilt
Output
Arguments
hs
Filter System object. The function maps almost all properties of hfilt
into the filter System object. However, some properties are not mapped
exactly:
4-1271
sysobj
Examples
See Also
4-1272
block
tf2ca
Purpose
Syntax
[d1,d2] = tf2ca(b,a)
[d1,d2] = tf2ca(b,a)
[d1,d2,beta] = tf2ca(b,a)
Description
H ( z)
B( z) 1
[ H1( z) H 2( z)]
A( z) 2
H ( z) =
B( z) 1
= [ H1( z) H 2( z)]
A( z) 2
In some cases, the decomposition is not possible with real H1(z) and
H2(z). In those cases a generalized coupled allpass decomposition may
be possible, whose syntax is
[d1,d2,beta] = tf2ca(b,a)
4-1273
tf2ca
H ( z) =
B( z) 1
H1( z) + H 2( z)
=
A( z) 2
H1( z) =
where D1(z) and D2(z) are polynomials whose coefficients are given by
d1 and d2.
Note A coupled allpass decomposition is not always possible.
Nevertheless, Butterworth, Chebyshev, and Elliptic IIR filters, among
others, can be factored in this manner. For details, refer to Signal
Processing Toolbox Users Guide.
Examples
[b,a]=cheby1(9,.5,.4);
[d1,d2]=tf2ca(b,a);
num = 0.5*conv(fliplr(d1),d2)+0.5*conv(fliplr(d2),d1);
den = conv(d1,d2);
See Also
4-1274
tf2cl
Purpose
Syntax
[k1,k2] = tf2cl(b,a)
[k1,k2] = tf2cl(b,a)
[k1,k2,beta] = tf2cl(b,a)
Description
H ( z)
B( z) 1
[ H1( z) H 2( z)]
A( z) 2
of a stable IIR filter H(z) and convert the allpass transfer functions
H1(z) and H2(z) to a coupled lattice allpass structure with coefficients
given in vectors k1 and k2.
[k1,k2] = tf2cl(b,a) where b is a real, antisymmetric vector of
numerator coefficients and a is a real vector of denominator coefficients,
corresponding to a stable digital filter, performs the coupled allpass
decomposition
H ( z) =
B( z) 1
= [ H1( z) H 2( z)]
A( z) 2
of a stable IIR filter H(z) and converts the allpass transfer functions
H1(z) and H2(z) to a coupled lattice allpass structure with coefficients
given in vectors k1 and k2.
In some cases, the decomposition is not possible with real H1(z) and
H2(z). In those cases, a generalized coupled allpass decomposition may
be possible, using the command syntax
[k1,k2,beta] = tf2cl(b,a)
4-1275
tf2cl
H ( z) =
B( z) 1
= H1( z) + H 2( z)
A( z) 2
Examples
[b,a]=cheby1(9,.5,.4);
[k1,k2]=tf2cl(b,a); % Get the reflection coeffs. for the lattices.
[num1,den1]=latc2tf(k1,'allpass'); % Convert each allpass lattice
[num2,den2]=latc2tf(k2,'allpass'); % back to transfer function.
num = 0.5*conv(num1,den2)+0.5*conv(num2,den1);
den = conv(den1,den2); % Reconstruct numerator and denonimator.
MaxDiff=max([max(b-num),max(a-den)]); % Compare original and reconstructed
% numerator and denominators.
See Also
4-1276
validstructures
Purpose
Syntax
filtstruct = validstructures(D)
C = validstructures(D,METHOD)
Cs = validstructures(D,...,'SystemObject',sysobjflag)
Description
containing all valid filter structures for the filter specification object,
D, organized by design method. Each design method is a field in the
structure array, filtstruct. The fields contain a cell array of strings.
C = validstructures(D,METHOD) returns the valid structures for the
filter specification object, D, and the design method, METHOD, in a cell
array of strings.
Cs = validstructures(D,...,'SystemObject',sysobjflag)
returns the valid structures for designing a filter System object when
sysobjflag is true. To use System objects, you must have the DSP
System Toolbox product installed. When sysobjflag is false, the
function returns valid structures for designing dfilt and mfilt objects,
as described previously. Design methods and design options for filter
System objects are not necessarily the same as those for dfilt and
mfilt objects.
Examples
4-1277
validstructures
D = fdesign.highpass('N,F3dB',50,0.2);
C = validstructures(D,'butter');
See Also
4-1278
wdf2allpass
Purpose
Syntax
a = wdf2allpass(w)
A = wdf2allpass(W)
Description
Input
Arguments
4-1279
wdf2allpass
Output
Arguments
Data Types
double | single
A - allpass filter coefficients
Examples
4-1280
wdf2allpass
Algorithms
for order 1:
a1 w1
for order 2 :
a1 w2 (1 w1 )
a2 w1
for order 4 :
a2 w3 (1 w1 )
a4 w1
a1 a3 0
4-1281
wdf2allpass
References
[1] M. Lutovac, D. Tosic, B. Evans, Filter Design for Signal Processing
using MATLAB and Mathematica. Prentice Hall, 2001.
See Also
4-1282
window
Purpose
Syntax
h = window(d,fcnhndl,fcnarg)
h = window(d,win)
description
Examples
Example 1
Use a function handle and optional input arguments to design a
multirate filter. We use a function handle to hamming to provide the
window. Since this example creates a decimator filter specifications
object, window returns a multirate filter.
d = fdesign.decimator(4,'lowpass','N,Fc',30,1000,10000);
% Lowpass decimator with a 6-dB down frequency of 1 kHz
% Order equal to 30 and sampling frequency 10 kHz
Hd =window(d,'window',@hamming);
fvtool(Hd)
4-1283
window
Example 2
Use a window vector provided by the kaiser window function to design
a Nyquist filter. The window length must be the filter order plus one. .
d = fdesign.nyquist(5,'n',150);
% Kaiser window with beta parameter 2.5
Hd = window(d,'window',kaiser(151,2.5));
fvtool(Hd)
4-1284
window
See Also
firls | kaiserwin
4-1285
zerophase
Purpose
Syntax
[hr,w] = zerophase(hfilt)
[hr,w] = zerophase(hfilt,n)
zerophase(hfilt)
[hr,w] = zerophase(hs)
[hr,w] = zerophase(hs,n)
[hr,w] = zerophase(hs,Name,Value)
zerophase(hs)
Description
points equally spaced around the upper half of the unit circle.
zerophase(hfilt) displays the zero-phase response of ha in the Filter
Visualization Tool (FVTool).
[hr,w] = zerophase(hs) returns a zero-phase response for the filter
4-1286
zerophase
Input
Arguments
hfilt
hfilt is either:
4-1287
zerophase
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1288
zerophase
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1289
zerophase
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
hr
See Also
4-1290
zpkbpc2bpc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkbpc2bpc(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkbpc2bpc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1291
zpkbpc2bpc
[b, a] = iirlp2bpc(b,a,0.5,[0.25,0.75]);
z = roots(b);
p = roots(a);
k = b(1);
[z2,p2,k2] = zpkbpc2bpc(z,p,k,[0.25, 0.75],[-0.75, -0.25]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
50
Magnitude (dB)
100
150
200
250
300
Prototype Filter
Target Filter with Complex Passband
350
1
4-1292
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
zpkbpc2bpc
Arguments
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
See Also
4-1293
zpkftransf
Purpose
Syntax
[Z2,P2,K2] = zpkftransf(Z,P,K,AllpassNum,AllpassDen)
Description
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
After transforming the filter, you get the response shown in the figure,
where the passband has been shifted towards zero.
4-1294
zpkftransf
20
30
Magnitude (dB)
40
50
60
70
80
90
100
Arguments
See Also
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
FTFNum
FTFDen
Z2
P2
K2
iirftransf
4-1295
zpklp2bp
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bp(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bp(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1296
zpklp2bp
[B,A] = ellip(3,0.1,30,0.409);
Z = roots(B);
P = roots(A);
K = B(1);
[Z2,P2,K2] = zpklp2bp(Z,P,K, 0.5, [0.2 0.3]);
hfvt = fvtool(B,A,K2*poly(Z2),poly(P2));
legend(hfvt,'Prototype Lowpass Filter', 'Bandpass Filter');
axis([0 1 -70 10]);
Arguments
Variable
Description
4-1297
zpklp2bp
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
References
See Also
4-1298
zpklp2bpc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bpc(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bpc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1299
zpklp2bpc
[b, a] = ellip(3,0.1,30,0.409);
z = roots(b);
p = roots(a);
k = b(1);
[z2,p2,k2] = zpklp2bpc(z, p, k, 0.5, [0.2 0.3]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Arguments
See Also
4-1300
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
zpklp2bs
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bs(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bs(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1301
zpklp2bs
k = b(1);
[z2,p2,k2] = zpklp2bs(z, p, k, 0.5, [0.2 0.3]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Arguments
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
References
4-1302
zpklp2bs
See Also
4-1303
zpklp2bsc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bsc(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2bsc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1304
zpklp2bsc
z = roots(b);
p = roots(a);
k = b(1);
[z2,p2,k2] = zpklp2bsc(z, p, k, 0.5, [0.2, 0.3]);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Arguments
See Also
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
4-1305
zpklp2hp
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2hp(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2hp(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1306
zpklp2hp
k = b(1);
[z2,p2,k2] = zpklp2hp(z, p, k, 0.5, 0.25);
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Arguments
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
References
4-1307
zpklp2hp
See Also
4-1308
zpklp2lp
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2lp(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2lp(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
4-1309
zpklp2lp
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Using zpklp2lp creates the desired half band IIR filter with the
transformed features that you specify in the transformation function.
This figure shows the results.
Magnitude Response (dB)
0
Prototype Filter (b,a)
Target Filter Transformed (z,p,k)
10
20
30
Magnitude (dB)
40
50
60
70
80
90
100
Arguments
4-1310
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
Variable
Description
0.9
zpklp2lp
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
References
See Also
4-1311
zpklp2mb
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2mb(Z,P,K,Wo,Wt)
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2mb(Z,P,K,Wo,Wt,Pass)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2mb(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
transformed from the real lowpass prototype by applying an Mth-order
the "Nyquist Mobility". In the first case the Nyquist feature stays at its
original location and the DC feature is free to move. In the second
case the DC feature is kept at an original frequency and the Nyquist
feature is allowed to move.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen, of the allpass mapping filter. The prototype lowpass filter
is given with zeros, Z, poles, P, and gain factor, K.
This transformation effectively places one feature of an original filter,
located at frequency Wo, at the required target frequency locations,
Wt1,...,WtM.
Relative positions of other features of an original filter do not change in
the target filter. This means that it is possible to select two features of
an original filter, F1 and F2, with F1 preceding F2. Feature F1 will still
precede F2 after the transformation. However, the distance between F1
and F2 will not be the same before and after the transformation.
Choice of the feature subject to this transformation is not restricted
to the cutoff frequency of an original lowpass filter. In general it is
possible to select any feature; e.g., the stopband edge, the DC, the deep
minimum in the stopband, or other ones.
This transformation can also be used for transforming other types of
filters; e.g., notch filters or resonators can be easily replicated at a
4-1312
zpklp2mb
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k1*poly(z1), poly(p1), k2*poly(z2), poly(p2));
4-1313
zpklp2mb
50
Magnitude (dB)
100
150
200
250
300
350
Arguments
4-1314
0.1
0.2
0.3
0.4
0.5
0.6
Normalized Frequency ( rad/sample)
0.7
0.8
0.9
Variable
Description
Wo
Wt
Pass
Z2
zpklp2mb
Variable
Description
P2
K2
References
See Also
4-1315
zpklp2mbc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklpmbc(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklpmbc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
transformed from the real lowpass prototype by applying an Mth-order
Examples
4-1316
a] = ellip(3,0.1,30,0.409);
roots(b);
roots(a);
b(1);
zpklp2mbc
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k1*poly(z1), poly(p1), k2*poly(z2), poly(p2));
You could review the coefficients to compare the filters, but the
graphical comparison shown here is quicker and easier.
Magnitude Response (dB)
0
50
Magnitude (dB)
100
150
200
250
300
350
1
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
4-1317
zpklp2mbc
Arguments
See Also
4-1318
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
zpklp2xc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2xc(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2xc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
transformed from the real lowpass prototype by applying an Nth-order
4-1319
zpklp2xc
Examples
Verify the result by comparing the prototype filter with the target filter:
fvtool(b, a, k2*poly(z2), poly(p2));
Plotting the filters on the same axes lets you compare the results
graphically, shown here.
Magnitude Response (dB)
0
50
Magnitude (dB)
100
150
200
250
300
350
1
4-1320
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
zpklp2xc
Arguments
See Also
Variable
Description
Wo
Wt
Z2
P2
K2
AllpassNum
AllpassDen
4-1321
zpklp2xn
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2xn(Z,P,K,Wo,Wt)
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2xn(Z,P,K,Wo,Wt,Pass)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpklp2xn(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
transformed from the real lowpass prototype by applying an Nth-order
real lowpass to real multipoint frequency transformation, where N is the
the "Nyquist Mobility". In the first case the Nyquist feature stays at its
original location and the DC feature is free to move. In the second
case the DC feature is kept at an original frequency and the Nyquist
feature is allowed to move.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen, of the allpass mapping filter. The prototype lowpass filter
is given with zeros, Z, poles, P, and gain factor, K.
Parameter N also specifies the number of replicas of the prototype
filter created around the unit circle after the transformation. This
transformation effectively places N features of an original filter, located
at frequencies Wo1,...,WoN, at the required target frequency locations,
Wt1,...,WtM.
Relative positions of other features of an original filter are the same
in the target filter for the Nyquist mobility and are reversed for the
DC mobility. For the Nyquist mobility this means that it is possible to
select two features of an original filter, F1 and F2, with F1 preceding F2.
Feature F1 will still precede F2 after the transformation. However,
the distance between F1 and F2 will not be the same before and after
the transformation. For DC mobility feature F2 will precede F1 after
the transformation.
4-1322
zpklp2xn
Examples
As demonstrated by the figure, the target filter has the desired response
shape and values replicated from the prototype.
Arguments
Variable
Description
Wo
4-1323
zpklp2xn
Variable
Description
Wt
Pass
Z2
P2
K2
AllpassDen
AllpassDen
References
See Also
4-1324
zpkrateup
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkrateup(Z,P,K,N)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkrateup(Z,P,K,N)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
being transformed from any prototype by applying an Nth-order
rateup frequency transformation, where N is the upsample ratio.
Transformation creates N equal replicas of the prototype filter frequency
response.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen, of the allpass mapping filter. The original lowpass filter is
given with zeros, Z, poles, P, and gain factor, K.
Relative positions of other features of an original filter do not change in
the target filter. This means that it is possible to select two features of
an original filter, F1 and F2, with F1 preceding F2. Feature F1 will still
precede F2 after the transformation. However, the distance between F1
and F2 will not be the same before and after the transformation.
Examples
Arguments
Variable
Description
4-1325
zpkrateup
Variable
Description
Z2
P2
K2
AllpassNum
AllpassDen
See Also
4-1326
zpkshift
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkshift(Z,P,K,Wo,Wt)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkshift(Z,P,K,Wo,Wt)
returns the zeros,Z2 , poles, P2, and gain factor, K2, of the target filter
transformed from the zeros, poles, and gain factor of real lowpass
prototype by applying a second-order real shift frequency mapping.
It also returns the numerator, AllpassNum, and the denominator,
AllpassDen of the allpass mapping filter.
This transformation places one selected feature of an original filter,
located at frequency Wo, at the required target frequency location, Wt.
This transformation implements the "DC Mobility," which means that
the Nyquist feature stays at Nyquist, but the DC feature moves to a
location dependent on the selection of Wo and Wt.
Relative positions of other features of an original filter do not change in
the target filter. This means that it is possible to select two features of
an original filter, F1 and F2, with F1 preceding F2. Feature F1 will still
precede F2 after the transformation. However, the distance between F1
and F2 will not be the same before and after the transformation.
Choice of the feature subject to the real shift transformation is not
restricted to the cutoff frequency of an original lowpass filter. In general
it is possible to select any feature; e.g., the stopband edge, the DC, the
deep minimum in the stopband, or other ones.
This transformation can also be used for transforming other types of
filters; e.g., notch filters or resonators can change their position in a
simple way without the need to design them again.
Examples
4-1327
zpkshift
See Also
4-1328
zpkshiftc
Purpose
Syntax
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkshiftc(Z,P,K,Wo,Wt)
[Num,Den,AllpassNum,AllpassDen] = zpkshiftc(Z,P,K,0,0.5)
[Num,Den,AllpassNum,AllpassDen] = zpkshiftc(Z,P,K,0,-0.5)
Description
[Z2,P2,K2,AllpassNum,AllpassDen] = zpkshiftc(Z,P,K,Wo,Wt)
returns zeros, Z2, poles, P2, and gain factor, K2, of the target filter
Examples
a] = ellip(3,0.1,30,0.409);
roots(b);
roots(a);
b(1);
Rotation by
/4 Radians/Sample
Rotation by -0.25:
[z2,p2,k2] = zpkshiftc(z, p, k, 0.5, 0.25);
4-1329
zpkshiftc
hfvt = fvtool(b,a,k2*poly(z2),poly(p2));
Rotation by
/2 Radians/Sample
Rotation by /2 Radians/Sample
[z2,p2,k2] = zpkshiftc(z, p, k, 0.5, -0.5);
fvtool(b, a, k2*poly(z2), poly(p2));
Result of Example 1
After performing the rotation, the resulting filter shows the features
desired.
Magnitude Response (dB)
0
50
Magnitude (dB)
100
150
200
250
Prototype Filter
Target Filter After Rotation by 0.25
300
350
1
4-1330
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
zpkshiftc
Result of Example 2
Similar to the first example, performing the Hilbert transformation
generates the desired target filter, shown here.
Magnitude Response (dB)
0
50
Magnitude (dB)
100
150
200
250
Prototype Filter
Target Filter After HIlbert Transformation
300
350
1
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
4-1331
zpkshiftc
Result of Example 3
Finally, using the inverse Hilbert transformation creates yet a third
filter, as the figure shows.
Magnitude Response (dB)
0
50
Magnitude (dB)
100
150
200
250
Prototype Filter
Filter Resulting From Inverse Hilbert Transformation
300
350
1
Arguments
4-1332
0.8
0.6
0.4
0.2
0
0.2
Normalized Frequency ( rad/sample)
0.4
0.6
0.8
Variable
Description
Wo
zpkshiftc
Variable
Description
Wt
Z2
P2
K2
AllpassDen
AllpassDen
References
See Also
4-1333
zplane
Purpose
Syntax
zplane(Hq)
zplane(Hq,plotoption)
zplane(Hq,plotoption,plotoption2)
zplane(Hq,Name,Value)
[zq,pq,kq] = zplane(Hq)
[zq,pq,kq,zr,pr,kr] = zplane(Hq)
Description
current figure window. The poles and zeros of the quantized and
unquantized filters are plotted by default. The symbol o represents a
zero of the unquantized reference filter, and the symbol x represents a
pole of that filter. The symbols and + are used to plot the zeros and
poles of the quantized filter Hq. The plot includes the unit circle for
reference.
zplane(Hq,plotoption) plots the poles and zeros associated with
the quantized filter Hq according to one specified plot option. The
string plotoption can be either of the following reference filter display
options:
'on' to display the poles and zeros of both the quantized filter and
the associated reference filter (default)
'off' to display the poles and zeros of only the quantized filter
zplane(Hq,plotoption,plotoption2) plots the poles and zeros
associated with the quantized filter Hq according to two specified plot
options. The string plotoption can be selected from the reference filter
display options listed in the previous syntax. The string plotoption2
can be selected from the section-by-section plotting style options
described in the following list:
4-1334
zplane
'tile' to display the poles and zeros of each section of the filter in a
separate plot in the same figure window
zplane(Hq,Name,Value) returns a phase response with additional
Input
Arguments
Hq
hfilt is either:
4-1335
zplane
For filter System object inputs only, specify the arithmetic used during
analysis. When you specify 'double' or 'single', the function
performs double- or single-precision analysis. When you specify
'fixed' , the arithmetic changes depending on the setting of the
CoefficientDataType property and whether the System object is
locked or unlocked.
4-1336
zplane
Coefficient Data
Type
Rule
Unlocked
'Same as input'
Unlocked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
Locked
'Same as input'
Locked
'Custom'
The function
performs fixed-point
analysis based on
the setting of the
CustomCoefficientsDataType
property.
4-1337
zplane
When you do not specify the arithmetic for non-CIC structures, the
function uses double-precision arithmetic if the filter System object
is in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.
Output
Arguments
zq
Examples
4-1338
zplane
See Also
freqz | impz
4-1339
zplane
4-1340
5
Reference for the Properties
of Filter Objects
Fixed-Point Filter Properties on page 5-2
Adaptive Filter Properties on page 5-102
Multirate Filter Properties on page 5-115
5-2
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II Transposed'
'double'
1
1
false
[0x1 double]
set(hd,'arithmetic','fixed')
hd
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II Transposed'
'fixed'
1
1
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputFracLength: 15
StateWordLength: 16
StateAutoScale: true
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
5-3
RoundMode: 'convergent'
OverflowMode: 'wrap'
The notation embedded.fi indicates that the states are being represented by
fixed-point objects, usually called fi objects. If you take a closer look at the
property States, you see how the properties of the fi object represent the
values for the filter states.
hd.states
ans =
[]
DataType:
Scaling:
Signed:
WordLength:
FractionLength:
RoundMode:
OverflowMode:
ProductMode:
MaxProductWordLength:
SumMode:
MaxSumWordLength:
CastBeforeSum:
Fixed
BinaryPoint
true
16
15
round
saturate
FullPrecision
128
FullPrecision
128
true
5-4
Dynamic Properties
When you use a dfilt.structure function to create a filter, MATLAB
displays the filter properties in the command window in return (unless you
end the command with a semicolon which suppresses the output display).
Generally you see six or seven properties, ranging from the property
FilterStructure to PersistentMemory. These first properties are always
present in the filter. One of the most important properties is Arithmetic. The
Arithmetic property controls all of the dynamic properties for a filter.
Dynamic properties become available when you change another property in
the filter. For example, when you change the Arithmetic property value to
fixed, the display now shows many more properties for the filter, all of them
considered dynamic. Here is an example that uses a direct form II filter.
First create the default filter:
hd=dfilt.df2
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'double'
1
1
false
[0x1 double]
5-5
to a particular part of the filter and its operation. Each of the now-visible
properties is dynamic.
hd.arithmetic='fixed'
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'fixed'
1
1
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
Even this list of properties is not yet complete. Changing the value of other
properties such as the ProductMode or CoeffAutoScale properties may
reveal even more properties that control how the filter works. Remember this
feature about dfilt objects and dynamic properties as you review the rest of
this section about properties of fixed-point filters.
5-6
Property Name
Brief Description
AccumFracLength
AccumWordLength
Arithmetic
CastBeforeSum
[True] or false
5-7
5-8
Property Name
CoeffAutoScale
[True] or false
CoeffFracLength
CoeffWordLength
DenAccumFracLength
DenFracLength
Denominator
DenProdFracLength
Brief Description
Property Name
Brief Description
DenStateFracLength
FracDelay
FDAutoScale
[True] or false
FDFracLength
FDProdFracLength
FDProdWordLength
FDWordLength
DenStateWordLength
5-9
Property Name
5-10
Brief Description
FilterInternals
[FullPrecision],
SpecifyPrecision
FilterStructure
Not applicable.
InputFracLength
InputWordLength
Ladder
LadderAccumFrac
Length
LadderFracLength
Property Name
Brief Description
Lattice
LatticeAccumFrac
Length
LatticeFracLength
MultiplicandFrac
Length
MultiplicandWord
Length
NumAccumFracLength
Numerator
NumFracLength
NumProdFracLength
5-11
Property Name
Brief Description
NumStateFracLength
NumStateWordLength
OutputFracLength
OutputMode
[AvoidOverflow],
BestPrecision,
SpecifyPrecision
OutputWordLength
5-12
Property Name
OverflowMode
Saturate or [wrap]
ProductFracLength
ProductMode
[FullPrecision], KeepLSB,
KeepMSB, SpecifyPrecision
Brief Description
5-13
Property Name
Brief Description
ProductWordLength
PersistentMemory
True or [false]
RoundMode
5-14
Property Name
Brief Description
ScaleValues
Signed
[True] or false
sosMatrix
[1 0 0 1 0 0]
5-15
Property Name
5-16
Brief Description
SectionInputAuto
Scale
[True] or false
SectionInputFrac
Length
SectionInputWord
Length
SectionOutputAuto
Scale
[True] or false
Property Name
SectionOutputFrac
Length
SectionOutputWord
Length
StateFracLength
States
StateWordLength
TapSumFracLength
Brief Description
5-17
Property Name
TapSumMode
Brief Description
Determines how the accumulator
outputs stored that involve filter tap
weights. Choose from full precision
(FullPrecision) to prevent overflows,
or whether to keep the most significant
bits (KeepMSB) or least significant
bits (KeepLSB) when outputting
results from the accumulator. To let
you set the precision (the fraction
length) used by the output from the
accumulator, set FilterInternals to
SpecifyPrecision.
Symmetric and antisymmetric FIR
filters include this property.
TapSumWordLength
5-18
AccumFracLength
Except for state-space filters, all dfilt objects that use fixed arithmetic
have this property that defines the fraction length applied to data in the
accumulator. Combined with AccumWordLength, AccumFracLength helps
fully specify how the accumulator outputs data after processing addition
operations. As with all fraction length properties, AccumFracLength can be
any integer, including integers larger than AccumWordLength, and positive
or negative integers.
AccumWordLength
You use AccumWordLength to define the data word length used in the
accumulator. Set this property to a value that matches your intended
hardware. For example, many digital signal processors use 40-bit
accumulators, so set AccumWordLength to 40 in your fixed-point filter:
set(hq,'arithmetic','fixed');
set(hq,'AccumWordLength',40);
Arithmetic
Perhaps the most important property when you are working with dfilt
objects, Arithmetic determines the type of arithmetic the filter uses, and the
properties or quantizers that compose the fixed-point or quantized filter. You
use strings to set the Arithmetic property value.
The next table shows the valid strings for the Arithmetic property. Following
the table, each property string appears with more detailed information about
what happens when you select the string as the value for Arithmetic in
your dfilt.
5-19
Arithmetic
Property
String
double
single
fixed
5-20
'Direct-Form FIR'
'double'
[1x8 double]
false
5-21
'Direct-Form FIR'
'single'
[1x8 double]
false
[7x1 single]
fixed. Converting your dfilt object to use fixed arithmetic results in a filter
structure that uses properties and property values to match how the filter
would behave on digital signal processing hardware.
Note The fixed option for the property Arithmetic is available only when
you install Fixed-Point Designer software as well as DSP System Toolbox
software.
After you set Arithmetic to fixed, you are free to change any property value
from the default value to a value that more closely matches your needs. You
cannot, however, mix floating-point and fixed-point arithmetic in your filter
when you select fixed as the Arithmetic property value. Choosing fixed
restricts you to using either fixed-point or floating point throughout the filter
(the data type must be homogenous). Also, all data types must be signed.
fixed does not support unsigned data types except for unsigned coefficients
when you set the property Signed to false. Mixing word and fraction lengths
within the fixed object is acceptable. In short, using fixed arithmetic assumes
fixed word length.
fixed size and dedicated accumulator and product registers.
the ability to do either saturation or wrap arithmetic.
that multiple rounding modes are available.
5-22
'Direct-Form I'
'double'
[1x7 double]
[1x7 double]
false
Numerator: [6x1 double]
Denominator:[6x1 double]
set(hd,'arithmetic','fixed')
get(hd)
PersistentMemory: false
FilterStructure: 'Direct-Form I'
States: [1x1 filtstates.dfiir]
Numerator: [1x7 double]
Denominator: [1x7 double]
Arithmetic: 'fixed'
CoeffWordLength: 16
CoeffAutoScale: 1
Signed: 1
RoundMode: 'convergent'
OverflowMode: 'wrap'
InputWordLength: 16
5-23
InputFracLength:
ProductMode:
OutputWordLength:
OutputFracLength:
NumFracLength:
DenFracLength:
ProductWordLength:
NumProdFracLength:
DenProdFracLength:
AccumWordLength:
NumAccumFracLength:
DenAccumFracLength:
CastBeforeSum:
15
'FullPrecision'
16
15
16
14
32
31
29
40
31
29
1
'Direct-Form I'
'fixed'
[1x7 double]
[1x7 double]
false
Numerator: [6x1 fi]
Denominator:[6x1 fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputFracLength: 15
ProductMode: 'FullPrecision'
5-24
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
hdlat=dfilt.latticemamax(b)
hdlat =
FilterStructure:
Arithmetic:
Lattice:
PersistentMemory:
States:
[1x45 char]
'double'
[1x8 double]
false
[8x1 double]
hdlat.arithmetic='fixed'
hdlat =
FilterStructure:
Arithmetic:
Lattice:
PersistentMemory:
States:
[1x45 char]
'fixed'
[1x8 double]
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
5-25
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
Unlike the single or double options for Arithmetic, fixed uses properties
to define the word and fraction lengths for each portion of your filter. By
changing the property value of any of the properties, you control your filter
performance. Every word length and fraction length property is independent
set the one you need and the others remain unchanged, such as setting the
input word length with InputWordLength, while leaving the fraction length
the same.
d=fdesign.lowpass('n,fc',6,0.45)
d =
Response:
Specification:
Description:
NormalizedFrequency:
Fs:
FilterOrder:
Fcutoff:
designmethods(d)
5-26
butter
hd=butter(d)
hd =
FilterStructure:
Arithmetic:
sosMatrix:
ScaleValues:
PersistentMemory:
States:
hd.arithmetic='fixed'
hd =
FilterStructure:
Arithmetic:
sosMatrix:
ScaleValues:
PersistentMemory:
States:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
SectionInputWordLength: 16
SectionInputAutoScale: true
SectionOutputWordLength: 16
Section OutputAutoScale: true
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
5-27
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
hd.inputWordLength=12
hd =
FilterStructure:
Arithmetic:
sosMatrix:
ScaleValues:
PersistentMemory:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 12
InputFracLength: 15
SectionInputWordLength: 16
SectionInputAutoScale: true
SectionOutputWordLength: 16
SectionOutputAutoScale: true
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
5-28
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
Notice that the properties for the lattice filter hdlat and direct-form II filter hd
are different, as befits their differing filter structures. Also, some properties
are common to both objects, such as RoundMode and PersistentMemory and
behave the same way in both objects.
Notes About Fraction Length, Word Length, and Precision. Word
length and fraction length combine to make the format for a fixed-point
number, where word length is the number of bits used to represent the value
and fraction length specifies, in bits, the location of the binary point in the
fixed-point representation. Therein lies a problem fraction length, which
you specify in bits, can be larger than the word length, or a negative number
of bits. This section explains how that idea works and how you might use it.
Unfortunately fraction length is somewhat misnamed (although it continues
to be used in this Users Guide and elsewhere for historical reasons).
Fraction length defined as the number of fractional bits (bits to the right of the
binary point) is true only when the fraction length is positive and less than
or equal to the word length. In MATLAB format notation you can use [word
length fraction length]. For example, for the format [16 16], the second 16 (the
fraction length) is the number of fractional bits or bits to the right of the
binary point. In this example, all 16 bits are to the right of the binary point.
But it is also possible to have fixed-point formats of [16 18] or [16 -45]. In
these cases the fraction length can no longer be the number of bits to the right
of the binary point since the format says the word length is 16 there cannot
be 18 fraction length bits on the right. And how can there be a negative
number of bits for the fraction length, such as [16 -45]?
5-29
A better way to think about fixed-point format [word length fraction length]
and what it means is that the representation of a fixed-point number is a
weighted sum of powers of two driven by the fraction length, or the twos
complement representation of the fixed-point number.
Consider the format [B L], where the fraction length L can be positive,
negative, 0, greater than B (the word length) or less than B. (B and L are
always integers and B is always positive.)
Given a binary string b(1) b(2) b(3) ... b(B), to determine the twos-complement
value of the string in the format described by [B L], use the value of the
individual bits in the binary string in the following formula, where b(1) is
the first binary bit (and most significant bit, MSB), b(2) is the second, and
on up to b(B).
The decimal numeric value that those bits represent is given by
value =-b(1)*2^(B-L-1)+b(2)*2^(B-L-2)+b(3)*2^(B-L-3)+...+ b(B)*2^(-L)
L, the fraction length, represents the negative of the weight of the last, or
least significant bit (LSB). L is also the step size or the precision provided by
a given fraction length.
Precision. Here is how precision works.
When all of the bits of a binary string are zero except for the LSB (which is
therefore equal to one), the value represented by the bit string is given by
2(-L). If L is negative, for example L=-16, the value is 216. The smallest step
between numbers that can be represented in a format where L=-16 is given
by 1 x 216 (the rightmost term in the formula above), which is 65536. Note
the precision does not depend on the word length.
Take a look at another example. When the word length set to 8 bits, the
decimal value 12 is represented in binary by 00001100. That 12 is the
decimal equivalent of 00001100 tells you that you are using [8 0] data format
representation the word length is 8 bits and fraction length 0 bits, and the
step size or precision (the smallest difference between two adjacent values
in the format [8,0], is 20=1.
5-30
Suppose you plan to keep only the upper 5 bits and discard the other three.
The resulting precision after removing the right-most three bits comes from
the weight of the lowest remaining bit, the fifth bit from the left, which is
23=8, so the format would be [5,-3].
Note that in this format the step size is 8, I cannot represent numbers that
are between multiples of 8.
In MATLAB, with Fixed-Point Designer software installed:
x=8;
q=quantizer([8,0]); % Word length = 8, fraction length = 0
xq=quantize(q,x);
binxq=num2bin(q,xq);
q1=quantizer([5 -3]); % Word length = 5, fraction length = -3
xq1 = quantize(q1,xq);
binxq1=num2bin(q1,xq1);
binxq
binxq =
00001000
binxq1
binxq1 =
00001
But notice that in [5,-3] format, 00001 is the twos complement representation
for 8, not for 1; q = quantizer([8 0]) and q1 = quantizer([5 -3]) are
not the same. They cover the about the same range range(q)>range(q1)
but their quantization step is different eps(q)= 8, and eps(q1)=1.
Look at one more example. When you construct a quantizer q
q = quantizer([a,b])
the first element in [a,b] is a, the word length used for quantization. The
second element in the expression, b, is related to the quantization step
the numerical difference between the two closest values that the quantizer
5-31
can represent. This is also related to the weight given to the LSB. Note that
2^(-b) = eps(q).
Now construct two quantizers, q1 and q2. Let q1 use the format [32,0] and let
q2 use the format [16, -16].
q1 = quantizer([32,0])
q2 = quantizer([16,-16])
Quantizers q1 and q2 cover the same range, but q2 has less precision. It
covers the range in steps of 216, while q covers the range in steps of 1.
This lost precision is due to (or can be used to model) throwing out 16
least-significant bits.
An important point to understand is that in dfilt objects and filtering you
control which bits are carried from the sum and product operations in the
filter to the filter output by setting the format for the output from the sum
or product operation.
For instance, if you use [16 0] as the output format for a 32-bit result from a
sum operation when the original format is [32 0], you take the lower 16 bits
from the result. If you use [16 -16], you take the higher 16 bits of the original
32 bits. You could even take 16 bits somewhere in between the 32 bits by
choosing something like [16 -8], but you probably do not want to do that.
Filter scaling is directly implicated in the format and precision for a filter.
When you know the filter input and output formats, as well as the filter
internal formats, you can scale the inputs or outputs to stay within the format
ranges. For more information about scaling filters, refer to Floating-Point to
Fixed-Point Filter Conversion.
Notice that overflows or saturation might occur at the filter input, filter
output, or within the filter itself, such as during add or multiply or accumulate
operations. Improper scaling at any point in the filter can result in numerical
errors that dramatically change the performance of your fixed-point filter
implementation.
5-32
CastBeforeSum
Setting the CastBeforeSum property determines how the filter handles
the input values to sum operations in the filter. After you set your
filter Arithmetic property value to fixed, you have the option of using
CastBeforeSum to control the data type of some inputs (addends) to
summations in your filter. To determine which addends reflect the
CastBeforeSum property setting, refer to the reference page for the signal
flow diagram for the filter structure.
CastBeforeSum specifies whether to cast selected addends to summations in
the filter to the output format from the addition operation before performing
the addition. When you specify true for the property value, the results of the
affected sum operations match most closely the results found on most digital
signal processors. Performing the cast operation before the summation adds
one or two additional quantization operations that can add error sources
to your filter results.
Specifying CastBeforeSum to be false prevents the addends from being cast
to the output format before the addition operation. Choose this setting to get
the most accurate results from summations without considering the hardware
your filter might use.
Notice that the output format for every sum operation reflects the value of
the output property specified in the filter structure diagram. Which input
property is referenced by CastBeforeSum depends on the structure.
Property Value
Description
false
true
5-33
showing that the input data to the sum operations (the addends) retain
their format word length and fraction length from previous operations. The
addition process uses the existing input formats and then casts the output to
the format defined by AccumFormat. Thus the output data has the word length
and fraction length defined by AccumWordLength and AccumFracLength.
When CastBeforeSum is true, sum elements in filter signal flow diagrams
look like this:
5-34
showing that the input data gets recast to the accumulator format word
length and fraction length (AccumFormat) before the sum operation occurs.
The data output by the addition operation has the word length and fraction
length defined by AccumWordLength and AccumFracLength.
CoeffAutoScale
How the filter represents the filter coefficients depends on the property value
of CoeffAutoScale. When you create a dfilt object, you use coefficients in
double-precision format. Converting the dfilt object to fixed-point arithmetic
forces the coefficients into a fixed-point representation. The representation
the filter uses depends on whether the value of CoeffAutoScale is true or
false.
CoeffAutoScale = true means the filter chooses the fraction length to
maintain the value of the coefficients as close to the double-precision values
as possible. When you change the word length applied to the coefficients,
the filter object changes the fraction length to try to accommodate the
change. true is the default setting.
CoeffAutoScale = false removes the automatic scaling of the fraction
length for the coefficients and exposes the property that controls the
coefficient fraction length so you can change it. For example, if the filter
is a direct form FIR filter, setting CoeffAutoScale = false exposes
the NumFracLength property that specifies the fraction length
applied to numerator coefficients. If the filter is an IIR filter, setting
CoeffAutoScale = false exposes both the NumFracLength and
DenFracLength properties.
Here is an example of using CoeffAutoScale with a direct form filter.
hd2=dfilt.dffir([0.3 0.6 0.3])
hd2 =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
'Direct-Form FIR'
'double'
[0.3000 0.6000 0.3000]
false
[2x1 double]
5-35
hd2.arithmetic='fixed'
hd2 =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
'Direct-Form FIR'
'fixed'
[0.3000 0.6000 0.3000]
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
To this point, the filter coefficients retain the original values from when you
created the filter as shown in the Numerator property. Now change the
CoeffAutoScale property value from true to false.
hd2.coeffautoScale=false
hd2 =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
5-36
'Direct-Form FIR'
'fixed'
[0.3000 0.6000 0.3000]
false
16
false
15
true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
With the NumFracLength property now available, change the word length
to 5 bits.
Notice the coefficient values. Setting CoeffAutoScale to false removes the
automatic fraction length adjustment and the filter coefficients cannot be
represented by the current format of [5 15] a word length of 5 bits, fraction
length of 15 bits.
hd2.coeffwordlength=5
hd2 =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
'Direct-Form FIR'
'fixed'
[4.5776e-004 4.5776e-004 4.5776e-004]
false
[1x1 embedded.fi]
CoeffWordLength: 5
5-37
CoeffAutoScale: false
NumFracLength: 15
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
'Direct-Form FIR'
'fixed'
[0.3125 0.6250 0.3125]
false
[1x1 embedded.fi]
CoeffWordLength: 5
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
5-38
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
get(hd2)
PersistentMemory: false
FilterStructure: 'Direct-Form FIR'
States: [1x1 embedded.fi]
Numerator: [0.3125 0.6250 0.3125]
Arithmetic: 'fixed'
CoeffWordLength: 5
CoeffAutoScale: 1
Signed: 1
RoundMode: 'convergent'
OverflowMode: 'wrap'
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
NumFracLength: 4
OutputFracLength: 12
ProductWordLength: 21
ProductFracLength: 19
AccumWordLength: 40
AccumFracLength: 19
CastBeforeSum: 1
5-39
CoeffFracLength
Fixed-point scalar filters that you create using dfilt.scalar use this
property to define the fraction length applied to the scalar filter coefficients.
Like the coefficient-fraction-length-related properties for the FIR, lattice, and
IIR filters, CoeffFracLength is not displayed for scalar filters until you set
CoeffAutoScale to false. Once you change the automatic scaling you can set
the fraction length for the coefficients to any value you require.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well. By default, the value is 14 bits, with the
CoeffWordlength of 16 bits.
CoeffWordLength
One primary consideration in developing filters for hardware is the length
of a data word. CoeffWordLength defines the word length for these data
storage and arithmetic locations:
Numerator and denominator filter coefficients
Tap sum in dfilt.dfsymfir and dfilt.dfasymfir filter objects
Section input, multiplicand, and state values in direct-form SOS filter
objects such as dfilt.df1t and dfilt.df2
Scale values in second-order filters
Lattice and ladder coefficients in lattice filter objects, such as
dfilt.latticearma and dfilt.latticemamax
Gain in dfilt.scalar
Setting this property value controls the word length for the data listed. In
most cases, the data words in this list have separate fraction length properties
to define the associated fraction lengths.
Any positive, integer word length works here, limited by the machine you use
to develop your filter and the hardware you use to deploy your filter.
5-40
DenAccumFracLength
Filter structures df1, df1t, df2, and df2t that use fixed arithmetic have this
property that defines the fraction length applied to denominator coefficients
in the accumulator. In combination with AccumWordLength, the properties
fully specify how the accumulator outputs data stored there.
As with all fraction length properties, DenAccumFracLength can be any
integer, including integers larger than AccumWordLength, and positive or
negative integers. To be able to change the property value for this property,
you set FilterInternals to SpecifyPrecision.
DenFracLength
Property DenFracLength contains the value that specifies the fraction length
for the denominator coefficients for your filter. DenFracLength specifies the
fraction length used to interpret the data stored in C. Used in combination
with CoeffWordLength, these two properties define the interpretation of the
coefficients stored in the vector that contains the denominator coefficients.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well. By default, the value is 15 bits, with the
CoeffWordLength of 16 bits.
Denominator
The denominator coefficients for your IIR filter, taken from the prototype you
start with, are stored in this property. Generally this is a 1-by-N array of data
in double format, where N is the length of the filter.
All IIR filter objects include Denominator, except the lattice-based filters
which store their coefficients in the Lattice property, and second-order
section filters, such as dfilt.df1tsos, which use the SosMatrix property to
hold the coefficients for the sections.
DenProdFracLength
A property of all of the direct form IIR dfilt objects, except the ones that
implement second-order sections, DenProdFracLength specifies the fraction
5-41
length applied to data output from product operations that the filter performs
on denominator coefficients.
Looking at the signal flow diagram for the dfilt.df1t filter, for example, you
see that denominators and numerators are handled separately. When you set
ProductMode to SpecifyPrecision, you can change the DenProdFracLength
setting manually. Otherwise, for multiplication operations that use the
denominator coefficients, the filter sets the fraction length as defined by the
ProductMode setting.
DenStateFracLength
When you look at the flow diagram for the dfilt.df1sos filter object, the
states associated with denominator coefficient operations take the fraction
length from this property. In combination with the DenStateWordLength
property, these properties fully specify how the filter interprets the states.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well. By default, the value is 15 bits, with the
DenStateWordLength of 16 bits.
DenStateWordLength
When you look at the flow diagram for the dfilt.df1sos filter object, the
states associated with the denominator coefficient operations take the
data format from this property and the DenStateFracLength property. In
combination, these properties fully specify how the filter interprets the state
it uses.
By default, the value is 16 bits, with the DenStateFracLength of 15 bits.
FilterInternals
Similar to the FilterInternals pane in FDATool, this property controls
whether the filter sets the output word and fraction lengths automatically,
and the accumulator word and fraction lengths automatically as well, to
maintain the best precision results during filtering. The default value,
FullPrecision, sets automatic word and fraction length determination by
the filter. Setting FilterInternals to SpecifyPrecision exposes the output
5-42
and accumulator related properties so you can set your own word and fraction
lengths for them. Note that
FilterStructure
Every dfilt object has a FilterStructure property. This is a read-only
property containing a string that declares the structure of the filter object
you created.
When you construct filter objects, the FilterStructure property value is
returned containing one of the strings shown in the following table. Property
FilterStructure indicates the filter architecture and comes from the
constructor you use to create the filter.
After you create a filter object, you cannot change the FilterStructure
property value. To make filters that use different structures, you construct
new filters using the appropriate methods, or use convert to switch to a
new structure.
Default value. Since this depends on the constructor you use and the
constructor includes the filter structure definition, there is no default value.
When you try to create a filter without specifying a structure, MATLAB
returns an error.
'dfilt.df1'
Direct form I
'dfilt.df1sos'
'dfilt.df1t'
'dfilt.df2'
Direct form II
'dfilt.df2sos'
'dfilt.df2t'
'dfilt.dfasymfir'
5-43
'dfilt.dffir'
'dfilt.dffirt'
'dfilt.latticeallpass'
Lattice allpass
'dfilt.latticear'
'dfilt.latticemamin'
'dfilt.latticemamax'
'dfilt.latticearma'
Lattice ARMA
'dfilt.dfsymfir'
'dfilt.scalar'
Scalar
5-44
When your df2 filter uses the Arithmetic property set to fixed, the filter
structure contains the formatting features shown in the diagram. The formats
included in the structure are fixed-point objects that include properties to set
various word and fraction length formats. For example, the NumFormat or
DenFormat in the fixed-point arithmetic filter set the properties for quantizing
numerator or denominator coefficients according to word and fraction length
settings.
When the leading denominator coefficient a(1) in your filter is not 1, choose it
to be a power of two so that a shift replaces the multiply that would otherwise
be used.
Fixed-Point Arithmetic Filter Structures. You choose among several filter
structures when you create fixed-point filters. You can also specify filters with
single or multiple cascaded sections of the same type. Because quantization is
a nonlinear process, different fixed-point filter structures produce different
results.
To specify the filter structure, you select the appropriate dfilt.structure
method to construct your filter. Refer to the function reference information
for dfilt and set for details on setting property values for quantized filters.
5-45
The figures in the following subsections of this section serve as aids to help you
determine how to enter your filter coefficients for each filter structure. Each
subsection contains an example for constructing a filter of the given structure.
Scale factors for the input and output for the filters do not appear in the block
diagrams. The default filter structures do not include, nor assume, the scale
factors. For filter scaling information, refer to scale in the Help system.
About the Filter Structure Diagrams. In the diagrams that accompany the
following filter structure descriptions, you see the active operators that define
the filter, such as sums and gains, and the formatting features that control
the processing in the filter. Notice also that the coefficients are labeled in the
figure. This tells you the order in which the filter processes the coefficients.
While the meaning of the block elements is straightforward, the labels for the
formats that form part of the filter are less clear. Each figure includes text in
the form labelFormat that represents the existence of a formatting feature at
that point in the structure. The Format stands for formatting object and the
label specifies the data that the formatting object affects.
For example, in the dfilt.df2 filter shown above, the entries InputFormat
and OutputFormat are the formats applied, that is the word length and
fraction length, to the filter input and output data. For example, filter
properties like OutputWordLength and InputWordLength specify values that
control filter operations at the input and output points in the structure and
are represented by the formatting objects InputFormat and OutputFormat
shown in the filter structure diagrams.
Direct Form I Filter Structure. The following figure depicts the direct form I
filter structure that directly realizes a transfer function with a second-order
numerator and denominator. The numerator coefficients are numbered b(i), i
=1, 2, 3; the denominator coefficients are numbered a(i), i = 1, 2, 3; and the
states (used for initial and final state values in filtering) are labeled z(i). In
the figure, the Arithmetic property is set to fixed.
5-46
5-47
Direct Form I Transposed Filter Structure. The next signal flow diagram
depicts a direct form I transposed filter structure that directly realizes a
transfer function with a second-order numerator and denominator. The
numerator coefficients are b(i), i = 1, 2, 3; the denominator coefficients are
a(i), i = 1, 2, 3; and the states (used for initial and final state values in
filtering) are labeled z(i). With the Arithmetic property value set to fixed,
the figure shows the filter with the properties indicated.
5-48
Direct Form II Filter Structure. The following graphic depicts a direct form
II filter structure that directly realizes a transfer function with a second-order
numerator and denominator. In the figure, the Arithmetic property value is
fixed. Numerator coefficients are named b(i); denominator coefficients are
named a(i), i = 1, 2, 3; and the states (used for initial and final state values
in filtering) are named z(i).
5-49
5-50
5-51
Now create the fixed-point filtering version of the filter from hd, which is
floating point.
hq = set(hd,'arithmetic','fixed');
5-52
Use the method dfilt.dfasymfir to construct the filter, and then set the
Arithmetic property to fixed to convert to a fixed-point filter with this
structure.
Example Specifying an Odd-Order Direct Form Antisymmetric FIR
Filter. Specify a fifth-order direct form antisymmetric FIR filter structure for
a fixed-point filter hq with the following code.
b = [-0.008 0.06 -0.44 0.44 -0.06 0.008];
hq = dfilt.dfasymfir(b);
set(hq,'arithmetic','fixed')
hq
5-53
hq =
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
TapSumMode: 'KeepMSB'
TapSumWordLength: 17
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
InheritSettings: false
5-54
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
TapSumMode: 'KeepMSB'
TapSumWordLength: 17
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
InheritSettings: false
Direct Form Finite Impulse Response (FIR) Filter Structure. In the next
figure, you see the signal flow graph for a direct form finite impulse response
(FIR) filter structure that directly realizes a second-order FIR filter. The
filter coefficients are b(i), i = 1, 2, 3, and the states (used for initial and final
state values in filtering) are z(i). To generate the figure, set the Arithmetic
property to fixed after you create your prototype filter in double-precision
arithmetic.
5-55
Use the dfilt.dffir method to generate a filter that uses this structure.
Example Specifying a Direct Form FIR Filter. You can specify a
second-order direct form FIR filter structure for a fixed-point filter hq with
the following code.
b = [0.05 0.9 0.05];
hd = dfilt.dffir(b);
hq = set(hd,'arithmetic','fixed');
Direct Form FIR Transposed Filter Structure. This figure uses the filter
coefficients labeled b(i), i = 1, 2, 3, and states (used for initial and final state
values in filtering) are labeled z(i). These depict a direct form finite impulse
response (FIR) transposed filter structure that directly realizes a second-order
FIR filter.
5-56
With the Arithmetic property set to fixed, your filter matches the figure.
Using the method dfilt.dffirt returns a double-precision filter that you
convert to a fixed-point filter.
5-57
Lattice Allpass Filter Structure. The following figure depicts the lattice
allpass filter structure. The pictured structure directly realizes third-order
lattice allpass filters using fixed-point arithmetic. The filter reflection
coefficients are labeled k1(i), i = 1, 2, 3. The states (used for initial and final
state values in filtering) are labeled z(i).
To create a quantized filter that uses the lattice allpass structure shown in
the figure, use the dfilt.latticeallpass method and set the Arithmetic
property to fixed.
Example Specifying a Lattice Allpass Filter. You can create a
third-order lattice allpass filter structure for a quantized filter hq with the
following code.
k = [.66 .7 .44];
hd=dfilt.latticeallpass(k);
set(hq,'arithmetic','fixed');
5-58
5-59
5-60
When you start with a minimum phase transfer function, the upper branch
of the resulting lattice structure returns a minimum phase filter. The lower
branch returns a minimum phase filter.
When your transfer function is neither minimum phase nor maximum
phase, the lattice moving average minimum phase structure will not be
minimum phase.
When you start with a minimum phase filter, the resulting lattice filter is
minimum phase also.
The filter reflection coefficients are labeled k((i).), i = 1, 2, 3. The states (used
for initial and final state values in filtering) are labeled z((i).). This figure
shows the filter structure when theArithmetic property is set to fixed to
reveal the fixed-point arithmetic format features that control such options
as word length and fraction length.
5-61
5-62
Direct Form Symmetric FIR Filter Structure (Any Order). Shown in the
next figure, you see signal flow that depicts a direct form symmetric FIR filter
structure that directly realizes a fifth-order direct form symmetric FIR filter.
Filter coefficients are labeled b(i), i = 1, ..., n, and states (used for initial and
final state values in filtering) are labeled z(i). Showing the filter structure
used when you select fixed for the Arithmetic property value, the first figure
details the properties in the filter object.
Assigning Filter Coefficients. The syntax you use to assign filter coefficients
for your floating-point or fixed-point filter depends on the structure you
select for your filter.
5-63
5-64
Description
ca2tf
cl2tf
convert
sos
tf2ca
tf2cl
tf2latc
tf2sos
tf2ss
tf2zp
zp2sos
zp2ss
zp2tf
'Direct-Form I Transposed'
'double'
1
1
false
Numerator: [0x0 double]
Denominator:[0x0 double]
hd.arithmetic='fixed'
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form I Transposed'
'fixed'
1
1
false
Numerator: [0x0 fi]
Denominator:[0x0 fi]
convert(hd,'df2')
Warning: Using reference filter for structure conversion.
Fixed-point attributes will not be converted.
ans =
5-65
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'double'
1
1
false
[0x1 double]
Gain
dfilt.scalar filters have a gain value stored in the gain property. By
InputFracLength
InputFracLength defines the fraction length assigned to the input data for
your filter. Used in tandem with InputWordLength, the pair defines the data
InputWordLength
Specifies the number of bits your filter uses to represent your input data. Your
word length option is limited by the arithmetic you choose up to 32 bits for
5-66
Ladder
Included as a property in dfilt.latticearma filter objects, Ladder contains
the denominator coefficients that form an IIR lattice filter object. For
instance, the following code creates a high pass filter object that uses the
lattice ARMA structure.
[b,a]=cheby1(5,.5,.5,'high')
b =
0.0282
-0.1409
0.2817
-0.2817
0.1409
-0.0282
1.0000
0.9437
1.4400
0.9629
0.5301
0.1620
a =
hd=dfilt.latticearma(b,a)
hd =
FilterStructure: [1x44 char]
Arithmetic: 'double'
Lattice: [1x6 double]
Ladder: [1 0.9437 1.4400 0.9629 0.5301 0.1620]
PersistentMemory: false
States: [6x1 double]
hd.arithmetic='fixed'
hd =
FilterStructure:
Arithmetic:
Lattice:
Ladder:
[1x44 char]
'fixed'
[1x6 double]
[1 0.9437 1.4400 0.9629 0.5301 0.1620]
5-67
PersistentMemory: false
States: [1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
LadderAccumFracLength
Autoregressive, moving average lattice filter objects (lattticearma) use
ladder coefficients to define the filter. In combination with LadderFracLength
and CoeffWordLength, these three properties specify or reflect how the
accumulator outputs data stored there. As with all fraction length properties,
LadderAccumFracLength can be any integer, including integers larger than
AccumWordLength, and positive or negative integers. The default value is
29 bits.
LadderFracLength
To let you control the way your latticearma filter interprets the denominator
coefficients, LadderFracLength sets the fraction length applied to the ladder
coefficients for your filter. The default value is 14 bits.
5-68
Lattice
When you create a lattice-based IIR filter, your numerator coefficients (from
your IIR prototype filter or the default dfilt lattice filter function) get stored
in the Lattice property of the dfilt object. The properties CoeffWordLength
and LatticeFracLength define the data format the object uses to represent
the lattice coefficients. By default, lattice coefficients are in double-precision
format.
LatticeAccumFracLength
Lattice filter objects (latticeallpass, latticearma, latticemamax, and
latticemamin) use lattice coefficients to define the filter. In combination with
LatticeFracLength and CoeffWordLength, these three properties specify
how the accumulator outputs lattice coefficient-related data stored there. As
with all fraction length properties, LatticeAccumFracLength can be any
integer, including integers larger than AccumWordLength, and positive or
negative integers. By default, the property is set to 31 bits.
LatticeFracLength
To let you control the way your filter interprets the denominator coefficients,
LatticeFracLength sets the fraction length applied to the lattice
coefficients for your lattice filter. When you create the default lattice filter,
LatticeFracLength is 16 bits.
As with all fraction length properties, LatticeFracLength can be any integer,
including integers larger than CoeffWordLength, and positive or negative
integers.
MultiplicandFracLength
Each input data element for a multiply operation has both word length
and fraction length to define its representation. MultiplicandFracLength
sets the fraction length to use when the filter object performs any multiply
operation during filtering. For default filters, this is set to 15 bits.
5-69
MultiplicandWordLength
Each input data element for a multiply operation has both word length and
fraction length to define its representation. MultiplicandWordLength sets
the word length to use when the filter performs any multiply operation during
filtering. For default filters, this is set to 16 bits. Only the df1t and df1tsos
filter objects include the MultiplicandFracLength property.
Only the df1t and df1tsos filter objects include the MultiplicandWordLength
property.
NumAccumFracLength
Filter structures df1, df1t, df2, and df2t that use fixed arithmetic have this
property that defines the fraction length applied to numerator coefficients in
output from the accumulator. In combination with AccumWordLength, the
NumAccumFracLength property fully specifies how the accumulator outputs
numerator-related data stored there.
As with all fraction length properties, NumAccumFracLength can be any
integer, including integers larger than AccumWordLength, and positive or
negative integers. 30 bits is the default value when you create the filter
object. To be able to change the value for this property, set FilterInternals
for the filter to SpecifyPrecision.
Numerator
The numerator coefficients for your filter, taken from the prototype you start
with or from the default filter, are stored in this property. Generally this is a
1-by-N array of data in double format, where N is the length of the filter.
All of the filter objects include Numerator, except the lattice-based and
second-order section filters, such as dfilt.latticema and dfilt.df1tsos.
5-70
NumFracLength
Property NumFracLength contains the value that specifies the fraction
length for the numerator coefficients for your filter. NumFracLength
specifies the fraction length used to interpret the numerator coefficients.
Used in combination with CoeffWordLength, these two properties define
the interpretation of the coefficients stored in the vector that contains the
numerator coefficients.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well. By default, the value is 15 bits, with the
CoeffWordLength of 16 bits.
NumProdFracLength
A property of all of the direct form IIR dfilt objects, except the ones that
implement second-order sections, NumProdFracLength specifies the fraction
length applied to data output from product operations the filter performs on
numerator coefficients.
Looking at the signal flow diagram for the dfilt.df1t filter, for example, you
see that denominators and numerators are handled separately. When you set
ProductMode to SpecifyPrecision, you can change the NumProdFracLength
setting manually. Otherwise, for multiplication operations that use the
numerator coefficients, the filter sets the word length as defined by the
ProductMode setting.
NumStateFracLength
All the variants of the direct form I structure include the property
NumStateFracLength to store the fraction length applied to the numerator
states for your filter object. By default, this property has the value 15 bits,
with the CoeffWordLength of 16 bits, which you can change after you create
the filter object.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well.
5-71
NumStateWordLength
When you look at the flow diagram for the df1sos filter object, the states
associated with the numerator coefficient operations take the data format
from this property and the NumStateFracLength property. In combination,
these properties fully specify how the filter interprets the state it uses.
As with all fraction length properties, the value you enter here can be any
negative or positive integer, or zero. Fraction length can be larger than the
associated word length, as well. By default, the value is 16 bits, with the
NumStateFracLength of 11 bits.
OutputFracLength
To define the output from your filter object, you need both the word and
fraction lengths. OutputFracLength determines the fraction length applied
to interpret the output data. Combining this with OutputWordLength fully
specifies the format of the output.
Your fraction length can be any negative or positive integer, or zero. In
addition, the fraction length you specify can be larger than the associated
word length. Generally, the default value is 11 bits.
OutputMode
Sets the mode the filter uses to scale the filtered (output) data. You have
the following choices:
AvoidOverflow directs the filter to set the property that controls the
output data fraction length to avoid causing the data to overflow. In a df2
filter, this would be the OutputFracLength property.
BestPrecision directs the filter to set the property that controls the
output data fraction length to maximize the precision in the output data.
For df1t filters, this is the OutputFracLength property. When you change
the word length (OutputWordLength), the filter adjusts the fraction length
to maintain the best precision for the new word size.
SpecifyPrecision lets you set the fraction length used by the filtered
data. When you select this choice, you can set the output fraction length
using the OutputFracLength property to define the output precision.
5-72
All filters include this property except the direct form I filter which takes the
output format from the filter states.
Here is an example that changes the mode setting to bestprecision, and
then adjusts the word length for the output.
hd=dfilt.df2
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'double'
1
1
false
[0x1 double]
hd.arithmetic='fixed'
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'fixed'
1
1
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
StateFracLength: 15
5-73
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
get(hd)
PersistentMemory: false
FilterStructure: 'Direct-Form II'
States: [1x1 embedded.fi]
Numerator: 1
Denominator: 1
Arithmetic: 'fixed'
CoeffWordLength: 16
CoeffAutoScale: 1
Signed: 1
RoundMode: 'convergent'
OverflowMode: 'wrap'
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
StateWordLength: 16
StateFracLength: 15
NumFracLength: 14
DenFracLength: 14
OutputFracLength: 13
ProductWordLength: 32
NumProdFracLength: 29
DenProdFracLength: 29
AccumWordLength: 40
NumAccumFracLength: 29
DenAccumFracLength: 29
CastBeforeSum: 1
hd.outputMode='bestprecision'
5-74
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II'
'fixed'
1
1
false
[1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'BestPrecision'
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
hd.outputWordLength=8;
get(hd)
PersistentMemory:
FilterStructure:
States:
Numerator:
Denominator:
Arithmetic:
false
'Direct-Form II'
[1x1 embedded.fi]
1
1
'fixed'
5-75
CoeffWordLength:
CoeffAutoScale:
Signed:
RoundMode:
OverflowMode:
InputWordLength:
InputFracLength:
OutputWordLength:
OutputMode:
ProductMode:
StateWordLength:
StateFracLength:
NumFracLength:
DenFracLength:
OutputFracLength:
ProductWordLength:
NumProdFracLength:
DenProdFracLength:
AccumWordLength:
NumAccumFracLength:
DenAccumFracLength:
CastBeforeSum:
16
1
1
'convergent'
'wrap'
16
15
8
'BestPrecision'
'FullPrecision'
16
15
14
14
5
32
29
29
40
29
29
1
OutputWordLength
Use the property OutputWordLength to set the word length used by the output
from your filter. Set this property to a value that matches your intended
hardware. For example, some digital signal processors use 32-bit output so
you would set OutputWordLength to 32.
[b,a] = butter(6,.5);
hd=dfilt.df1t(b,a);
set(hd,'arithmetic','fixed')
hd
hd =
5-76
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
MultiplicandWordLength: 16
MultiplicandFracLength: 15
StateWordLength: 16
StateAutoScale: true
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
hd.outputwordLength=32
hd =
FilterStructure: 'Direct-Form I Transposed'
Arithmetic: 'fixed'
5-77
Numerator:
Denominator:
PersistentMemory:
States:
[1x7 double]
[1 0 0.7777 0 0.1142 0 0.0018]
false
Numerator: [6x1 fi]
Denominator:[6x1 fi]
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 32
OutputMode: 'AvoidOverflow'
MultiplicandWordLength: 16
MultiplicandFracLength: 15
StateWordLength: 16
StateAutoScale: true
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
When you create a filter object, this property starts with the value 16.
OverflowMode
The OverflowMode property is specified as one of the following two strings
indicating how to respond to overflows in fixed-point arithmetic:
'saturate' saturate overflows.
5-78
When the values of data to be quantized lie outside of the range of the
largest and smallest representable numbers (as specified by the applicable
word length and fraction length properties), these values are quantized to
the value of either the largest or smallest representable value, depending
on which is closest. saturate is the default value for OverflowMode.
'wrap' wrap all overflows to the range of representable values.
When the values of data to be quantized lie outside of the range of the
largest and smallest representable numbers (as specified by the data format
properties), these values are wrapped back into that range using modular
arithmetic relative to the smallest representable number. You can learn
more about modular arithmetic in Fixed-Point Designer documentation.
These rules apply to the OverflowMode property.
Applies to the accumulator and output data only.
Does not apply to coefficients or input data. These always saturate the
results.
Does not apply to products. Products maintain full precision at all times.
Your filters do not lose precision in the products.
Note Numbers in floating-point filters that extend beyond the dynamic range
overflow to inf.
ProductFracLength
After you set ProductMode for a fixed-point filter to SpecifyPrecision, this
property becomes available for you to change. ProductFracLength sets the
fraction length the filter uses for the results of multiplication operations.
Only the FIR filters such as asymmetric FIRs or lattice autoregressive filters
include this dynamic property.
Your fraction length can be any negative or positive integer, or zero. In
addition, the fraction length you specify can be larger than the associated
word length. Generally, the default value is 11 bits.
5-79
ProductMode
This property, available when your filter is in fixed-point arithmetic mode,
specifies how the filter outputs the results of multiplication operations. All
dfilt objects include this property when they use fixed-point arithmetic.
When available, you select from one of the following values for ProductMode:
FullPrecision means the filter automatically chooses the word length
and fraction length it uses to represent the results of multiplication
operations. The setting allow the product to retain the precision provided
by the inputs (multiplicands) to the operation.
KeepMSB means you specify the word length for representing product
operation results. The filter sets the fraction length to discard the LSBs,
keep the higher order bits in the data, and maintain the precision.
KeepLSB means you specify the word length for representing the product
operation results. The filter sets the fraction length to discard the MSBs,
keep the lower order bits, and maintain the precision. Compare to the
KeepMSB option.
SpecifyPrecision means you specify the word length and the fraction
length to apply to data output from product operations.
When you switch to fixed-point filtering from floating-point, you are most
likely going to throw away some data bits after product operations in your
filter, perhaps because you have limited resources. When you have to discard
some bits, you might choose to discard the least significant bits (LSB) from
a result since the resulting quantization error would be small as the LSBs
carry less weight. Or you might choose to keep the LSBs because the results
have MSBs that are mostly zero, such as when your values are small relative
to the range of the format in which they are represented. So the options for
ProductMode let you choose how to maintain the information you need from
the accumulator.
For more information about data formats, word length, and fraction length in
fixed-point arithmetic, refer to Notes About Fraction Length, Word Length,
and Precision on page 5-29.
5-80
ProductWordLength
You use ProductWordLength to define the data word length used by the
output from multiplication operations. Set this property to a value that
matches your intended application. For example, the default value is 32 bits,
but you can set any word length.
set(hq,'arithmetic','fixed');
set(hq,'ProductWordLength',64);
PersistentMemory
Determine whether the filter states get restored to their starting values for
each filtering operation. The starting values are the values in place when you
create the filter object. PersistentMemory returns to zero any state that
the filter changes during processing. States that the filter does not change
are not affected. Defaults to false the filter does not retain memory
about filtering operations from one to the next. Maintaining memory (setting
PersistentMemory to true) lets you filter large data sets as collections of
smaller subsets and get the same result.
In this example, filter hd first filters data xtot in one pass. Then you can
use hd to filter x as two separate data sets. The results ytot and ysec are
the same in both cases.
xtot=[x,x];
ytot=filter(hd,xtot)
ytot =
0
reset(hm1);
-0.0003
0.0005
-0.0014
0.0028
-0.0054
0.0092
0.0028
-0.0054
0.0092
hm1.PersistentMemory='true';
ysec=[filter(hd,x) filter(hd,x)]
ysec =
0
-0.0003
0.0005
-0.0014
5-81
This test verifies that ysec (the signal filtered by sections) is equal to ytot
(the entire signal filtered at once).
RoundMode
The RoundMode property value specifies the rounding method used for
quantizing numerical values. Specify the RoundMode property values as one
of the following five strings.
RoundMode String
Ceiling
Floor
Nearest
Nearest(Convergent)
Round
Zero
The choice you make affects only the accumulator and output arithmetic.
Coefficient and input arithmetic always round. Finally, products never
overflow they maintain full precision.
ScaleValueFracLength
Filter structures df1sos, df1tsos, df2sos, and df2tsos that use fixed
arithmetic have this property that defines the fraction length applied to
the scale values the filter uses between sections. In combination with
CoeffWordLength, these two properties fully specify how the filter interprets
and uses the scale values stored in the property ScaleValues. As with
fraction length properties, ScaleValueFracLength can be any integer,
5-82
ScaleValues
The ScaleValues property values are specified as a scalar (or vector) that
introduces scaling for inputs (and the outputs from cascaded sections in the
vector case) during filtering:
When you only have a single section in your filter:
5-83
When you apply normalize to a fixed-point filter, the value for the
ScaleValues property is changed accordingly.
It is good practice to choose values for this property that are either positive or
negative powers of two.
Interpreting the ScaleValues Property. When you specify the values of
the ScaleValues property of a quantized filter, the values are entered as a
vector, the length of which is determined by the number of cascaded sections
in your filter:
When you have only one section, the value of the Scalevalues property can
be a scalar or a two-element vector.
When you have L cascaded sections in your filter, the value of the
ScaleValues property can be a scalar or an L+1-element vector.
The following diagram shows how the ScaleValues property values are
applied to a quantized filter with only one section.
The following diagram shows how the ScaleValues property values are
applied to a quantized filter with two sections.
5-84
Signed
When you create a dfilt object for fixed-point filtering (you set the property
Arithmetic to fixed, the property Signed specifies whether the filter
interprets coefficients as signed or unsigned. This setting applies only to the
coefficients. While the default setting is true, meaning that all coefficients
are assumed to be signed, you can change the setting to false after you
create the fixed-point filter.
For example, create a fixed-point direct-form II transposed filter with both
negative and positive coefficients, and then change the property value for
Signed from true to false to see what happens to the negative coefficient
values.
hd=dfilt.df2t(-5:5)
hd =
FilterStructure:
Arithmetic:
Numerator:
Denominator:
PersistentMemory:
States:
'Direct-Form II Transposed'
'double'
[-5 -4 -3 -2 -1 0 1 2 3 4 5]
1
false
[10x1 double]
set(hd,'arithmetic','fixed')
hd.numerator
ans =
-5
-4
-3
-2
-1
5-85
0
4
0
5
set(hd,'signed',false)
hd.numerator
ans =
0
1
0
2
0
3
SosMatrix
When you convert a dfilt object to second-order section form, or create
a second-order section filter, sosMatrix holds the filter coefficients as
property values. Using the double data type by default, the matrix is in
[sections coefficients per section] form, displayed as [15-x-6] for filters with
6 coefficients per section and 15 sections, [15 6].
To demonstrate, the following code creates an order 30 filter using
second-order sections in the direct-form II transposed configuration. Notice
the sosMatrix property contains the coefficients for all the sections.
d = fdesign.lowpass('n,fc',30,0.5);
hd = butter(d);
hd =
FilterStructure: 'Direct-Form II, Second-Order Sections'
Arithmetic: 'double'
sosMatrix: [15x6 double]
ScaleValues: [16x1 double]
PersistentMemory: false
States: [2x15 double]
hd.arithmetic='fixed'
hd =
5-86
FilterStructure:
Arithmetic:
sosMatrix:
ScaleValues:
PersistentMemory:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
SectionInputWordLength: 16
SectionInputAutoScale: true
SectionOutputWordLength: 16
SectionOutputAutoScale: true
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
StateWordLength: 16
StateFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
hd.sosMatrix
ans =
1.0000
2.0000
1.0000
1.0000
0.9005
5-87
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.7294
0.5888
0.4724
0.3755
0.2948
0.2275
0.1716
0.1254
0.0878
0.0576
0.0344
0.0173
0.0062
0.0007
SectionInputAutoScale
Second-order section filters include this property that determines who the
filter handles data in the transitions from one section to the next in the filter.
How the filter represents the data passing from one section to the
next depends on the property value of SectionInputAutoScale. The
representation the filter uses between the filter sections depends on whether
the value of SectionInputAutoScale is true or false.
SectionInputAutoScale = true means the filter chooses the fraction
length to maintain the value of the data between sections as close to the
output values from the previous section as possible. true is the default
setting.
SectionInputAutoScale = false removes the automatic scaling of the
fraction length for the intersection data and exposes the property that
controls the coefficient fraction length (SectionInputFracLength) so
you can change it. For example, if the filter is a second-order, direct
form FIR filter, setting SectionInputAutoScale to false exposes the
5-88
SectionInputFracLength
Second-order section filters use quantizers at the input to each section
of the filter. The quantizers apply to the input data entering each filter
section. Note that the quantizers for each section are the same. To set the
fraction length for interpreting the input values, use the property value in
SectionInputFracLength.
In combination with CoeffWordLength, SectionInputFracLength fully
determines how the filter interprets and uses the state values stored in
the property States. As with all word and fraction length properties,
SectionInputFracLength can be any integer, including integers larger than
CoeffWordLength, and positive or negative integers. 15 bits is the default
value when you create the filter object.
SectionInputWordLength
SOS filters are composed of sections, each one a second-order filter. Filtering
data input to the filter involves passing the data through each filter section.
SectionInputWordLength specifies the word length applied to data as
it enters one filter section from the previous section. Only second-order
implementations of direct-form I transposed and direct-form II transposed
filters include this property.
The following diagram shows an SOS filter composed of sections (the bottom
part of the diagram) and a possible internal structure of each Section (the top
portion of the diagram), in this case a direct form I transposed second order
sections filter structure. Note that the output of each section is fed through
a multiplier. If the gain of the multiplier =1, then the last Cast block of the
Section is ignored, and the format of the output is NumSumQ.
5-89
*DenSumQ
MultiplicandQ
SectionInQ
DenSumQ
*DenSumQ
NumSumQ
*NumSumQ
SectionOutQ
NumProdQ
*NumSumQ
NumStateQ
DenStateQ
DenProdQ
NumProdQ
NumSumQ
DenSumQ
DenQ
*DenSumQ
NumQ
*NumSumQ
NumStateQ
DenStateQ
NumProdQ
DenProdQ
* : only if CastBeforeSum is True
InQ
Input
5-90
SectionInQ
SVQ
Section1
SVQ
Section2
SVQ
Output
OutQ
SectionOutputAutoScale
Second-order section filters include this property that determines who the
filter handles data in the transitions from one section to the next in the filter.
How the filter represents the data passing from one section to the
next depends on the property value of SectionOutputAutoScale. The
representation the filter uses between the filter sections depends on whether
the value of SectionOutputAutoScale is true or false.
SectionOutputAutoScale = true means the filter chooses the fraction
length to maintain the value of the data between sections as close to the
output values from the previous section as possible. true is the default
setting.
SectionOutputAutoScale = false removes the automatic scaling of the
fraction length for the intersection data and exposes the property that
controls the coefficient fraction length (SectionOutputFracLength) so
you can change it. For example, if the filter is a second-order, direct
form FIR filter, setting SectionOutputAutoScale = false exposes the
SectionOutputFracLength property that specifies the fraction length
applied to data between the sections.
SectionOutputFracLength
Second-order section filters use quantizers at the output from each section
of the filter. The quantizers apply to the output data leaving each filter
section. Note that the quantizers for each section are the same. To set the
fraction length for interpreting the output values, use the property value in
SectionOutputFracLength.
In combination with CoeffWordLength, SectionOutputFracLength
determines how the filter interprets and uses the state values stored
in the property States. As with all fraction length properties,
SectionOutputFracLength can be any integer, including integers larger than
CoeffWordLength, and positive or negative integers. 15 bits is the default
value when you create the filter object.
5-91
SectionOutputWordLength
SOS filters are composed of sections, each one a second-order filter. Filtering
data input to the filter involves passing the data through each filter section.
SectionOutputWordLength specifies the word length applied to data as it
leaves one filter section to go to the next. Only second-order implementations
direct-form I transposed and direct-form II transposed filters include this
property.
The following diagram shows an SOS filter composed of sections (the bottom
part of the diagram) and a possible internal structure of each Section (the top
portion of the diagram), in this case a direct form I transposed second order
sections filter structure. Note that the output of each section is fed through
a multiplier. If the gain of the multiplier =1, then the last Cast block of the
Section is ignored, and the format of the output is NumSumQ.
5-92
*DenSumQ
MultiplicandQ
SectionInQ
DenSumQ
*DenSumQ
NumSumQ
*NumSumQ
SectionOutQ
NumProdQ
*NumSumQ
NumStateQ
DenStateQ
DenProdQ
NumProdQ
NumSumQ
DenSumQ
DenQ
*DenSumQ
NumQ
*NumSumQ
NumStateQ
DenStateQ
NumProdQ
DenProdQ
* : only if CastBeforeSum is True
InQ
Input
SectionInQ
SVQ
Section1
SVQ
Section2
SVQ
Output
OutQ
5-93
StateAutoScale
Although all filters use states, some do not allow you to choose whether
the filter automatically scales the state values to prevent overruns or bad
arithmetic errors. You select either of the following settings:
StateAutoScale = true means the filter chooses the fraction length to
maintain the value of the states as close to the double-precision values as
possible. When you change the word length applied to the states (where
allowed by the filter structure), the filter object changes the fraction length
to try to accommodate the change. true is the default setting.
StateAutoScale = false removes the automatic scaling of the fraction
length for the states and exposes the property that controls the coefficient
fraction length so you can change it. For example, in a direct form I
transposed SOS FIR filter, setting StateAutoScale = false exposes the
NumStateFracLength and DenStateFracLength properties that specify
the fraction length applied to states.
Each of the following filter structures provides the StateAutoScale property:
df1t
df1tsos
df2t
df2tsos
dffirt
Other filter structures do not include this property.
StateFracLength
Filter states stored in the property States have both word length and fraction
length. To set the fraction length for interpreting the stored filter object state
values, use the property value in StateFracLength.
5-94
States
Digital filters are dynamic systems. The behavior of dynamic systems (their
response) depends on the input (stimulus) to the system and the current or
previous state of the system. You can say the system has memory or inertia.
All fixed- or floating-point digital filters (as well as analog filters) have states.
Filters use the states to compute the filter output for each input sample, as
well using them while filtering in loops to maintain the filter state between
loop iterations. This toolbox assumes zero-valued initial conditions (the
dynamic system is at rest) by default when you filter the first input sample.
Assuming the states are zero initially does not mean the states are not used;
they are, but arithmetically they do not have any effect.
Filter objects store the state values in the property States. The number of
stored states depends on the filter implementation, since the states represent
the delays in the filter implementation.
When you review the display for a filter object with fixed arithmetic, notice
that the states return an embedded fi object, as you see here.
b = ellip(6,3,50,300/500);
hd=dfilt.dffir(b)
hd =
5-95
hd.arithmetic='fixed'
hd =
CoeffWordLength: 16
CoeffAutoScale: 'on'
Signed: 'on'
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: 'on'
RoundMode: 'convergent'
OverflowMode: 'wrap'
InheritSettings: 'off'
fi objects provide fixed-point support for the filters. To learn more about the
details about fi objects, refer to your Fixed-Point Designer documentation.
The property States lets you use a fi object to define how the filter interprets
the filter states. For example, you can create a fi object in MATLAB, then
assign the object to States, as follows:
statefi=fi([],16,12)
5-96
statefi =
[]
DataTypeMode = Fixed-point: binary point scaling
Signed = true
Wordlength = 16
Fractionlength = 12
This fi object does not have a value associated (notice the [] input argument
to fi for the value), and it has word length of 16 bits and fraction length of 12
bit. Now you can apply statefi to the States property of the filter hd.
set(hd,'States',statefi);
Warning: The 'States' property will be reset to the value
specified at construction before filtering.
Set the 'PersistentMemory' flag to 'True'
to avoid changing this property value.
hd
hd =
FilterStructure: 'Direct-Form FIR'
Arithmetic: 'fixed'
Numerator: [0.0773 0.2938 0.5858 0.7239 0.5858
0.2938 0.0773]
PersistentMemory: false
States: [1x1 embedded.fi]
CoeffWordLength: 16
CoeffAutoScale: 'on'
Signed: 'on'
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
ProductMode: 'FullPrecision'
AccumWordLength: 40
5-97
CastBeforeSum: 'on'
RoundMode: 'convergent'
OverflowMode: 'wrap'
StateWordLength
While all filters use states, some do not allow you to directly change the state
representation the word length and fraction lengths independently. For
the others, StateWordLength specifies the word length, in bits, the filter uses
to represent the states. Filters that do not provide direct state word length
control include:
df1
dfasymfir
dffir
dfsymfir
For these structures, the filter derives the state format from the input format
you choose for the filter except for the df1 IIR filter. In this case, the
numerator state format comes from the input format and the denominator
state format comes from the output format. All other filter structures provide
control of the state format directly.
TapSumFracLength
Direct-form FIR filter objects, both symmetric and antisymmetric, use this
property. To set the fraction length for output from the sum operations that
involve the filter tap weights, use the property value in TapSumFracLength. To
enable this property, set the TapSumMode to SpecifyPrecision in your filter.
As you can see in this code example that creates a fixed-point asymmetric FIR
filter, the TapSumFracLength property becomes available after you change the
TapSumMode property value.
hd=dfilt.dfasymfir
hd =
5-98
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
set(hd,'arithmetic','fixed');
hd
hd =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
TapSumMode: 'KeepMSB'
TapSumWordLength: 17
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
5-99
With the filter now in fixed-point mode, you can change the TapSumMode
property value to SpecifyPrecision, which gives you access to the
TapSumFracLength property.
set(hd,'TapSumMode','SpecifyPrecision');
hd
hd =
FilterStructure:
Arithmetic:
Numerator:
PersistentMemory:
States:
CoeffWordLength: 16
CoeffAutoScale: true
Signed: true
InputWordLength: 16
InputFracLength: 15
OutputWordLength: 16
OutputMode: 'AvoidOverflow'
TapSumMode: 'SpecifyPrecision'
TapSumWordLength: 17
TapSumFracLength: 15
ProductMode: 'FullPrecision'
AccumWordLength: 40
CastBeforeSum: true
RoundMode: 'convergent'
OverflowMode: 'wrap'
5-100
TapSumMode
This property, available only after your filter is in fixed-point mode, specifies
how the filter outputs the results of summation operations that involve the
filter tap weights. Only symmetric (dfilt.dfsymfir) and antisymmetric
(dfilt.dfasymfir) FIR filters use this property.
When available, you select from one of the following values:
FullPrecision means the filter automatically chooses the word length
and fraction length to represent the results of the sum operation so they
retain all of the precision provided by the inputs (addends).
KeepMSB means you specify the word length for representing tap sum
summation results to keep the higher order bits in the data. The filter sets
the fraction length to discard the LSBs from the sum operation. This is
the default property value.
KeepLSB means you specify the word length for representing tap sum
summation results to keep the lower order bits in the data. The filter sets
the fraction length to discard the MSBs from the sum operation. Compare
to the KeepMSB option.
SpecifyPrecision means you specify the word and fraction lengths to
apply to data output from the tap sum operations.
TapSumWordLength
Specifies the word length the filter uses to represent the output from tap
sum operations. The default value is 17 bits. Only dfasymfir and dfsymfir
filters include this property.
5-101
Property Summaries
The following table summarizes the adaptive filter properties and provides a
brief description of each. Full descriptions of each property, in alphabetical
order, are given in the subsequent section.
5-102
Property
Description
Algorithm
AvgFactor
BkwdPredErrorPower
BkwdPrediction
Property
Description
Blocklength
Coefficients
ConversionFactor
Delay
DesiredSignalStates
EpsilonStates
ErrorStates
FFTCoefficients
FFTStates
FilteredInputStates
5-103
5-104
Property
Description
FilterLength
ForgettingFactor
FwdPredErrorPower
FwdPrediction
InitFactor
InvCov
KalmanGain
KalmanGainStates
Property
Description
Leakage
OffsetCov
Offset
Power
ProjectionOrder
ReflectionCoeffs
ReflectionCoeffsStep
PersistentMemory
SecondaryPathCoeffs
SecondaryPathEstimate
5-105
Property
Description
SecondaryPathStates
SqrtCov
SqrtlnvCov
States
StepSize
SwBlockLength
Like dfilt objects, adaptfilt objects have properties that govern their
behavior and store some of the results of filtering operations. The following
pages list, in alphabetical order, the name of every property associated with
adaptfilt objects. Note that not all adaptfilt objects have all of these
properties. To view the properties of a particular adaptive filter, such as an
adaptfilt.bap filter, use get with the object handle, like this:
ha = adaptfilt.bap(32,0.5,4,1.0);
get(ha)
PersistentMemory: false
Algorithm: 'Block Affine Projection FIR Adaptive Filter'
FilterLength: 32
Coefficients: [1x32 double]
5-106
get shows you the properties for ha and the values for the properties.
Entering the object handle returns the same values and properties without
the formatting of the list and the more familiar property names.
AvgFactor
Averaging factor used to compute the exponentially-windowed estimates of the
powers in the transformed signal bins for the coefficient updates. AvgFactor
should lie between zero and one. For default filter objects, AvgFactor equals
(1 - step). lambda is the input argument that represent AvgFactor
BkwdPredErrorPower
Returns the minimum mean-squared prediction error in the backward
direction. Refer to [3] in the bibliography for details about linear prediction.
BkwdPrediction
When you use an adaptive filter that does backward prediction, such as
adaptfilt.ftf, one property of the filter contains the backward prediction
coefficients for the adapted filter. With these coefficient, the forward
coefficients, and the system under test, you have the full set of knowledge of
how the adaptation occurred. Two values stored in properties compose the
BkwdPrediction property:
Coefficients, which contains the coefficients of the system under test, as
determined using backward predictions process.
5-107
= randn(1,500);
= fir1(31,0.5);
= filter(b,1,x)+n;
= 31;
lam = 0.99;
del = 0.1;
% Desired signal
ha = adaptfilt.ftf(32,lam,del);
[y,e] = filter(ha,x,d);
ha
ha =
ha.coefficients
ans =
Columns 1 through 8
-0.0055
5-108
0.0048
0.0045
0.0146
-0.0009
0.0002
-0.0019
0.0008
Columns 9 through 16
-0.0142
-0.0226
0.0234
0.0421
-0.0571
-0.0807
0.1434
0.4620
-0.0879
-0.0501
0.0331
0.0361
-0.0266
-0.0220
-0.0063
-0.0079
0.0032
0.0082
0.0033
0.0065
0.1114
-0.0150
-0.0239
-0.0610
-0.1120
-0.1026
-0.0045
0.0622
0.0997
0.0778
0.0646
-0.0564
0.0057
0.0078
0.1271
-0.0576
0.0037
-0.0200
-0.0033
0.1222
0.0302
-0.0197
-0.1162
0.0285
Columns 17 through 24
0.4564
0.1532
Columns 25 through 32
0.0231
0.0026
ha.bkwdprediction
ans =
>> ha.bkwdprediction.coeffs
ans =
Columns 1 through 8
0.0067
0.0186
Columns 9 through 16
0.0093
-0.0399
Columns 17 through 24
0.0775
0.0814
Columns 25 through 32
-0.0246
0.0180
5-109
Blocklength
Block length for the coefficient updates. This must be a positive integer such
that (l/blocklen) is also an integer. For faster execution, blocklen should
be a power of two. blocklen defaults to two.
Coefficients
Vector containing the initial filter coefficients. It must be a length l vector
where l is the number of filter coefficients. coeffs defaults to length l vector
of zeros when you do not provide the argument for input.
ConversionFactor
Conversion factor defaults to the matrix [1 -1] that specifies soft-constrained
initialization. This is the gamma input argument for some of the fast
transversal algorithms.
Delay
Update delay given in time samples. This scalar should be a positive integer
negative delays do not work. delay defaults to 1 for most algorithms.
DesiredSignalStates
Desired signal states of the adaptive filter. dstates defaults to a zero vector
with length equal to (blocklen - 1) or (swblocklen - 1) depending on the
algorithm.
EpsilonStates
Vector of the epsilon values of the adaptive filter. EpsilonStates defaults to
a vector of zeros with (projectord - 1) elements.
ErrorStates
Vector of the adaptive filter error states. ErrorStates defaults to a zero
vector with length equal to (projectord - 1).
FFTCoefficients
Stores the discrete Fourier transform of the filter coefficients in coeffs.
5-110
FFTStates
Stores the states of the FFT of the filter coefficients during adaptation.
FilteredInputStates
Vector of filtered input states with length equal to l - 1.
FilterLength
Contains the length of the filter. Note that this is not the filter order. Filter
length is 1 greater than filter order. Thus a filter with length equal to 10 has
filter order equal to 9.
ForgettingFactor
Determines how the RLS adaptive filter uses past data in each iteration. You
use the forgetting factor to specify whether old data carries the same weight
in the algorithm as more recent data.
This is a scalar and should lie in the range (0, 1]. It defaults to 1. Setting
forgetting factor = 1 denotes infinite memory while adapting to find the
new filter. Note that this is the lambda input argument.
FwdPredErrorPower
Returns the minimum mean-squared prediction error in the forward direction.
Refer to [3] in the bibliography for details about linear prediction.
FwdPrediction
Contains the predicted values for samples during adaptation. Compare these
to the actual samples to get the error and power.
InitFactor
Returns the soft-constrained initialization factor. This scalar should be
positive and sufficiently large to prevent an excessive number of Kalman
gain rescues. delta defaults to one.
5-111
InvCov
Upper-triangular Cholesky (square root) factor of the input covariance
matrix. Initialize this matrix with a positive definite upper triangular matrix.
Dimensions are l-by-l, where l is the filter length.
KalmanGain
Empty when you construct the object, this gets populated after you run the
filter.
KalmanGainStates
Contains the states of the Kalman gain updates during adaptation.
Leakage
Contains the setting for leakage in the adaptive filter algorithm. Using a
leakage factor that is not 1 forces the weights to adapt even when they have
found the minimum error solution. Forcing the adaptation can improve the
numerical performance of the LMS algorithm.
OffsetCov
Contains the offset covariance matrix.
Offset
Specifies an optional offset for the denominator of the step size normalization
term. You must specify offset to be a scalar greater than or equal to zero.
Nonzero offsets can help avoid a divide-by-near-zero condition that causes
errors.
Use this to avoid dividing by zero or by very small numbers when input signal
amplitude becomes very small, or dividing by very small numbers when any
of the FFT input signal powers become very small. offset defaults to one.
Power
A vector of 2*l elements, each initialized with the value delta from the input
arguments. As you filter data, Power gets updated by the filter process.
5-112
ProjectionOrder
Projection order of the affine projection algorithm. projectord defines the
size of the input signal covariance matrix and defaults to two.
ReflectionCoeffs
For adaptive filters that use reflection coefficients, this property stores them.
ReflectionCoeffsStep
As the adaptive filter changes coefficient values during adaptation, the step
size used between runs is stored here.
PersistentMemory
Determines whether the filter states and coefficients get restored to their
starting values for each filtering operation. The starting values are the values
in place when you create the filter.
PersistentMemory returns to zero any property value that the filter changes
during processing. Property values that the filter does not change are not
affected. Defaults to false.
SecondaryPathCoeffs
A vector that contains the coefficient values of your secondary path from the
output actuator to the error sensor.
SecondaryPathEstimate
An estimate of the secondary path filter model.
SecondaryPathStates
The states of the secondary path filter, the unknown system.
SqrtCov
Upper-triangular Cholesky (square root) factor of the input covariance matrix.
Initialize this matrix with a positive definite upper triangular matrix.
5-113
SqrtInvCov
Square root of the inverse of the sliding window input signal covariance
matrix. This square matrix should be full-ranked.
States
Vector of the adaptive filter states. states defaults to a vector of zeros whose
length depends on the chosen algorithm. Usually the length is a function
of the filter length l and another input argument to the filter object, such
as projectord.
StepSize
Reports the size of the step taken between iterations of the adaptive filter
process. Each adaptfilt object has a default value that best meets the needs
of the algorithm.
SwBlockLength
Block length of the sliding window. This integer must be at least as large as
the filter length. swblocklength defaults to 16.
5-114
Property Summaries
The following table summarizes the multirate filter properties and provides
a brief description of each. Full descriptions of each property are given in
the subsequent section.
Name
Values
Default
Description
BlockLength
Positive integers
100
DecimationFactor
DifferentialDelay
Any integer
5-115
Name
Values
Default
Description
FilterInternals
mfilt structure
string
5-116
None
Name
Values
Default
Description
InputOffset
Integers
InterpolationFactor
Positive integers
NumberOfSections
Numerator
Array of double
values
No default
values
OverflowMode
saturate, [wrap]
wrap
5-117
Name
Values
Default
Description
arithmetic. Coefficient and
input arithmetic always
saturates. Finally, products
never overflow they
maintain full precision.
5-118
PolyphaseAccum
Values depend on
filter type. Either
double, single, or
fixed-point object
PersistentMemory
false or true
false
Name
Values
Default
Description
RateChangeFactors
[ l, m]
[2,3] or [3,2]
States
2-by-2 matrix,
SpecifyWordLengths
Vector of integers
[16 16 16
16] bits
WordLengthPerSection
Any integer or a
vector of length 2*n
16
int32
as a scalar or vector of
length 2*n, where n is the
number of sections. When
WordLengthPerSection is
a scalar, the scalar value
is applied to each filter
section. The default is
16 for each section in the
decimator.
5-119
The following sections provide details about the properties that govern the
way multirate filter work. Creating any multirate filter object puts in place
a number of these properties. The following pages list the mfilt object
properties in alphabetical order.
BlockLength
Length of each block of input data used in the filtering.
mfilt.fftfirinterp objects process data in blocks whose length is
determined by the value you set for the BlockLength property. By default the
property value is 100. When you set the BlockLength value, try choosing a
value so that [BlockLength + length(filter order)] is a power of two.
DecimationFactor
Decimation factor for the filter. m specifies the amount to reduce the sampling
rate of the input signal. It must be an integer. You can enter any integer
value. The default value is 2.
DifferentialDelay
Sets the differential delay for the filter. Usually a value of one or two is
appropriate. While you can set any value, the default is one and the maximum
is usually two.
5-120
FilterInternals
Similar to the FilterInternals pane in FDATool, this property controls whether
the filter sets the output word and fraction lengths automatically, and the
accumulator word and fraction lengths automatically as well, to maintain the
best precision results during filtering. The default value, FullPrecision,
sets automatic word and fraction length determination by the filter. Setting
FilterInternals to SpecifyPrecision exposes the output and accumulator
related properties so you can set your own word and fraction lengths for them.
About FilterInternals Mode. There are four usage modes for this that you
set using the FilterInternals property in multirate filters.
FullPrecision All word and fraction lengths set to Bmax + 1, called
Baccum by Fred Harris in [2]. Full precision is the default setting.
MinWordLengths Minimum Word Lengths
SpecifyWordLengths Specify Word Lengths
SpecifyPrecision Specify Precision
Full Precision
In full precision mode, the word lengths of all sections and the output are set
to Baccum as defined by
5-121
InputWordLength: 16
InputFracLength: 15
FilterInternals: 'FullPrecision'
5-122
FilterInternals: 'MinWordLengths'
OutputWordLength: 16
which are valid CIC filters but the word lengths do not decrease monotonically
across the sections.
Here is the display looks like for the SpecifyWordLengths mode.
FilterStructure: 'Cascaded Integrator-Comb Decimator'
Arithmetic: 'fixed'
DifferentialDelay: 1
NumberOfSections: 2
DecimationFactor: 4
PersistentMemory: false
InputWordLength: 16
InputFracLength: 15
5-123
FilterInternals: 'SpecifyWordLengths'
SectionWordLengths: [19 18 18 17]
OutputWordLength: 16
Specify Precision
In this mode, you have full control over the word length and fraction lengths
of all sections and the filter output.
When you elect the SpecifyPrecision mode, you must enter a vector of
length 2*(NumberOfSections) with elements that represent the word length
for each section. When you enter a scalar such as Baccum, the CIC algorithm
expands that scalar to a vector of the appropriate size and applies the scalar
value to each section and the output. The design does not check that this
vector is monotonically decreasing.
Also, you must enter a vector of length 2*(NumberOfSections) with elements
that represent the fraction length for each section as well. When you enter
a calar such as Baccum, the design applies scalar expansion as done for the
word lengths.
Here is the SpecifyPrecision display.
FilterStructure: 'Cascaded Integrator-Comb Decimator'
Arithmetic: 'fixed'
DifferentialDelay: 1
NumberOfSections: 2
DecimationFactor: 4
PersistentMemory: false
InputWordLength: 16
InputFracLength: 15
FilterInternals: 'SpecifyPrecision'
SectionWordLengths: [19 18 18 17]
SectionFracLengths: [14 13 13 12]
5-124
OutputWordLength: 16
OutputFracLength: 11
FilterStructure
Reports the type of filter object, such as a decimator or fractional integrator.
You cannot set this property it is always read only and results from your
choice of mfilt object. Because of the length of the names of multirate
filters, FilterStructure often returns a vector specification for the string.
For example, when you use mfilt.firfracinterp to design a filter,
FilterStructure returns as [1x49 char].
hm=mfilt.firfracinterp
hm =
FilterStructure:
Numerator:
RateChangeFactors:
PersistentMemory:
States:
[1x49 char]
[1x72 double]
[3 2]
false
[24x1 double]
InputOffset
When you decimate signals whose length is not a multiple of the decimation
factor M, the last samples (nM +1) to [(n+1)(M) -1], where n is an integer
are processed and used to track where the filter stopped processing input data
and when to expect the next output sample. If you think of the filtering process
as generating an output for a block of input data, InputOffset contains a
count of the number of samples in the last incomplete block of input data.
Note InputOffset applies only when you set PersistentMemory to true.
Otherwise, InputOffset is not available for you to use.
Two different cases can arise when you decimate a signal:
5-125
1 The input signal is a multiple of the filter decimation factor. In this case,
the filter processes the input samples and generates output samples for all
inputs as determined by the decimation factor. For example, processing
99 input samples with a filter that decimates by three returns 33 output
samples.
2 The input signal is not a multiple of the decimation factor. When this
occurs, the filter processes all of the input samples, generates output
samples as determined by the decimation factor, and has one or more input
samples that were processed but did not generate an output sample.
For example, when you filter 100 input samples with a filter which has
decimation factor of 3, you get 33 output samples, and 1 sample that did
not generate an output. In this case, InputOffset stores the value 1 after
the filter run.
InputOffset equal to 1 indicates that, if you divide your input signal into
blocks of data with length equal to your filter decimation factor, the filter
processed one sample from a new (incomplete) block of data. Subsequent
inputs to the filter are concatenated with this single sample to form the
next block of length m.
One way to define the value stored in InputOffset is
InputOffset = mod(length(nx),m)
where nx is the number of input samples in the data set and m is the
decimation factor.
Storing InputOffset in the filter allows you to stop filtering a signal at
any point and start over from there, provided that the PersistentMemory
property is set to true. Being able to resume filtering after stopping a
signal lets you break large data sets in to smaller pieces for filtering. With
PersistentMemory set to true and the InputOffset property in the filter,
breaking a signal into sections of arbitrary length and filtering the sections
is equivalent to filtering the entire signal at once.
xtot=[x,x];
ytot=filter(hm1,xtot)
ytot =
5-126
0
reset(hm1);
-0.0003
0.0005
-0.0014
0.0028
-0.0054
0.0092
0.0028
-0.0054
0.0092
hm1.PersistentMemory='true';
ysec=[filter(hm1,x) filter(hm1,x)]
ysec =
0
-0.0003
0.0005
-0.0014
This test verifies that ysec (the signal filtered by sections) is equal to ytot
(the entire signal filtered at once).
InterpolationFactor
Amount to increase the sampling rate. Interpolation factor for the filter.
It specifies the amount to increase the input sampling rate. It must be an
integer. Two is the default value. You may use any positive value.
NumberOfSections
Number of sections used in the multirate filter. By default multirate filters
use two sections, but any positive integer works.
OverflowMode
The OverflowMode property is specified as one of the following two strings
indicating how to respond to overflows in fixed-point arithmetic:
'saturate' saturate overflows.
When the values of data to be quantized lie outside of the range of the
largest and smallest representable numbers (as specified by the applicable
word length and fraction length properties), these values are quantized to
the value of either the largest or smallest representable value, depending
on which is closest.
'wrap' wrap all overflows to the range of representable values.
When the values of data to be quantized lie outside of the range of the
largest and smallest representable numbers (as specified by the data format
properties), these values are wrapped back into that range using modular
5-127
PolyphaseAccum
The idea behind PolyphaseAccum and AccumWordLength/AccumFracLength
is to distinguish between the adders that always work in full precision
(PolyphaseAccum) from the others [the adders that are controlled by the
user (through AccumWordLength and AccumFracLength) and that may
introduce quantization effects when you set property FilterInternals to
SpecifyPrecision].
Given a product format determined by the input word and fraction
lengths, and the coefficients word and fraction lengths, doing full precision
accumulation means allowing enough guard bits to avoid overflows and
underflows.
Property PolyphaseAccum stores the value that was in the accumulator the
last time your filter ran out of input samples to process. The default value for
PolyphaseAccum affects the next output only if PersistentMemory is true
and InputOffset is not equal to 0.
PolyphaseAccum stores data in the format for the filter arithmetic.
Double-precision filters store doubles in PolyphaseAccum. Single-precision
5-128
PersistentMemory
Determine whether the filter states get restored to their starting values for
each filtering operation. The starting values are the values in place when you
create the filter if you have not changed the filter since you constructed it.
PersistentMemory returns to zero any state that the filter changes during
processing. States that the filter does not change are not affected.
Determine whether the filter states get restored to their starting values for
each filtering operation. The starting values are the values in place when you
create the filter object. PersistentMemory returns to zero any state that the
filter changes during processing. States that the filter does not change are
not affected. Defaults to true the filter retains memory about filtering
operations from one to the next. Maintaining memory lets you filter large
data sets as collections of smaller subsets and get the same result.
xtot=[x,x];
ytot=filter(hm1,xtot)
ytot =
0
reset(hm1);
-0.0003
0.0005
-0.0014
0.0028
-0.0054
0.0092
0.0028
-0.0054
0.0092
hm1.PersistentMemory='true';
ysec=[filter(hm1,x) filter(hm1,x)]
ysec =
0
-0.0003
0.0005
-0.0014
This test verifies that ysec (the signal filtered by sections) is equal to ytot
(the entire signal filtered at once).
RateChangeFactors
Reports the decimation (m) and interpolation (l) factors for the filter object
when you create fractional integrators and decimators, although m and l
are used as arguments to both decimators and integrators, applying the
5-129
States
Stored conditions for the filter, including values for the integrator and comb
sections. m is the differential delay and n is the number of sections in the filter.
About the States of Multirate Filters. In the states property you find
the states for both the integrator and comb portions of the filter, stored in a
filtstates object. states is a matrix of dimensions m+1-by-n, with the states
in CIC filters apportioned as follows:
States for the integrator portion of the filter are stored in the first row
of the state matrix.
States for the comb portion fill the remaining rows in the state matrix.
In the state matrix, state values are specified and stored in double format.
States stores conditions for the delays between each interpolator phase, the
filter states, and the states at the output of each phase in the filter, including
values for the interpolator and comb states.
The number of states is (lh-1)*m+(l-1)*(lo+mo) where lh is the length of each
subfilter, and l and m are the interpolation and decimation factors. lo and mo,
the input and output delays between each interpolation phase, are integers
from Euclids theorem such that lo*l-mo*m = -1 (refer to the reference for more
details). Use euclidfactors to get lo and mo for an mfilt.firfracdecim
object.
States defaults to a vector of zeros that has length equal to nstates(hm)
5-130
5-131
5-132
Glossary
Glossary
This glossary defines terms related to fixed-point data types and numbers.
These terms may appear in some or all of the documents that describe
MathWorks products that have fixed-point support.
arithmetic shift
Shift of the bits of a binary word for which the sign bit is recycled for
each bit shift to the right. A zero is incorporated into the least significant
bit of the word for each bit shift to the left. In the absence of overflows,
each arithmetic shift to the right is equivalent to a division by 2, and
each arithmetic shift to the left is equivalent to a multiplication by 2.
See also binary point, binary word, bit, logical shift, most significant bit
bias
Glossary-1
Glossary
binary point
Symbol in the shape of a period that separates the integer and fractional
parts of a binary number. Bits to the left of the binary point are
integer bits and/or sign bits, and bits to the right of the binary point
are fractional bits.
See also binary number, bit, fraction, integer, radix point
binary point-only scaling
Scaling of a binary number that results from shifting the binary point of
the number right or left, and which therefore can only occur by powers
of two.
See also binary number, binary point, scaling
binary word
Fixed-length sequence of bits (1s and 0s). In digital hardware, numbers
are stored in binary words. The way in which hardware components or
software functions interpret this sequence of 1s and 0s is described
by a data type.
See also bit, data type, word
bit
Glossary-2
Glossary
.0000
0.000
00.00
000.0
0000.
See also data type, noncontiguous binary point, word length
convergent rounding
Rounding mode that rounds to the nearest allowable quantized value.
Numbers that are exactly halfway between the two nearest allowable
quantized values are rounded up only if the least significant bit (after
rounding) would be set to 0.
See also ceiling (round toward), floor (round toward), nearest (round
toward), rounding, truncation, zero (round toward)
data type
Set of characteristics that define a group of values. A fixed-point data
type is defined by its word length, its fraction length, and whether it
is signed or unsigned. A floating-point data type is defined by its word
length and whether it is signed or unsigned.
See also fixed-point representation, floating-point representation,
fraction length, signedness, word length
data type override
Parameter in the Fixed-Point Tool that allows you to set the output data
type and scaling of fixed-point blocks on a system or subsystem level.
See also data type, scaling
exponent
Part of the numerical representation used to express a floating-point or
fixed-point number.
Glossary-3
Glossary
Glossary-4
Glossary
floating-point representation
Method for representing numerical values and data types that can have
changing range and precision.
1. Floating-point numbers can be represented as
Glossary-5
Glossary
fractional slope
Part of the numerical representation used to express a fixed-point
number. Fixed-point numbers can be represented as
Glossary-6
Glossary
2. Also called the "stored integer." The raw binary number, in which the
binary point is assumed to be at the far right of the word. The integer
is part of the numerical representation used to express a fixed-point
number. Fixed-point numbers can be represented as
Glossary-7
Glossary
logical shift
Shift of the bits of a binary word, for which a zero is incorporated into
the most significant bit for each bit shift to the right and into the least
significant bit for each bit shift to the left.
See also arithmetic shift, binary point, binary word, bit, most significant
bit
mantissa
Part of the numerical representation used to express a floating-point
number. Floating-point numbers are typically represented as
Glossary-8
Glossary
0000 .
thereby giving the bits of the word the following potential values:
25 24 23 22 .
See also binary point, data type, word length
ones complement representation
Representation of signed fixed-point numbers. Negating a binary
number in ones complement requires a bitwise complement. That is, all
0s are flipped to 1s and all 1s are flipped to 0s. In ones complement
notation there are two ways to represent zero. A binary word of all
0s represents "positive" zero, while a binary word of all 1s represents
"negative" zero.
See also binary number, binary word, sign/magnitude representation,
signed fixed-point, twos complement representation
overflow
Situation that occurs when the magnitude of a calculation result is too
large for the range of the data type being used. In many cases you can
choose to either saturate or wrap overflows.
See also saturation, wrapping
padding
Extending the least significant bit of a binary word with one or more
zeros.
See also least significant bit
precision
1. Measure of the smallest numerical interval that a fixed-point data
type and scaling can represent, determined by the value of the numbers
least significant bit. The precision is given by the slope, or the number
Glossary-9
Glossary
Qm.n
where
Q indicates that the number is in Q format.
m is the number of bits used to designate the twos complement
integer part of the number.
n is the number of bits used to designate the twos complement
fractional part of the number, or the number of bits to the right
of the binary point.
In Q format notation, the most significant bit is assumed to be the sign
bit.
See also binary point, bit, data type, fixed-point representation, fraction,
integer, twos complement
quantization
Representation of a value by a data type that has too few bits to
represent it exactly.
See also bit, data type, quantization error
quantization error
Error introduced when a value is represented by a data type that has
too few bits to represent it exactly, or when a value is converted from
Glossary-10
Glossary
one data type to a shorter data type. Quantization error is also called
quantization noise.
See also bit, data type, quantization
radix point
Symbol in the shape of a period that separates the integer and fractional
parts of a number in any base system. Bits to the left of the radix point
are integer and/or sign bits, and bits to the right of the radix point are
fraction bits.
See also binary point, bit, fraction, integer, sign bit
range
Span of numbers that a certain data type can represent.
See also data type, full range, precision, representable range
Glossary-11
Glossary
range analysis
Static analysis of model to derive minimum and maximum range values
for elements in the model. The software statically analyzes the ranges
of the individual computations in the model based on specified design
ranges, inputs, and the semantics of the calculation.
real-world value
Stored integer value with fixed-point scaling applied. Fixed-point
numbers can be represented as
Glossary-12
Glossary
See also bit, ceiling (round toward), convergent rounding, floor (round
toward), least significant bit, nearest (round toward), precision,
truncation, zero (round toward)
saturation
Method of handling numeric overflow that represents positive overflows
as the largest positive number in the range of the data type being used,
and negative overflows as the largest negative number in the range.
See also overflow, wrapping
scaled double
A double data type that retains fixed-point scaling information. For
example, in Simulink and Fixed-Point Designer software you can use
data type override to convert your fixed-point data types to scaled
doubles. You can then simulate to determine the ideal floating-point
behavior of your system. After you gather that information you can
turn data type override off to return to fixed-point data types, and your
quantities still have their original scaling information because it was
held in the scaled double data types.
scaling
1. Format used for a fixed-point number of a given word length and
signedness. The slope and bias together form the scaling of a fixed-point
number.
2. Changing the slope and/or bias of a fixed-point number without
changing the stored integer.
See also bias, fixed-point representation, integer, slope
shift
Movement of the bits of a binary word either toward the most significant
bit ("to the left") or toward the least significant bit ("to the right"). Shifts
to the right can be either logical, where the spaces emptied at the front
of the word with each shift are filled in with zeros, or arithmetic, where
the word is sign extended as it is shifted to the right.
See also arithmetic shift, logical shift, sign extension
Glossary-13
Glossary
sign bit
Bit (or bits) in a signed binary number that indicates whether the
number is positive or negative.
See also binary number, bit
sign extension
Addition of bits that have the value of the most significant bit to the
high end of a twos complement number. Sign extension does not change
the value of the binary number.
See also binary number, guard bits, most significant bit, twos
complement representation, word
Glossary-14
Glossary
sign/magnitude representation
Representation of signed fixed-point or floating-point numbers. In
sign/magnitude representation, one bit of a binary word is always
the dedicated sign bit, while the remaining bits of the word encode
the magnitude of the number. Negation using sign/magnitude
representation consists of flipping the sign bit from 0 (positive) to 1
(negative), or from 1 to 0.
See also binary word, bit, fixed-point representation, floating-point
representation, ones complement representation, sign bit, signed
fixed-point, signedness, twos complement representation
signed fixed-point
Fixed-point number or data type that can represent both positive and
negative numbers.
See also data type, fixed-point representation, signedness, unsigned
fixed-point
signedness
The signedness of a number or data type can be signed or unsigned.
Signed numbers and data types can represent both positive and negative
values, whereas unsigned numbers and data types can only represent
values that are greater than or equal to zero.
See also data type, sign bit, sign/magnitude representation, signed
fixed-point, unsigned fixed-point
slope
Part of the numerical representation used to express a fixed-point
number. Along with the bias, the slope forms the scaling of a fixed-point
number. Fixed-point numbers can be represented as
Glossary-15
Glossary
Glossary-16
Glossary
truncation
Rounding mode that drops one or more least significant bits from a
number.
See also ceiling (round toward), convergent rounding, floor (round
toward), nearest (round toward), rounding, zero (round toward)
Glossary-17
Glossary
Glossary-18