-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIntro_14_01.m
38 lines (25 loc) · 1.19 KB
/
Intro_14_01.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% 20130515 XY511 09:00
% AbrahamX @ NWPU
u = [10, -11, 12];
v = [20; -21; -22];
prod = u * v
w = [2, 1, 3];
z = [7; 6; 5]
% u * w
% Comment: We shall describe two ways in which a meaning may be
% attributed to the product of two vectors. In both cases the vectors
% concerned must have the same length.
% The first product is the standard scalar product. Suppose that u
% and v are two vectors of length n, u being a row vector and v a column
% vector. The scalar product is defined by multiplying the corresponding
% elements together and adding the results to a given single number
% (scalar).
% The second way of forming the product of two vectors of the same length
% is known as the Hadamard product. It is not often usd in Mathematics but
% is an invaluable MATLAB feature. It involves vectors of the same type. If
% u and v are two vectors of the same type (both row vectors or both column
% vectors), the mathematical definition of this product, which we shall
% call the [dot product], is the VECTOR having the components u*v = [u1v1,
% u2v2, ..., unvn].------->The result is a vector of the same length and
% type as u and v. Thus, we simply multiply the corresponding elements of
% two vectors.