Anda di halaman 1dari 5

1.

𝑓(𝑥) = 𝜋 − |𝑥|
= 𝜋 − 𝑔(𝑥)
𝑁=∞
𝜋 4 1
= 𝜋 − [ − ( ∑ 2 cos 𝑛𝑥 )]
2 𝜋 𝑛
𝑛=1
𝑁=∞
𝜋 4 1
= + ( ∑ 2 cos 𝑛𝑥) , 𝐹𝑜𝑟 𝑜𝑑𝑑 𝑛 𝑣𝑎𝑙𝑢𝑒𝑠
2 𝜋 𝑛
𝑛=1
2.

3.5

2.5

1.5

0.5

x
0
-4 -3 -2 -1 0 1 2 3 4

g(x) f(x)

x g(x) f(x)
-3.1 3.1 0.041593
-2.4 2.4 0.741593
-1.7 1.7 1.441593
-1 1 2.141593
0 0 3.141593
1 1 2.141593
1.7 1.7 1.441593
2.4 2.4 0.741593
3.1 3.1 0.041593
3.

3.5
f(x)

2.5

1.5

0.5

x
0
-4 -3 -2 -1 0 1 2 3 4

f(x) N=1 f(x) N=5 f(x) N=15 f(x) N=51

f(x)
x
N=1 N=5 N=15 N=51
-3.1 0.298658 0.108455 0.048441 0.037484
-2.4 0.631917 0.760959 0.744237 0.741338
-1.7 1.406746 1.429559 1.443753 1.441694
-1 2.258731 2.133122 2.140974 2.141869
0 2.844036 3.036437 3.101855 3.129351
1 2.258731 2.133122 2.140974 2.141869
1.7 1.406746 1.429559 1.443753 1.441694
2.4 0.631917 0.760959 0.744237 0.741338
3.1 0.298658 0.108455 0.048441 0.037484

