sum_by_weight

Syntax

Description

Calculates the weighted sum. weights specifies the weight vector, and elements is an array of the values of all the elements.

The weighted sum is

s=i=1nwixi

where wi is the weight of the i-th value xi, and i=1,2,,n.

Examples

Input Arguments

weights —— The weight vector, specified as an array of positive numeric scalar of length n.

And it should satisfy

i=1nwi=1,wi>0

elements —— Array of values of all the elements, specified as an array of length n.

 

Properties of Arguments

Name of the parametersIs optional?Source, dialog or input port?
weightsNoInput port
elementsNoInput port