Documentation

时代

Element-by-element multiplication offiobjects

Syntax

C =A.*B
C = times(A, B)

Description

example

C=A.*Bperforms element-by-element multiplication ofAB, and returns the result inC.

C= times(A,B)is an alternate way to executeA.*B.

Examples

collapse all

Use the时代function to perform element-by-element multiplication of afiobject and a scalar.

= 4;b = fi ([2 4 7; 9 0 2])
b = 2 4 7 9 0 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 11

ais a scalar double, andbis a matrix offiobjects. When doing arithmetic between afi两倍,两倍被铸成fiwith the same word length and signedness of thefi和最佳精确分数长度。操作的结果是fi.

c=a.*b
c = 8 16 28 36 0 8 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 23

During the operation,awas cast to afiobject with wordlength 16. The output,c, is afiobject with word length 32, the sum of the word lengths of the two multiplicands,ab. This is because the default setting ofProductModeinfimathisFullPrecision.

Use the时代function to perform element-by-element multiplication of twofiobjects.

a=fi([5 9 9; 1 2 -3], 1, 16, 3)
a = 5 9 9 1 2 -3 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 3
b = fi ([2 4 7; 9 0 2], 1, 16, 3)
b = 2 4 7 9 0 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 3
c=a.*b
c = 10 36 63 9 0 -6 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 6

单词长度和分数的长度care equal to the sums of the word lengths and fraction lengths ofab. This is because the default setting ofProductModeinfimathisFullPrecision.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array offiobjects or built-in types.AB除非一个标量值,否则必须具有相同的维度。

Data Types:fi|single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Complex Number Support: Yes

Input array, specified as a scalar, vector, matrix, or multidimensional array offiobjects or built-in types.AB除非一个标量值,否则必须具有相同的维度。

Data Types:fi|single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Complex Number Support: Yes

Output Arguments

collapse all

Output array, specified as a scalar, vector, matrix or multidimensional array.

Extended Capabilities

See Also

|||

Introduced before R2006a

Was this topic helpful?