Professional Documents
Culture Documents
American University of Sharjah: NGN 509 - Computational Methods Professor Nai-Shyong Yeh Assignment #2
American University of Sharjah: NGN 509 - Computational Methods Professor Nai-Shyong Yeh Assignment #2
American University of Sharjah: NGN 509 - Computational Methods Professor Nai-Shyong Yeh Assignment #2
College of Engineering
2.4
2.5
2.2
2
2
1.8
f(x)
1.6
f(x)
1.5
1.4
1
1.2
1
0.5
0.8
0 0.6
0 2 4 6 8 10 12 14 0 2 4 6 8 10 12 14
x x
Plot of data, n=5
Plot of data, n=3 2.5
2.5
2
2
1.5
1.5
f(x)
f(x)
1
1
0.5
0.5
0
0 0 2 4 6 8 10 12 14
0 2 4 6 8 10 12 14
x
x
Cubic Spline
3
2.5
2
f(x)
1.5
Q2.
1
0.5
0
0 2 4 6 8 10 12 14
x
Code is in the m-file. From the code, you get: a0 = 0.0033, a1 = 0.4970, a2 = -0.2738, a3 = 0.0511
so the third-order polynomial is: p3(x) = 0.0033 + 0.4970 x - 0.2738 x2 + 0.0511 x3
n
Standard deviation = 0.0099. σ =
√ S
n−m i=1
2
|
, S=∑ e ei=Yi-yi | n=6, m=3.
Q3.
1 & 3)
2)
250
200
y/f(x)
150
100
50
0
1 2 3 4 5 6 7 8
x