Main Content

dsp.ArrayVectorDivider

(Removed) Divide array by vector along specified dimension

dsp.ArrayVectorDivider has been removed. Use the ./ operator instead. For more information, see Compatibility Considerations.

Description

The ArrayVectorDivider object divides an array by a vector along a specified dimension.

To divide an array by a vector along a specified dimension:

  1. Define and set up your array-vector division object. See Construction.

  2. Call step to divide the array according to the properties of dsp.ArrayVectorDivider. The behavior of step is specific to each object in the toolbox.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

avd = dsp.ArrayVectorDivider returns an array-vector division object, avd, that divides an input array by the elements of a vector along the first dimension of the array.

avd = dsp.ArrayVectorDivider('PropertyName',PropertyValue,...) returns an array-vector division object, avd, with each property set to the specified value.

Properties

Dimension

Dimension along which to divide input by vector elements

Specify the dimension along which to divide the input array by the elements of a vector as a positive integer. The default is 1.

VectorSource

Source of vector

Specify the source of the vector values as | Input port | Property |. The default is Input port.

Vector

Vector values

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

Methods

stepDivide array by vector
Common to All System Objects
release

Allow System object property value changes

Examples

collapse all

Note

If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

avd = dsp.ArrayVectorDivider;
a = ones(2);
x = [2 3]';
y = avd(a, x)
y = 2×2

    0.5000    0.5000
    0.3333    0.3333

Algorithms

This object implements the algorithm, inputs, and outputs described on the Array-Vector Divide block reference page. The object properties correspond to the block parameters, except:

The array-vector division object does not have Minimum or Maximum options for data output.

Extended Capabilities

Version History

Introduced in R2012a

expand all

R2023a: dsp.ArrayVectorDivider System object has been removed

The dsp.ArrayVectorDivider System object has been removed. Use the ./ operator instead.

Update Code

This table shows how to update existing code to use the ./ operator.

Discouraged UsageRecommended Replacement

Divide along first dimension (column-wise)

avd = dsp.ArrayVectorDivider(Dimension=1);
a = ones(2);
x = [2;3];
y = avd(a,x)
y = 2×2

     0.5    0.5
     0.333  0.333

Divide along first dimension (column-wise)

y = a ./ x
y = 2×2

     0.5    0.5
     0.333  0.333

Divide along second dimension (row-wise)

avd = dsp.ArrayVectorDivider(Dimension=2);
a = ones(2);
x = [2;3];
y = avd(a,x)
y = 2×2

     0.5   0.333
     0.5   0.333

Divide along second dimension (row-wise)

y = a ./ x'
y = 2×2

     0.5   0.333
     0.5   0.333

Divide along Nth dimension

d = [3 10 2 3 4];
a = randn(d);

Divide the array with a vector along the fourth dimension.

N = 4;
avd = dsp.ArrayVectorDivider(Dimension=N);
x = randn(1,d(N));
y = avd(a,x);

Divide along Nth dimension

C = repmat({1},1,length(d));
C{N} = ':';
xN(C{:}) = x;
yNew = a ./ xN
all(y == yNew,'all')
ans =

  logical

   1