Vector operations, MATLAB in Engineering

Vector operations:

As vectors are special cases of matrices, the matrix operations elaborated (addition, subtraction, multiplication, scalar multiplication, transpose) work on vectors and also as the dimensions are right.

For vectors, we know that the transpose of a row vector is the column vector, and the transpose of a column vector is a row vector.

To multiply vectors, they should have similar number of elements, but one should be a row vector and the other a column vector. For illustration, for a column vector c and row vector r:

584_Vector operations.png

Note that r is a 1 × 4, and c is 4 × 1. Recall that to multiply the two matrices,

[A]m ×n [B]n ×p = [C]m × p

Therefore [r] 1×4 [c] 4 × 1 = [s] 1 × 1, or in another word a scalar:

2056_Vector operations1.png

While [c] 4 × 1 [r] 1 × 4 = [M] 4 × 4, or in another words a 4×4 matrix:

1357_Vector operations2.png

In a MATLAB, such operations are accomplished by using the * operator, that is the matrix multiplication operator. At first, the column vector c and row vector r are generated.


>> c = [5 3 7 1]';

>> r = [6 2 3 4];

>> r*c

ans =

         61

>> c*r

ans =

30 10 15 20

18  6  9 12

42 14 21 28

 6  2  3  4

Posted Date: 10/22/2012 2:35:20 AM | Location : United States







Related Discussions:- Vector operations, Assignment Help, Ask Question on Vector operations, Get Answer, Expert's Help, Vector operations Discussions

Write discussion on Vector operations
Your posts are moderated
Related Questions
Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Replacement : Replace a row by adding it to (or subtract from it) a multiple of the other row. For a given row ri, this is written as   ri  - srj →  ri Note that when r

Built-in colormaps: The MATLAB has numerous built-in colormaps which are named; the reference page on colormap shows them. Calling the function colormap without passing any ar

Illustration of Variable scope: Running this function does not add any of variables to the workspace, as elaborated: >> clear >> who >> disp(mysum([5 9 1]))

Intersect function and setdiff function: The intersect function rather than returns all the values which can be found in both of the input argument vectors. >> intersect(v

Example to change the line width from the default: For illustration, to change the line width from the default of 0.5 to 1.5: >> set(hl,'LineWidth',1.5) As long as the

Structures: The Structures are data structures which group together values which are logically related in what are known as the fields of structure. The benefit of structures

Inverse of square matrix: The inverse is, hence the result of multiplying the scalar 1/D by each and every element in the preceding matrix. Note that this is not the matrix A,

Illustration of Image processing: This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors a

str2num function - String: The function str2num does the opposite; it takes the string in which a number is stored and converts it to the type double: >> num = str2num('123.