Graphics Programs Reference
In-Depth Information
>>a=1:2:11
a=
1
3
5
7
9
11
>>A=reshape(a,2,3)
A=
1
5
9
3
7
11
dot
a
= dot(
x
y
)
,
Thisfunctionreturns the dot product of two vectors
x
and
y
which must beofthe
samelength.
prod
a
= prod(
x
)
Foravector
x
,
prod(
x
)
returns the product of its elements. If
x
is amatrix, then
a
is a
rowvector containing the products over each column. For example,
>>a=[123456];
>>A=reshape(a,2,3)
A=
1
3
5
2
4
6
>> prod(a)
ans =
720
>> prod(A)
ans =
2
12
30
sum
a
= sum(
x
)
Thisfunctionissimilar to
prod
,exceptthat it returns the sum of the elements.
Search WWH ::
Custom Search