OKPEDIA MATLAB EN VETTORI

Vector Division by a Scalar in MATLAB and Octave

n MATLAB and Octave, dividing a vector by a scalar is achieved using the division arithmetic operator:

v/n

Here, "v" represents the vector and "n" denotes the scalar value.

Performing this operation yields another vector.

$$ \frac{ \vec{v} }{n} = \begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix} \cdot \frac{1}{n} = \begin{pmatrix} \frac{a_1}{n} \\ \frac{a_2}{n} \\ \frac{a_3}{n} \end{pmatrix} $$

Each component of the vector "v" is individually divided by the scalar "n".

Example

Let's define a vector

>> v=[2;4;6]
v =
2
4
6

The resulting output is another vector, where each component of the original vector has been halved.

>> v/2
ans =
1
2
3

This is the mathematical operation.

$$ \frac{ \vec{v} }{2} = \frac{1}{2} \cdot \begin{pmatrix} 2 \\ 4 \\ 6 \end{pmatrix} = \begin{pmatrix} \frac{2}{2} \\ \frac{4}{2} \\ \frac{6}{2} \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix} $$

https://how.okpedia.org/en/matlab/division-of-a-vector-by-a-scalar-number-in-matlab-and-octave


Report us an error or send a suggestion to improve this page


Arrays and Vectors


FacebookTwitterLinkedinLinkedin