Main Content

La traduzione di questa pagina non è aggiornata. Fai clic qui per vedere l'ultima versione in inglese.

Operazioni aritmetiche

Addizione, sottrazione, moltiplicazione, divisione, potenza, arrotondamento

Le funzioni aritmetiche includono operatori per operazioni semplici come l'addizione e la moltiplicazione, oltre a funzioni per calcoli comuni come la somma, le sommatorie mobili, le operazioni modulo e l'arrotondamento.

Per maggiori informazioni, vedere Array vs. Matrix Operations.

Funzioni

espandi tutto

Addizione

+Add numbers, append strings
sumSommare gli elementi dell’array
cumsumCumulative sum
movsumMoving sum

Sottrazione

-Subtraction
diffDifferenze e derivate approssimate

Moltiplicazione

.*Multiplication
*Matrix multiplication
prodProduct of array elements
cumprodCumulative product
pagemtimesPage-wise matrix multiplication (Da R2020b)
tensorprodTensor products between two tensors (Da R2022a)

Divisione

./Right array division
.\Left array division
/Solve systems of linear equations xA = B for x
\Solve systems of linear equations Ax = B for x
pagemldividePage-wise left matrix divide (Da R2022a)
pagemrdividePage-wise right matrix divide (Da R2022a)

Potenze

.^Element-wise power
^Matrix power

Trasposizione

.'Trasporre un vettore o una matrice
'Complex conjugate transpose
pagetransposePage-wise transpose (Da R2020b)
pagectransposePage-wise complex conjugate transpose (Da R2020b)

Segno dell’array

uminusUnary minus
uplusUnary plus
modIl resto dopo la divisione (operazione modulo)
remResto dopo la divisione
idivideInteger division with rounding option
ceilArrotondare verso l'infinito positivo
fixArrotondare verso lo zero
floorArrotondare verso l’infinito negativo
roundArrotondare al decimale o al numero intero più vicino
bsxfunApply element-wise operation to two arrays with implicit expansion enabled

Argomenti

  • Array vs. Matrix Operations

    Matrix operations follow the rules of linear algebra, and array operations execute element by element operations and support multidimensional arrays. The period character (.) distinguishes the array operations from the matrix operations.

  • Compatible Array Sizes for Basic Operations

    Most binary operators and functions in MATLAB® support numeric arrays that have compatible sizes. Two inputs have compatible sizes if, for every dimension, the dimension sizes of the inputs are either the same or one of them is 1.

  • Operator Precedence

    Precedence rules determine the order in which MATLAB evaluates an expression.

  • Floating-Point Numbers

    MATLAB represents floating-point numbers in either double-precision or single-precision format. The default is double precision.

  • Integers

    MATLAB supports 1-, 2-, 4-, and 8-byte storage for integer data. If you use the smallest integer type that accommodates your data, you can save memory and program execution time.