Thus element i,j is at the intersection of row i and column j. We can index an element of a matrix with two positive integers - the row index and the column index. We can write the matrix as a table with m rows and n columns. a member of the set R^(m x n), where m and n are any non-zero positive integers. In order to understand how Matlab expresses an inner product of vectors, we need to consider matrices first.Ī Matrix is an m by n array of real numbers (later complex numbers), e.g. Obviously if two vectors do not have the same number of elements, their inner product is undefined. As in this example, the inner product of two vectors, of any number of elements, is always a scalar. Thus the inner product of and is 1*5 + 3*4 + 2*7 + 6*8, or 79. This is the sum of the pair-wise products of corresponding elements. If we symbolize the magnitude of a vector a as |a|, then a/|a| will always be a vector of unit length.Īnother important operation on vectors is the inner product (or dot product) of two vectors. This is a special case of the fact that the Euclidean distance between two points in n-space is the square root of the sum of the squares of the element-wise differences. The magnitude (length) of a vector is the square root of the sum of the squares of its elements. If you visualize a vector as a directed magnitude, running from the origin to the specified point in n-space, then you can think of adding vectors as the geometric equivalent of placing the vectors "tail to head". In particular, this graphical way of thinking about scalar multiplication of a vector remains true for vectors of any dimensionality. Vectors of higher dimensionality can't really be visualized, but the 2-D or 3-D intuitions are often useful in thinking about higher-dimensional cases as well. We can visualize this easily in 2-space (where points are defined by pairs of numbers), and also in 3-space (where points are defined by triples of numbers). For any (non-zero) vector, any point on the line can be reached by some scalar multiplication. Multiplying the vector's elements by a scalar moves the point along that line. A vector - viewed as a point in space - defines a line drawn through the origin and that point. Scalar multiplication has a simple geometric interpretation. You can't add two vectors of different sizes. number of elements) can be added: this adds the corresponding elements to create a new vector of the same size. Operations on vectors include scalar multiplication (also of course scalar addition, subtraction, division)Īnd vector addition. The individual numbers that make up a vector are called elements or components of the vector. You can enter a vector in Matlab by surrounding a sequence of numbers with open and close square brackets: We'll try to avoid uses whose meaning is not clear from context. the number of elements in it (so that a vector has length 2 in this sense), or we might mean the geometric distance from the origin to the point denoted by the vector (so that a vector has length 5 in this sense). Note 2: ordinary language words such as length or size can be ambiguous when applied to a vector: we might mean the dimensionality of the vector, i.e. Note 1: the origin is the vector consisting of all zeros - in whatever dimensionality. The dimensionality n can be anything: 1 or 37 or 10 million or whatever. Geometrically, a vector of dimensionality n can be interpreted as point in an n-dimensional space, or as a directed magnitude (running from the origin to that point). a member of R^n (where R stands for the real numbers). Operations defined on scalars include addition, multiplication, exponentiation, etc.Ī vector is an n-tuple (an ordered set) of numbers, e.g. The name "scalar" derives from its role in scaling vectors. COGS501 - Homework 1 part 1 - Matlab tour Vectors, matrices and basic operations on themĪ scalar is any real (later complex) number.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |