Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer will rate! 5. The following command does what? plot(x, sin(x), yp)

ID: 3827582 • Letter: P

Question

Please answer will rate!

5. The following command does what? plot(x, sin(x), yp) marker and no line A. Plots sin(x) vs. x with a yellow plus sign markers and no line B. Plots sin(x) vs. x with yellow pentagram e. Plots x vs. sin(x) with yellow plus sign markers and no line D. Plots x vs. sin(x) with yellow pentagram markers and no line 6. How many times will a for loop starting with for 1:3: execute (or repeat)? D. 7 E. 19 C. 6 7. Which one of the following commands plots a graph in the lower right corners of a 3 x 3 grid of graphs? D. subplot (3,3,9) A. subplot 3.3.1) B. subplot (3.3.3) C. subplot 3,3,7) 8. To evaluate the function y 3x3-xm2 x-5 over a range of x- 1:100, with coef- 13, -1,-5], which command can you use? A. polyval(coef. x B. model coef, x C. poly fit(coef, x) D. linereg(coef, x) 9. Which of the following is NOT a valid name for a function? (D) 2Card Pickup A. Poker B. Blackjack C. Solitare 10. Which of the following commands plots r sin theta) in polar coordinates? A. polar(theta,r); B. polar(r,theta) C. plot (theta,r) D. plot(r,theta)

Explanation / Answer

Q5) Answer is D- plot(x,sin(x),'yp') will plot x vs sin(x) with yellow pentagram markers and no lines.

The third parameter in the plot() command of Matlab can be a line style specifier, marker symbol or colour. Here, the 3rd parameter is a combination of colour, 'y' for yellow and marker symbol, 'p' for pentagram. Line style has not been mentioned so no lines are displayed.

Q6) 'for = 1:3:19' has a syntax error in that it is missing a variable name. So, strictly speaking it should not execute even once. So the correct answer to this question should be A- 0.

However if the missing variable were just a typo and there was a variable, say i in the for loop so that it looked like, for i = 1:3:19; then the correct answer would have been 7. the interval of 1 to 19 would be divided into 6 parts of 3 from 1 to 18 and the number 19 alone would constitute the 7th part. Thus making the loop execute 7 times.

Q7) Answer is D- subplot(3,3,9) will plot a graph in the lower right corner of a 3x3 grid. The first two arguments specify the size of the grid, 3x3 and the 3rd argument of the subplot() function specifies the position of the graph in the said grid. The lower right position in a 3x3 grid is position 9.

Q8) The answer is A. polyval(coef,x) We use the polyval() function to evaluate the value of a polynomial when the value of x and the coefficients of the polynomial are known as is the case here.

Q9) The answer is D- 52Card Pickup. A function name cannot start with a number nor can it contain spaces.

Q10) The answer is A. polar(theta,r) The polar() function can be used to plot a graph in polar coordinates. To plot a graph of angles, theta against sines of those angles, r=sin(theta) we call the polar() function, passing the angle theta as the first argument and sin(theta) or r in this case as r=sin(theta) as the second argument.

Hope this helps!