Level 1

#### 15 words 0 ignored

Ready to learn
Ready to review

## Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

**Ignore?**

rvec = [3,9,5]

Assume the variable rvec has not yet been used. Write a statement that causes there to be a 1x3 array named rvec having 3,9, and 5 as the values of its elements, in that order.

plot(x,y)

If you want to plot y vs. x do you use "plot(x,y)" or do you use "plot(y,x)"? (Do not include the quotation marks.)

p

Is the first letter of the plot command "p" or is it "P"? (Do not include quotation marks.)

linspace

What function do you use to create an array of a given number of evenly spaced values from a given starting value to a given ending value?

x = linspace(0,10,101)

Write a statement that uses linspace to assign, to the variable x, an array of 101 equally-spaced values from 0 to 10.

y = sin(x)

Let x be an array of angles in radians. Write a statement that, using array x, creates array y, where y has the same number of elements as x, and each element of y is the sine of the angle stored in the corresponding element of x.

grandTotal = sum(myValues)

Let myValues be a one-dimensional array of values. Write a statement that assigns the sum of all the values in myValues to the variable grandTotal.

xlabel('x [radians]')

Assume that you have a function with a plot(x,y) statement in it. Write a statement that causes the title of the x axis of that plot to be "x [radians]" (without the quotation marks being part of the title).

ylabel('sin(x)')

Assume that you have a function with a plot(x,y) statement in it. Write a statement that causes the title of the y axis of that plot to be "sin(x)" (without the quotation marks being part of the title).

title('sin(x) vs. x')

Assume that you have a function with a plot(x,y) statement in it. Write a statement that causes the title of the graph to be "sin(x) vs. x" (without the quotation marks being part of the title).

xlim([0,2*pi])

Assume that you have a function with a plot(x,y) statement in it. Write a statement that forces the range of x values plotted on the graph to be 0 to 2pi.

y = atan(x)

Write a statement that assigns the arctangent of x, in radians, to the variable y.

rvec=[x,y,z]

Suppose x, y, and z are all single value varibles to which values have already been assigned. Write a single MatLab statement to create a 1x3 array rvec and to assign: the value of x to the first element of rvec, the value y to the second element of rvec, and the value z to the third element of rvec.

z=r(3)

Let r be a 1x3 array to which 3 values have already been assigned. Write a MatLab statement to assign the value of the third element of the array to the variable z.

M=cross(r,F)

Let r be a 1x3 array containing the three scalar components of a postion vector. Let F be a 1x3 array containing the three scalar components of a force vector. Write a single Matlab statement to assign the three scalar components of "the position vector crossed into the force vector" to the variable M.