User Tools

Site Tools


gibson:teaching:spring-2016:math445:lecture:vectors

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:spring-2016:math445:lecture:vectors [2016/01/27 10:01]
gibson [The transpose operator: ' (apostrophe)]
gibson:teaching:spring-2016:math445:lecture:vectors [2016/01/28 11:33] (current)
gibson [Math 445 lecture 2: Vectors]
Line 1: Line 1:
 ====== Math 445 lecture 2: Vectors ====== ====== Math 445 lecture 2: Vectors ======
  
 +topics
 +
 +<​code>​
 +[]       % creating vector vectors with square brackets
 +()       % accessing/​assigning vector elements with parentheses
 +' ​       % the transpose operator, apostrophe
 +:        % the colon operator, making range vectors
 ++ -      % vector addition, subtraction
 +.* ./ .^ % elementwise vector operations
 +</​code>​
 ===== Vectors in math ===== ===== Vectors in math =====
  
Line 73: Line 83:
  
  
-===== The transpose operator' (apostrophe) =====+===== The transpose operator ' (apostrophe) =====
  
 Note that last method. In Matlab, the apostrophe ''​ ' ''​ stands for the **transpose**. Note that last method. In Matlab, the apostrophe ''​ ' ''​ stands for the **transpose**.
Line 110: Line 120:
 </​code>​ </​code>​
  
-===== Further ​material =====+===== Constructing vectors with the colon operator : ===== 
 + 
 +The Matlab **colon** operator : is used in a number of ways. Here we'll see how it can be used to create vectors. The most straightforward of these is the syntax ''​m:​n'',​ which creates a row vector of the integers from ''​m''​ to ''​n''​. E.g. 
 + 
 +<​code>​ 
 +>> 1:10 
 + 
 +ans = 
 + 
 +     ​1 ​    ​2 ​    ​3 ​    ​4 ​    ​5 ​    ​6 ​    ​7 ​    ​8 ​    ​9 ​   10 
 + 
 +>> x = 4:7 
 + 
 +x = 
 + 
 +     ​4 ​    ​5 ​    ​6 ​    7 
 + 
 +</​code>​ 
 + 
 +You can also specify a **step** or **increment** between the elements using the syntax ''​m:​step:​n''​. For example, ''​5:​2:​17''​ will produce a vector of odd integers between 5 and 17. 
 + 
 +<​code>​ 
 +>> x = 5:2:17 
 + 
 +x = 
 + 
 +     ​5 ​    ​7 ​    ​9 ​   11    13    15    17 
 +</​code>​ 
 + 
 +Lastly, the colon operator works with nonintegers,​ too. E.g. 
 + 
 +<​code>​ 
 +>> x = 0:0.1:0.7 
 + 
 +x = 
 + 
 +         ​0 ​   0.1000 ​   0.2000 ​   0.3000 ​   0.4000 ​   0.5000 ​   0.6000 ​   0.7000  
 +</​code>​ 
 + 
 + 
 + 
 +===== Supplemental ​material ===== 
 + 
 +[[https://​www.youtube.com/​watch?​v=zXP_pr7np-o | ' (apostrophe),​ Frank Zappa (the song)]] 
  
-[[https://​www.youtube.com/​watch?​v=zXP_pr7np-o ​| ' (apostrophe),​ Frank Zappa]]+[[https://​www.youtube.com/​watch?​v=kQDp2425WQ0&​list=PL8WvZFiJpAr29HFJkRcE4NvWCeYy3ytte ​| ' (apostrophe),​ Frank Zappa (full album) ​]]
gibson/teaching/spring-2016/math445/lecture/vectors.1453917696.txt.gz · Last modified: 2016/01/27 10:01 by gibson