E7_Lab02_Solutions_Fall_2010

E7_Lab02_Solutions_Fall_2010 - E7 Lab 02 Solutions 1. A...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
E7 Lab 02 Solutions 1. A vector: [0 3 6 9] B vector: [4 10 16] 2. C = 3:2:11. Note the third value may be any number between 11 and 12.99. 3. D vector: Empty matrix: 1-by-0 E vector: Empty matrix: 1-by-0 4. F = 5:-.25:4.25. Note third value may be any number between 4.01 and 4.25. 5. The colon operator creates a row vector. There are typically three input arguments, the first argument is the beginning value of the vector, the second value is the step and the third value is the last value of the vector. Omission of the second value leads to a step of 1. If no value exists between the first and last value using the step size, an empty vector is created. 6. linspace(0,1,10) gives [0 1.1111, …, 8.8889, 10] Step size is 1.1111. linspace(0,1,11) gives [0 1, …, 9, 10] Step size is 1.0000. 7. A = linspace(5,8,13); 8. linspace(10,1,10) gives [10, 9, …, 2, 1]. 9. logspace(0,1,10) gives [1, 1.2915, 1.6681, 2.1544, 2.7826, 3.5738, 4.6416, 5.9948, 7.7426, 10]. logspace(0,2,10) gives [1, 1.6681, 2.7826, 4.6416, 7.7426, 12.9155, 21.5443, 35.9381, 59.9484, 100]. 10. F = logspace(0,3,21); 11. linspace(a,b,n) can be converted to a:step:b using a step = (b-a)/(n-1) 12. [1,2,4,5] produces a horizontal (row) vector with corresponding values. [2;3;6;10] produces a vertical (column) vector with corresponding values. 13. [G G] gives [1 2 4 5 1 2 4 5]. This is a horizontal concatenation operation. [1 G 4] gives [1 1 2 4 5 4]. Another horizontal concatenation operation. [1;H;4] gives a column vector with values [1;2;3;6;10;4]. Vertical concatenation. 14. L = [J K]; 15. L = [L J];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
16. ‘end’ allows you to easily access the last element without knowing the length of the vector. 17.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/21/2011.

Page1 / 6

E7_Lab02_Solutions_Fall_2010 - E7 Lab 02 Solutions 1. A...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online