精華區beta NTU-Exam 關於我們 聯絡資訊
課程名稱︰數值方法 課程性質︰必修 課程教師︰張恆華 開課學院:工學院 開課系所︰工科海洋系 考試日期(年月日)︰2011/3/30 (三) 考試時限(分鐘):3小時 (9:10am ~ 12:10pm) 是否需發放獎勵金:是 (如未明確表示,則不予發放) Numerical Methods: 505 29120/ESOE 2024 This is an open book, open notes exam. Electronic devices are forbidden on your person, including cell phones,iPods, iPads, headphones, PDAs, calculators, and computers. Turn your cell phone off and leave all electronics in your backpack or bag, or risk getting a zero on the exam. 試題 : 1. Conversion. (10 pts) (a) Convert the binary number 1011101 to decimal format. (b) Convert the binary number 11000101.101 to decimal format. 2. Express the following quantities in the form 0.xxx...xEyy. (10 pts) (a) 0.00001325 (b) 123456789 (c) 0.0000002 3. Write a user-defined MATLAB function that carries out multiplication of two matrices [c] = [a][b]. For function name and arguments use C = MatrixMult(A,B). The input arguments A and B are the matrices that are multiplied. The output argument C is the result. DO NOT use the matrix multiplication of MATLAB. The function MatrixMult should first check if the two matrices can be multiplied, and if not the output C should be the message "The matrices cannot be multiplied since the number of rows in [b] is not equal to the number of columns in [a]". (15 pts) 4. Use three-digit rounding arithmetic to perform the following calculations. (a) 133 + 0.921 (b) (121 - 0.327) - 119 (c) (121 - 119) - 0.327 (10 pts) 5. Repeat Problem 4 using four-digit rounding arithmetic. (10 pts) 6. Use colon notation to create vectors identical to the following created with the linspace function: (10 pts) (a) v = linspace(-3,1,9). (b) r = linspace(8,0,17). 7. Exactly what will be displayed after the following MATLAB commands are typed? (10 pts) (a) >> x = 2; >> x ^ 3; >> y = 8 - x (b) >> q = 4:2:10; >> r = [7 8 4; 3 6 -2]; >> sum(q) * r(2,3) 8. Develop a vectorized version of the following code: (10 pts) tstart = 0; tend = 20; ni = 5; t(1) = tstart; y(1) = 10 + 5 * cos(2 * pi * t(1) / (tend - tstart)); for i = 2:ni+1 t(i) = t(i-1) + (tend - tstart) / ni; y(i) = 10 + 5 * cos(2 * pi * t(i) / (tend - tstart)); end 9. The "divide and average" method, an old-time method for approximate the square root of any positive number a, can be formulated as x + a/x x = —————— 2 Write a well-structured M-file function based on a while...break loop structure to implement this algorithm. Use proper indentation so that the structure is clear. At each step estimate the error in your approximation as ∣ x - x ∣ ∣ new old ∣ ε = ∣————————∣ a ∣ x ∣ ∣ new ∣ Repeat the loop until ε is less than or equal to a specified value. A good a initial guess of x is a/2. Make sure that it can evaluate the square root of numbers that are equal to and less than zero. For the latter case, display the result as an imaginary number. For function name and arguments use s = SquareRoot(a,eps). The input arguments a and eps are the number to be computed and the specified tolerance value, respectively. The output argument s is the result. (15 pts) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.27 ※ 編輯: obelisk0114 來自: 140.112.4.183 (08/27 20:44)