Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

### Contents

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

# times, .*

Element-wise multiplication

## Description

example

C = A.*B multiplies arrays A and B element by element and returns the result in C.

C = times(A,B) is an alternate way to execute A.*B, but is rarely used. It enables operator overloading for classes.

## Examples

expand all

### Multiply Two Vectors

Create two vectors, A and B, and multiply them element by element.

```A = [1 0 3];
B = [2 3 7];
C = A.*B```
```C =

2     0    21```

### Multiply Two Arrays

Create two 3-by-3 arrays, A and B, and multiply them element by element.

```A = [1 0 3; 5 3 8; 2 4 6];
B = [2 3 7; 9 1 5; 8 8 3];
C = A.*B```
```C =

2     0    21
45     3    40
16    32    18```

## Input Arguments

expand all

### A — Left arrayscalar | vector | matrix | multidimensional array

Left array, specified as a scalar, vector, matrix, or multidimensional array. Inputs A and B must be the same size unless one is a scalar. A scalar value expands into an array of the same size as the other input.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char
Complex Number Support: Yes

### B — Right arrayscalar | vector | matrix | multidimensional array

Right array, specified as a scalar, vector, matrix, or multidimensional array. Inputs A and B must be the same size unless one is a scalar. A scalar value expands into an array of the same size as the other input.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char
Complex Number Support: Yes

## See Also

Was this topic helpful?