



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Question 1: Many built-in functions will accept scalars or vectors as input arguments. In general they operate element by element when the input is a vector. T/F
Answer: True
Question 2: Below is a list of operations that may all be included in a single command. Please put these in the order by which MATLAB evaluates them when executing the command. Note operations on the same precedence level are executed left to right. Also, the order of operations can be overridden using parentheses. -exponentiation (^) -multiplication and division (* /) -addition and subtraction (+ -) -parentheses ()
Answer: 1 - parentheses () 2 - exponentiation (^) 3 - multiplication and division (* /) 4 - addition and subtraction (+ -)
Question 3: Where you enter MATLAB commands at the prompt
Answer: Command Window
Question 4: Records all previous commands
Answer: Command History
Question 5: Tracks the values of variables as they are created and/or modified
Answer: Workspace
Question 6: Indicates the folder on the computer where MATLAB is looking for files
Answer: Current Folder
Question 7: The list below shows a variety of assignment commands. Select the ones that will return errors or an incorrect/unexpected numerical answer if both x and y are vectors of the same length: 1 - z = atand(y/x); 2 - z = 5x.^2.y+3x.y.^3 3 - z = 2x.^2+1/y 4 - z = (x + y)/sqrt(x.^2+y.^2) 5 - z = 10exp(-5x).cos(piy-pi/2) 6 - z = 10cos(pix).sin(pi*y).^2;
Answer: 1,3,
Question 8: You are using MATLAB to find one of the sides of a right triangle. The hypotenuse is 7 and the known side is 4. Which of the following commands is correct? (More than one option may be correct. Select all the correct options.) 1 - >>a = 4; c = 7; a^2 + b^2 = c^2 2 - >>a = 4; c = 7; b = sqrt(c^
Answer: 2,
Question 9: A script m-file is simply a list of MATLAB commands saved to a file. When the script is run, these commands are executed sequentially using the same workspace as the command window. True/False
Answer: True
Question 10: Match the MATLAB command with the appropriate verbal explanation of what the command is doing. All of these commands refer to a vector x = [2 -1 3 1.7 99 8] z = x([2 5]).^2 z = x(1:4) z = x(end-1:end); z = x(4)
Answer:
Question 11: Which of the following commands creates a column vector of the integers 1 through 5? Select all correct answers. 1 - x = linspace(1,5,5)'; 2 - x = [1; 2; 3; 4; 5]; 3 - x = [1:1:5]; 4 - x = [1 2 3 4 5]'; 5 - x = [1, 2, 3, 4, 5];
Answer: 1,2,
Question 12: Which of the following are NOT correct uses of MATLAB's built-in functions to do the calculation indicated. Select all that are incorrect. 1 - >>x = sind(30) to calculate the sine of 30 degrees 2
Answer: 2,4,6,
Question 13: In any least-squares curve fit.
Answer: the fit coefficients are determined by minimizing the squared Euclidean norm of the residuals in the model predictions of the data.
Question 21: The Jacobian matrix can be calculated using a finite difference approach in cases where derivation of the analytical partial derivatives is tedious. Which of the following statements is/are true about this approach?
Answer: - The approach does not introduce error into the method because the derivatives in the Jacobian are only used to inform the guess for the next iteration. - The accuracy of the Newton-Raphson method is ultimately determined by the stopping criterion regardless of whether the derivatives are exact or approximated. - The approach uses perturbation of one of the variables by a small factor (e.g. 1e-6*xi) to approximate the partial derivatives with finite difference approximations.
Question 22: The equation for the standard error must be modified depending on the number of coefficients in the mathematical model that is being fit to the data. T/F
Answer: True
Question 23: In the general linear least squares algorithm, the fit coefficients can be determine once the Z matrix is generated using which MATLAB command?
Answer: left division
Question 24: The function below is to be fit to a data set using linear regression. y = Ae^(B/x) The correct linearization of the data needed to calculate the model coefficients A and B is:
Answer: 1/x and ln(y)
Question 25: Which of the following are indications the solution of a linear system may be vulnerable to round off error.
Answer: - The elements of the coefficient matrix span several orders of magnitude. - The determinant of the coefficient matrix is close to zero. - The condition number of the coefficient matrix is much larger than one.
Question 26: If a floating point number is stored in 32-bit single precision, there is 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa. What is the machine epsilon in single precision (Enter the mantissa to four decimal places and an integer for the exponent)?
Answer: 1.1921 x 10^(-7)
Question 27: The computational cost of the Gauss elimination algorithm is concentrated in the ________________ step and is proportional to the cube of the size (n) of the n x n system of equations.
Answer: forward elimination
Question 28: For a system of linear equations, the Gauss-Seidel method should converge faster than the Jacobi method because the Gauss-Seidel method takes advantage of the latest information as each iteration of the solution vector is calculated. T/F
Answer: True
Question 29: Compute the Euclidean norm of the following matrix (round to four decimal places): 2 - 3 1 5 -2 0 3 4
Answer: 8.
Question 30: The Gauss-Seidel method is guaranteed to converge if the system is _____________________.
Answer: diagonally dominant
Question 31: A numerical algorithm is used to solve the following system of equations: 3(x1) - 2(x2) = 1 (x1) - 4(x2) = -3 The numerical results are x1 = 0.997 and x2 = 1.002. The absolute values of the residuals associated with this numerical solution are (to four decimal places):
Answer: e1 = 0.013 e2 = 0.
Question 32: LU factorization can significantly reduce the computational cost of solving linear systems when _________________________.
Answer: the system is going to be solved for multiple right-hand-side vectors.
Question 33: Suppose you need to solve a linear system with 1000 equations and 1000 unknowns for 100 different right hand side vectors (Note this is representative of a common task in many differential equation solution algorithms). Approximately how many operations would you save by using LU factorization?
Answer: 10^
Question 34: Perform an LU factorization of the matrix below (by hand to make sure you understand how) and enter the results in the appropriate boxes: 8 2 3 1 4 1 1 1 4
Answer:
Question 42: Below are some MATLAB commands for working with polynomials. Match each function with the correct description of what it does. - polyval(a,x) - roots(a) - a = [2 0 3 4]; - poly(a)
Answer: