e-Mathematics > Matrix Algebra

Dot Operators

Dot (.) operator can be used to multiply (.*) or divide (./) two arrays component-wise, or to raise (.^) all components of one array. The two arrays must have the same dimensions.
> a = [1, 2, 3];
> b = [0, 1, 2];
> a .* b
> a .^2
For example, we can easily evaluate the polynomial function

$\displaystyle 3 x^3 - 5 x^2 + 2 x + 7
$

for different values of $ x = -2,1,3$ as follows:
x = [-2 1 3]
y = 3*x.^3 - 5*x.^2 + 2*x + 7
Note. In Matlab the function polyval() can be used to evaluate the polynomial.
x = [-2 1 3]
c = [3 -5 2 7]
y = polyval(c,x)


© TTU Mathematics