Main Content

dsp.Convolver

(Removed) Convolution of two signals

dsp.Convolver has been removed. Use conv instead. For more information, see Compatibility Considerations.

Description

The dsp.Convolver System object™ convolves the first dimension of an N-D input array, u, with the first dimension of an N-D input array, v. You can convolve the inputs in the time domain or frequency domain. In the time domain, the object convolves the first input with the second input. In the frequency domain, the object multiplies the Fourier transforms of both the inputs, and computes the inverse Fourier transform of the product. In this domain, depending on the input length, the object can require fewer computations. For more information on the two computation methods, see Algorithms.

To convolve two inputs:

  1. Create the dsp.Convolver object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

cnv = dsp.Convolver creates a convolution System object, cnv, to convolve two inputs in the time domain or frequency domain.

cnv = dsp.Convolver(Name,Value) creates a convolution System object, cnv, with each specified property set to the specified value. Enclose each property name in single quotes.

Example: cnv = dsp.Convolver('Method','Frequency Domain')

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Domain in which the System object computes convolutions, specified as one of the following:

  • 'Time Domain' –– Computes the convolutions in the time domain, which minimizes memory usage. For more information, see Time-Domain Computation.

  • 'Frequency Domain' –– Computes the convolutions in the frequency domain, which can require fewer computations depending on the input length. For more information, see Frequency-Domain Computation.

  • 'Fastest' –– Computes the convolutions in the domain that minimizes the number of computations.

Note

Fixed-point signals are supported for the time domain only. To use the following fixed-point properties, set Method to 'Time Domain'.

Fixed-Point Properties

Flag to use full-precision rules for fixed-point arithmetic, specified as one of the following:

  • true –– The object computes all internal arithmetic and output data types using the full-precision rules. These rules provide the most accurate fixed-point numerics. In this mode, other fixed-point properties do not apply. No quantization occurs within the object. Bits are added, as needed, to ensure that no roundoff or overflow occurs.

  • false –– Fixed-point data types are controlled through individual fixed-point property settings.

For more information, see Full Precision for Fixed-Point System Objects and Set System Object Fixed-Point Properties.

Select the rounding mode for fixed-point operations.

Dependencies

This property applies when you set the FullprecisionOverride property to false and at least one of the ProductDataType, AccumulatorDataType, and OutputDataType properties to any option other than 'Full precision'.

The overflow action for fixed-point operations, specified as one of the following:

  • 'Wrap' –– The object wraps the result of its fixed-point operations.

  • 'Saturate' –– The object saturates the result of its fixed-point operations.

For more details on overflow actions, see overflow mode for fixed-point operations.

Dependencies

This property applies when you set the FullprecisionOverride property to false and at least one of the ProductDataType, AccumulatorDataType, and OutputDataType properties to any option other than 'Full precision'.

Data type of the output of a product operation in the dsp.Convolver object, specified as one of the following:

  • 'Full precision' –– The object computes the product output data type using the full-precision rules. These rules provide the most accurate fixed-point numerics. No quantization occurs. Bits are added, as needed, to ensure that no roundoff or overflow occurs.

  • 'Custom' –– The product output data type is specified as a custom numeric type through the CustomProductDataType property. The rounding method and the overflow action are specified through the RoundingMethod and OverflowAction properties.

  • 'Same as first input' –– The object specifies the product output data type to be the same as the first input data type.

For more information on the product output data type, see the Fixed Point section.

The product output data type, specified as an autosigned numeric type with a word length of 32 and a fraction length of 30.

Dependencies

This property applies only when you set ProductDataType to 'Custom'.

Data type of the output of an accumulation operation in the dsp.Convolver object, specified as one of the following:

  • 'Full precision' –– The object computes the accumulator data type using the full precision rules. These rules provide the most accurate fixed-point numerics. No quantization occurs. Bits are added, as needed, to ensure that no roundoff or overflow occurs.

  • 'Custom' –– The accumulator data type is specified as a custom numeric type through the CustomAccumulatorDataType property. The rounding method and the overflow action are specified through the RoundingMethod and the OverflowAction properties.

  • 'Same as first input' –– The object specifies the accumulator data type to be the same as the first input data type.

  • 'Same as product' –– The object specifies the accumulator data type to be the same as the product data type.

For more information on the accumulator data type, see the Fixed Point section.

The accumulator data type, specified as an auto signed numeric type with a word length of 32 and a fraction length of 30.

Dependencies

This property applies only when you set AccumulatorDataType to 'Custom'.

Data type of the output of the dsp.Convolver object, specified as one of the following:

  • 'Same as accumulator' –– The object specifies the output data type to be the same as the accumulator data type. For more details on the accumulator data type, see the AccumulatorDataType property.

  • 'Custom' –– The output data type is specified as a custom numeric type through the CustomOutputDataType property. The rounding method and the overflow action are specified through the RoundingMethod and the OverflowAction properties.

  • 'Same as first input' –– The object specifies the output data type to be the same as the first input data type.

  • 'Same as product' –– The object specifies the output data type to be the same as the product data type.

For more information on the output data type, see the Fixed Point section.

The output data type, specified as an autosigned numeric type with a word length of 16 and a fraction length of 15.

Dependencies

This property applies only when you set OutputDataType to 'Custom'.

Usage

Description

example

cnvOut = cnv(input1, input2) convolves the two inputs, input1 and input2, along their first dimensions, and returns the convolved output, cnvOut.

Input Arguments

expand all

First data input, specified as a vector, matrix, or N-D array. If the input is a matrix or an array, all the dimensions of both the inputs, except for the first dimension, must be the same.

Example: ones(10,3,2)

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi
Complex Number Support: Yes

Second data input, specified as a vector, matrix, or N-D array. If the input is a matrix or an array, all the dimensions of both the inputs, except for the first dimension, must be the same.

Example: randn(4,3,2)

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi
Complex Number Support: Yes

Output Arguments

expand all

The convolved output of the two inputs, returned as a vector, matrix, or N-D array.

  • When both inputs are N-D arrays, the size of their first dimension can differ, but the size of all other dimensions must be equal. For example, when u is an Mu-by-N-by-P array, and v is an Mv-by-N-by-P array, the output is an (Mu+Mv–1)-by-N-by-P array.

  • When one input is a column vector and the other is an N-D array, the object independently convolves the vector with the first dimension of the N-D input array. For example, when u is an Mu-by-1 column vector and v is an Mv-by-N matrix, the output is an (Mu+Mv–1)-by-N matrix.

  • When u and v are column vectors with lengths Mu and Mv, the object performs the vector convolution. The output is an (Mu+Mv–1)-by-1 column vector.

When both the inputs are real, the output is real. When one or both inputs are complex, the output is complex.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create a dsp.Convolver object.

conv = dsp.Convolver
conv = 
  dsp.Convolver with properties:

    Method: 'Time Domain'

  Show all properties

Convolve two rectangular sequences.

x = ones(10,1);
y = conv(x,x);

Plot the resulting convolved sequence, which is a triangular sequence.

plot(y)

More About

expand all

Algorithms

expand all

Extended Capabilities

Version History

Introduced in R2012a

expand all

R2023a: dsp.Convolver System object has been removed

The dsp.Convolver System object has been removed. Use the conv function instead.

Update Code

This table shows how to update existing code to use the conv function.

Discouraged UsageRecommended Replacement
cv = dsp.Convolver;
x = ones(10,1);
yobj = cv(x,x);
yfn = conv(x,x);
isequal(yobj,yfn)
ans =

  logical

   1

Run the code and plot the vectors yobj and yfn using the plot function. Verify that the plots match.

See Also

Functions

Blocks