i) When N increases, the line becomes straighter. The turning point of the graph at x=0 becomes
sharper.
ii) If N approaches to infinity, the graph will be the same as f(x) = π -|x| in question 2.
iii)
x f(x) f(x), N=1 f(x), N=51 (y'-y)^2, N=1 (y'-y)^2, N=51
-3.1 0.041592654 0.29865794 0.03748393 0.066082563 1.68816E-05
-3 0.141592654 0.31029873 0.140426217 0.02846174 1.36057E-06
-2.9 0.241592654 0.33453399 0.241739548 0.008638093 2.15779E-08
-2.8 0.341592654 0.37112158 0.342237895 0.000871958 4.16336E-07
-2.7 0.441592654 0.41969592 0.442018032 0.000479467 1.80947E-07
-2.6 0.541592654 0.47977168 0.541513617 0.003821833 6.24688E-09
-2.5 0.641592654 0.55074859 0.641221228 0.008252643 1.37957E-07
-2.4 0.741592654 0.63191749 0.741338068 0.012028642 6.4814E-08
-2.3 0.841592654 0.72246735 0.841671711 0.014190838 6.25003E-09
-2.2 0.941592654 0.82149343 0.941874961 0.014423823 7.96973E-08
-2.1 1.041592654 0.9280063 1.041774921 0.012901859 3.32213E-08
-2 1.141592654 1.04094172 1.141505214 0.010130611 7.64583E-09
-1.9 1.241592654 1.15917127 1.241346857 0.006793285 6.04162E-08
-1.8 1.341592654 1.28151364 1.341448674 0.003609489 2.07302E-08
-1.7 1.441592654 1.40674642 1.441693747 0.00121426 1.02199E-08
-1.6 1.541592654 1.53361834 1.541827623 6.35897E-05 5.52102E-08
-1.5 1.641592654 1.66086173 1.641714381 0.000371297 1.48175E-08
-1.4 1.741592654 1.78720521 1.741470627 0.002080506 1.48907E-08
-1.3 1.841592654 1.91138641 1.841348859 0.004871169 5.94359E-08
-1.2 1.941592654 2.03216455 1.941483662 0.008203268 1.18793E-08
-1.1 2.041592654 2.14833285 2.041748449 0.011393469 2.4272E-08
-1 2.141592654 2.25873059 2.141869269 0.013721296 7.65156E-08
-0.9 2.241592654 2.36225472 2.241696712 0.014559334 1.0828E-08
-0.8 2.341592654 2.45787086 2.341376256 0.013520621 4.68281E-08
-0.7 2.441592654 2.54462365 2.441237633 0.010615385 1.2604E-07
-0.6 2.541592654 2.62164627 2.541481226 0.006408581 1.24162E-08
-0.5 2.641592654 2.68816915 2.641942052 0.00216937 1.22079E-07
-0.4 2.741592654 2.74352761 2.742166753 3.74404E-06 3.2959E-07
-0.3 2.841592654 2.78716852 2.841770612 0.002961986 3.16692E-08
-0.2 2.941592654 2.81865585 2.940772945 0.015113458 6.71924E-07
-0.1 3.041592654 2.83767498 3.039490706 0.041582419 4.41819E-06
0 3.141592654 2.84403587 3.129351474 0.088540039 0.000149846
0.1 3.041592654 2.83767498 3.039490706 0.041582419 4.41819E-06
0.2 2.941592654 2.81865585 2.940772945 0.015113458 6.71924E-07
0.3 2.841592654 2.78716852 2.841770612 0.002961986 3.16692E-08
0.4 2.741592654 2.74352761 2.742166753 3.74404E-06 3.2959E-07
0.5 2.641592654 2.68816915 2.641942052 0.00216937 1.22079E-07
0.6 2.541592654 2.62164627 2.541481226 0.006408581 1.24162E-08
0.7 2.441592654 2.54462365 2.441237633 0.010615385 1.2604E-07
0.8 2.341592654 2.45787086 2.341376256 0.013520621 4.68281E-08
0.9 2.241592654 2.36225472 2.241696712 0.014559334 1.0828E-08
1 2.141592654 2.25873059 2.141869269 0.013721296 7.65156E-08
1.1 2.041592654 2.14833285 2.041748449 0.011393469 2.4272E-08
1.2 1.941592654 2.03216455 1.941483662 0.008203268 1.18793E-08
1.3 1.841592654 1.91138641 1.841348859 0.004871169 5.94359E-08
1.4 1.741592654 1.78720521 1.741470627 0.002080506 1.48907E-08
1.5 1.641592654 1.66086173 1.641714381 0.000371297 1.48175E-08
1.6 1.541592654 1.53361834 1.541827623 6.35897E-05 5.52102E-08
1.7 1.441592654 1.40674642 1.441693747 0.00121426 1.02199E-08
1.8 1.341592654 1.28151364 1.341448674 0.003609489 2.07302E-08
1.9 1.241592654 1.15917127 1.241346857 0.006793285 6.04162E-08
2 1.141592654 1.04094172 1.141505214 0.010130611 7.64583E-09
2.1 1.041592654 0.9280063 1.041774921 0.012901859 3.32213E-08
2.2 0.941592654 0.82149343 0.941874961 0.014423823 7.96973E-08
2.3 0.841592654 0.72246735 0.841671711 0.014190838 6.25003E-09
2.4 0.741592654 0.63191749 0.741338068 0.012028642 6.4814E-08
2.5 0.641592654 0.55074859 0.641221228 0.008252643 1.37957E-07
2.6 0.541592654 0.47977168 0.541513617 0.003821833 6.24688E-09
2.7 0.441592654 0.41969592 0.442018032 0.000479467 1.80947E-07
2.8 0.341592654 0.37112158 0.342237895 0.000871958 4.16336E-07
2.9 0.241592654 0.33453399 0.241739548 0.008638093 2.15779E-08
3 0.141592654 0.31029873 0.140426217 0.02846174 1.36057E-06
3.1 0.041592654 0.29865794 0.03748393 0.066082563 1.68816E-05

number of data, Σ(y'-y)^2, N=1 RMSE, N=1


m
63 0.767621231 0.11038326
Σ(y'-y)^2, RMSE,
N=51 N=51
0.000200476 1.78E-03

a) RMSE for N=51 is smaller than that of N=1. When N increases, RMSE decreases. This is because
the higher the N, the more accurate the result and less error produced. So, Fourier series of f(x) with
N=51 is closer to the actual f(x) in the range of –π < x < π.
b) If N approaches to infinity, RMSE will approach to 0 because no error will be produced.

Anda mungkin juga menyukai