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

Determine whether each statement is true or false. T F When calling a MatLab fun

ID: 3850709 • Letter: D

Question

Determine whether each statement is true or false. T F When calling a MatLab function, the number the number of results that can be returned can be less than or equal to the number of elements indicated in the function line. T F An nxn identity matrix can be created using the ones (n) function. T F The MatLab command line compiles the script into an executable application. T F When calling a function, copies are made of any passed variables so that the original does not change T F A shortcut for adding the constant a to a variable x is x +=a: T F Multiplying a column vector, (nx1), to a row vector, (1xm) using matrix multiplication will result in a nxm matrix. T F A primary use of element-wise operations on vectors is to eliminate the need for loops T F The function call r = rand(n): will create a vector with n columns of uniformly random values between 0 and 1. T F when calling a MatLab function, you must pass the exact same number of variables as are in the input list in the parentheses after the function name. T F A recursive function must always have a stopping condition. T F Since blocks of code are always indented, the end of an if-else block is indicated by when the line returns the original alignment. T F A for loop will run the same number of times as the length of the vector in its initial line. T F A while loop will always run the block of code at least one time. T F The subplot function creates a figure with a set number of rows and columns of separate graphs. T F The polyval function will calculate the values of a vector of the polynomial's coefficients, at each point of indicated by a an input vector.

Explanation / Answer

1.True

when calling matlab function the number of results that can be less than or equal to number of elements indicated to the first function line why because MATLAB function returns a logical array with elements set to logical 1, . A value of logical 1 ( true ) indicates a value less than or equal to the number of elements indicated in the first function line. The test compares only the real part of numeric arrays. ie returns logical 0

2.False

in matlab the nxn identity matrix created using ones(n) function why because the function I = eye returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere.

3.True

Using mcc command,the command line compiles the script into an executable application.

4.True

when calling a function copies are made any passed variables , Variables are copied when they are changed, so when we make a change to that variable it will create a new copy.

5.True

x=x+a short cut is x+=a

6.True

The columns of first matrix and the rows of the second matrix should be equal.

7.True

applies the element-wise binary operation specified by the function handle fun to arrays A and B. with out any for loop

8.False

X = rand( n ) returns an n -by- n matrix of random numbers values between 0 to 1.

9.True

10.True

It is very important a recursive function always have a termination condition other wise the function couldn’t stopped.

11.F

12.True

Yes,the for loop will run the same number of times as length in the vector indicated in initial line.

for index = value

   statements

end

the above loop runs the “ value” times

13.True

The while loop repeats the execution of a group of statements in a loop while the expression is true.

14.True

subplot( m , n , p ) divides the current figure into an m -by- n grid and creates axes in the position specified by p.

15.True

y = polyval(p,x) returns the value of a polynomial of degree n evaluated at x. The input argument p is a vector of length n+1 .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote