times, .*
Element-by-element multiplication of fi objects
Syntax
Description
Examples
Use the times function to perform element-by-element multiplication of a fi object and a scalar.
a=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
a is a scalar double, and b is a matrix of fi objects. When doing arithmetic between a fi and a double, the double is cast to a fi with the same word length and signedness of the fi, and best-precision fraction length. The result of the operation is a 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, a was cast to a fi object with wordlength 16. The output, c, is a fi object with word length 32, the sum of the word lengths of the two multiplicands, a and b. This is because the default setting of ProductMode in fimath is FullPrecision.
Use the times function to perform element-by-element multiplication of two fi objects.
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
The word length and fraction length of c are equal to the sums of the word lengths and fraction lengths of a and b. This is because the default setting of ProductMode in fimath is FullPrecision.
Input Arguments
Input array, specified as a scalar, vector, matrix, or multidimensional
array of fi objects or built-in data types. Inputs
A and B must either be the
same size or have sizes that are compatible. For more information, see Compatible Array Sizes for Basic Operations.
times does not support fi
objects of data type boolean.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes
Input array, specified as a scalar, vector, matrix, or multidimensional
array of fi objects or built-in data types. Inputs
A and B must either be the
same size or have sizes that are compatible. For more information, see Compatible Array Sizes for Basic Operations.
times does not support fi
objects of data type boolean.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes
Extended Capabilities
Usage notes and limitations:
Any non-
fiinput must be constant; that is, its value must be known at compile time so that it can be cast to afiobject.When you provide complex inputs to the
timesfunction inside of a MATLAB Function block, you must declare the input as complex before running the simulation. To do so, go to the Model Explorer and set the Complexity parameter for all known complex inputs toOn.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
Version History
Introduced before R2006aStarting in R2021b with the addition of implicit expansion for
fi
times, plus, and
minus, some combinations of arguments for basic operations
that previously returned errors now produce results.
If your code uses element-wise operators and relies on the errors that MATLAB® previously returned for mismatched sizes, particularly within a
try/catch block, then your code might no longer catch those
errors.
For more information on the required input sizes for basic array operations, see Compatible Array Sizes for Basic Operations.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)