Final Exam With Solutions - 2018-2019 Spring
Final Exam With Solutions - 2018-2019 Spring
𝑡(𝑛)−𝑡(0) 1.00−0
Solution 1) ` 𝑛= +1= +1=5
ℎ 0.25
−1
𝑦1 = 0 𝑎𝑛𝑑 𝑦4 ′ =
12𝑒
1
𝑦𝑖′ = ( ) ( 𝑦𝑖+1 − 𝑦𝑖−1 ) = 2 ( 𝑦𝑖+1 − 𝑦𝑖−1 )
2ℎ
1
𝑦𝑖 ′′ = ( ) ( 𝑦𝑖−1 − 2 𝑦𝑖 + 𝑦𝑖+1 ) = 16 ( 𝑦𝑖−1 − 2 𝑦𝑖 + 𝑦𝑖+1 )
ℎ2
i=1: 𝒕𝟏 = 𝟎. 𝟎𝟎 , 𝒚𝟏 = 𝟎
i=2: 𝒕𝟐 = 𝟎. 𝟐𝟓 , 𝟐𝟎 𝒚𝟏 − 𝟑𝟒 𝒚𝟐 + 𝟏𝟐 𝒚𝟑 = 𝑒−𝟎.𝟐𝟓
i=3: 𝒕𝟑 = 𝟎. 𝟓𝟎 , 𝟐𝟎 𝒚𝟐 − 𝟑𝟒 𝒚𝟑 + 𝟏𝟐 𝒚𝟒 = 𝑒−𝟎.𝟓𝟎
i=4: 𝒕𝟒 = 𝟎. 𝟕𝟓 , 𝟐𝟎 𝒚𝟑 − 𝟑𝟒 𝒚𝟒 + 𝟏𝟐 𝒚𝟓 = 𝑒−𝟎.𝟕𝟓
i=5: 𝒕𝟓 = 𝟏. 𝟎𝟎 , 20 𝑦4 − 34 𝑦5 + 12 𝑦6 = 𝑒−𝟏.𝟎𝟎
−1 −1
𝑦5 ′ = 2 ( 𝑦6 − 𝑦4 ) = 12𝑒 → 𝑦6 = 12𝑒 + 𝑦4
−1 1
20 𝑦4 − 34 𝑦5 + 12 (12𝑒 + 𝑦4 ) = 𝑒 → 𝟑𝟐 𝒚𝟒 − 𝟑𝟒 𝒚𝟓 = 𝟐/𝒆
𝟏 𝟎 𝟎 𝟎 𝟎 𝒚𝟏 𝟎
𝒚 𝑒−𝟎.𝟐𝟓
𝟐𝟎 −𝟑𝟒 𝟏𝟐 𝟎 𝟎 𝟐
𝟎 𝟐𝟎 −𝟑𝟒 𝟏𝟐 𝟎 𝒚 𝟑 = 𝑒−𝟎.𝟓𝟎
𝟎 𝟎 𝟐𝟎 −𝟑𝟒 𝟏𝟐 𝒚𝟒 𝑒−𝟎.𝟕𝟓
[𝟎 𝟎 𝟎 𝟑𝟐 −𝟑𝟒] [ 𝒚𝟓 ] [ 𝟐/𝒆 ]
Question 2) [25 points] Determine the coefficients of the polynomial 𝑦 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 that
passes through the (𝑥, 𝑦) points (1, 6), (3, 18) and (5, 38). Rewrite the system in the matrix form as
𝑨 ∙ 𝑿 = 𝑩 , and solve { 𝑎0 , 𝑎1 , 𝑎2 }𝑇 by using Doolittle’s LU Decomposition method.
Solution 2) 𝑦 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2
𝑥 = 1 𝑎𝑛𝑑 𝑦 = 6 → 6 = 𝑎0 + 𝑎1 + 𝑎2 1 1 1 a0 6
𝑥 = 3 𝑎𝑛𝑑 𝑦 = 18 → 18 = 𝑎0 + 3 𝑎1 + 9 𝑎2 [1 3 9 ] ∙ [a1 ] = [18]
𝑥 = 5 𝑎𝑛𝑑 𝑦 = 38 → 38 = 𝑎0 + 5 𝑎1 + 25 𝑎2 1 5 25 a2 38
1 1 1 a0 6
𝑨 = [1 3 9] , 𝐗 = [ a1 ] , 𝐁 = [18]
1 5 25 a2 38
𝑨=𝑳∙𝑼
First, we use Gauss elimination:
row2 – (1) x row1 → row2 , 𝐿21 = 1 and,
1 1 1
row3 – (1) x row1 → row3 , 𝐿31 = 1 → 𝑨′ = [0 2 8 ]
0 4 24
1 1 1 1 0 0
row3 – (2) x row2 → row3 , 𝐿32 = 2 → 𝑼 = [0 2 8] and 𝑳 = [1 1 0]
0 0 8 1 2 1
𝑨∙𝑿=𝑩
𝑳 ∙ (𝑼 ∙ 𝑿) = 𝑩
1 0 0 y1 6
𝒀=𝑼∙𝑿 y
→ 𝑳 ∙ 𝒀 = 𝑩 → [1 1 0] ∙ [ 2 ] = [18]
1 2 1 y3 38
6
𝑦1 = 6 , 𝑦2 = 18 − 6 = 12 , 𝑦3 = 38 − 6 − 2 ∙ 12 = 8 → 𝐘 = [12]
8
1 1 1 a0 6
𝑼∙𝑿=𝒀 → [0 2 8] ∙ [a1 ] = [12] →
0 0 8 a2 8
𝐚𝟎 𝟑
8 12−8∙(1) 6−1−2
𝑎2 = 8 = 1 , 𝑎1 = = 2 , 𝑎0 = =3 → 𝐚
[ 𝟏 ] = [𝟐 ]
2 1
𝐚𝟐 𝟏
Question 3) [25 points] The data below is obtained from a gas sensor calibration.
v (Volts) 2.0 4.0 5.0 7.0
f (ppm) 16.0 41.0 70.0 150.0
Determine the parameters a and b so that f(v) = a.eb.v fits the calibration data in the least-squares
sense. What is the ppm concentration of a sampled gas when the sensor gives 6 volts?
∑ 𝑦 ∙( 𝑥 −𝑥̅ )
Work with at least 3 decimal points. Hint: y=a+bx , 𝑏 = ∑ 𝑥𝑖∙( 𝑥𝑖−𝑥̅ )
𝑖 𝑖
Solution 3)
We convert f(x)=a.ebx to z=c+bx shape, and use the curve fitting equations of a straight line:
𝑙𝑛[𝑓(𝑥)] = 𝑙𝑛(𝑎. 𝑒 𝑏𝑥 ) → 𝑙𝑛[𝑓(𝑥)] = 𝑙𝑛(𝑎) + 𝑙𝑛(𝑒 𝑏𝑥 ) → 𝑙𝑛[𝑓(𝑥)] = 𝑙𝑛(𝑎) + 𝑏. 𝑥 .
𝑑 = √(𝑥 − 𝑥𝑜 )2 + (𝑦 − 𝑦𝑜 )2 = √(𝑥 − 𝑥𝑜 )2 + (𝑥 2 − 𝑥 + 3 − 𝑦𝑜 )2