We read your photo as:
Which indexing returns the second row of matrix A? A) A(:,2) B) A(2,:) C) A(2,2) D) A(2)
ScanSolve AI Answer
Here are the solutions to the questions:
12. The function that generates a row vector of evenly spaced values is
- C) linspace()
linspace(x1, x2, n)generatesnpoints betweenx1andx2(inclusive).
13. One of the following commands creates a 3x3 zero matrix
- D) zeros(3,3)
- The
zeros(m,n)function creates anm \times nmatrix of zeros.zeros(3)would also create a3 \times 3zero matrix.
- The
14. What is returned by the command eye (3)?
- B) Identity matrix
- The
eye(n)function creates ann \times nidentity matrix.
- The
15. Which indexing returns the second row of matrix A?
- B) A(2,:)
- In MATLAB,
A(row, column)is used for indexing. The colon:indicates all elements in that dimension. So,A(2,:)selects all columns of the second row.
- In MATLAB,
16. One of these is a built-in MATLAB function.
- C) round()
round()is a standard built-in MATLAB function used to round numbers to the nearest integer.
17. function keyword is required to define a user-defined function in MATLAB.
- B) function keyword
- User-defined functions in MATLAB begin with the
functionkeyword.
- User-defined functions in MATLAB begin with the
18. User-defined functions can be saved at
- D) .m files
- All MATLAB script and function files are saved with the
.mextension.
- All MATLAB script and function files are saved with the
19. One of the following keywords is used to terminate a function in matlab.
- B) end
- The
endkeyword is used to terminate the definition of a function,ifstatements,forloops, andwhileloops in MATLAB.
- The
20. One of the following is a function used to calculate the square root in MATLAB.
- B) sqrt()
- The
sqrt()function calculates the square root of a number.
- The
21. The command used for basic 2D plotting is
- B) plot()
- The
plot()function is the primary command for creating 2D line plots in MATLAB.
- The
22. Which function creates 3D surface plots?
- A) surf()
- The
surf()function creates 3D surface plots from matrix data.
- The
23. Which command is used to label the x-axis of a graph in MATLAB?
- A) xlabel()
- The
xlabel()function adds a label to the x-axis of a plot.
- The
24. Indicate how to hold a plot to add more data series?
- C) hold on
- The
hold oncommand retains the current plot in the axes so that new plots added to the axes do not delete existing plots.
- The
25. title() is a function used to set the title of a plot?
- B) title()
- The
title()function adds a title to the current plot.
- The
26. Which loop repeats a block a fixed number of times?
- D) for
- A
forloop is used when you know in advance how many times you want to execute a block of code.
- A
27. The conditional statement used to check multiple conditions is termed as
- C) elseif
- The
elseifstatement is used in conjunction withifandelseto check multiple conditions sequentially.
- The
28. The output of mod (9,4) is
- B) 1
- The
mod(a,n)function returns the remainder after division ofabyn.
mod(9,4)is 1. - The
Still stuck on this one?
Ask a follow-up, and the answer starts from this question.