This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Engineering 6 Sample Midterm Problems University of California, Davis (Solutions provided at the end) NOTE: Some of the equations displayed below may not be printed correctly by all printers. This page may also not be displayed correctly by some old versions of Netscape Navigator and Internet Explorer. These sample problems are just thatsample problems. They do not necessarily cover all the topics that might appear on the exam. (See Midterm Study Guide for topics that are covered.) When you are asked to solve a problem and write a script, you are to first develop a mathematical algorithm, then write a Matlab script to compute and display the specified values. You must first show your work in developing the algorithm, either mathematically or in script comments. All computation is to be done in the script, not in your head or by calculator. Matlab variable names should correspond to the chosen mathematical variables. Comments must be included in the script to define variables and to explain sections of the code. The output displayed by the script should clearly identify the variable whose value is displayed and specify its units. 1. (20 points) (a) Explain the meaning of the following Matlab commands, identifying special variables and describing what actions Matlab would take in processing the commands: (i) s = sign(x) (ii) y = imag(z) (iii) clear (iv) save session2 (v) length_a = input('Length of side A: ') (b) Evaluate the following Matlab expressions, giving the format short display of the results (not necessary to include the ans = ): (i) 4^2 (ii) rem(15,2) (iii) log10(100) + log10(0.001) (iv) conj(1 j*3) (v) angle(-1) 2. (24 points) (a) Convert the following to Matlab assignment statements. Use built-in functions where possible. (i)...
View Full Document
- Winter '09