W1Q1: Create a sequence of numbers Description ---------------------------------------------------------- *Generate a sequence of numbers _between 2 and 22, spaced 2 apart_. You can use a* |colon| *operator, or you can use a pre-programmed function such as* |linspace|. *The variable that you create must be called* _y_ . You may or may not close with a semicolon, to suppress output to your screen. There are, literally, an infinite number of ways in which you can accomplish what's asked. You may choose to use brackets or not in this example. In the template, I have written square brackets within which you will type your solution. Your _script_, the answer to this question, is only that one line long! And you will only type within the brackets. Solution Template ---------------------------------------------------- y=[]; Reference Solution --------------------------------------------------- switch randi(3) case 1 y=2:2:22; case 2 y=linspace(2,22,11); case 3 y=[2:2:22]'; end Visible Tests -------------------------------------------------------- Hidden Tests --------------------------------------------------------- run('solution'); x=[2:2:22]'; assert(isequal(x,y(:))); W1Q2: Find a specific entry in a vector Description ---------------------------------------------------------- *A vector is an array of numbers. The template is making a vector for you, the variable named* |v| . *Assign the* _fifth_ *element of the vector* |v| *to a* _new_ *variable, named* _p_. Solution Template ---------------------------------------------------- % Here I am making a very specific vector for you. v=[1 exp(1) pi 99.9 -4 5 1e6]; % On the next line, extract the fifth element of v and assign it to p Reference Solution --------------------------------------------------- p=v(5); Visible Tests -------------------------------------------------------- run('solution'); assert(logical(exist('p','var'))); Hidden Tests --------------------------------------------------------- run('solution'); assert(isequal(p,-4));