**This is an old revision of the document!** ----
====== Math 445 lecture 2: Vectors ====== ===== Vectors in math ===== Vectors are hugely important in math, science, engineering. In math, a vector is a list of numbers. E.g. this is a 3-d vector <latex> v = \left(\begin{array}{c} 4.3 \\ 5.9 \\ 0.1 \end{array} \right) </latex> In math, the components or elements of a vector are written with subscripts. E.g. for the above vector <latex> v_1 = 4.3, \quad v_2 = 5.9, \quad v_3 = 0.1 </latex> ===== Creating vectors with explicit lists ===== In Matlab, there's a distinction between **row vector** and **column vectors**. You can construct row vectors by listing elements between **square brackets**, with either spaces or commas between. <code> v = [4.3 5.9 0.1] % assign a row vector into variable v v = [4.3, 5.9, 0.1] % same, using commas </code> To create a column vectors, put semicolons between the elements. <code> v = [4.3; 5.9; 0.1] % assign a col vector into variable v </code> ===== The transpose operator ===== Note that last method. In Matlab, the apostrophe '' ' '' stands for the **transpose**. The transpose operator turns a row vector into a column vector, and vice versa. <code> >> v = [4.3 5.9 0.1] v = 4.3000 5.9000 0.1000 >> v' ans = 4.3000 5.9000 0.1000 >> u = v' u = 4.3000 5.9000 0.1000 >> w = u' w = 4.3000 5.9000 0.1000 </code>