Skip to Main Content Skip to Search
Product Documentation

conv - Convolution and polynomial multiplication of fi objects

Syntax

c = conv(a,b)
c = conv(a,b,'shape')

Description

c = conv(a,b) outputs the convolution of input vectors a and b, at least one of which must be a fi object.

c = conv(a,b,'shape') returns a subsection of the convolution, as specified by the shape parameter:

The fimath properties associated with the inputs determine the numerictype properties of output fi object c:

If either input is a built-in data type, conv casts it into a fi object using best-precision rules before the performing the convolution operation.

The output fi object c always uses the default fimath.

Refer to the MATLAB conv reference page for more information on the convolution algorithm.

Examples

The following example illustrates the convolution of a 22-sample sequence with a 16-tap FIR filter.

  u = (pi/4)*[1 1 1 -1 -1 -1 1 -1 -1 1 -1]; 
  x = fi(kron(u,[1 1]));
  h = firls(15, [0 .1 .2 .5]*2, [1 1 0 0]);

Because x is a fi object, you do not need to cast h into a fi object before performing the convolution operation. The conv function does so using best-precision scaling.

Finally, use the conv function to convolve the two vectors:

 y = conv(x,h);

The operation results in a signed fi object y with a word length of 36 bits and a fraction length of 31 bits. The default fimath properties associated with the inputs determine the numerictype of the output. The output does not have a local fimath.

See Also

conv

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS