You are on page 1of 8

298

C HAP. 5

C URVE F ITTING

The coefcients a j and b j are computed with Eulers formulas: (5) and (6) bj = 1

aj =

f (x) cos( j x) d x

for j = 0, 1, . . .

f (x) sin( j x) d x

for j = 1, 2, . . . .

The factor 1 in the constant term a0 /2 in the Fourier series (4) has been introduced 2 for convenience so that a0 could be obtained from the general formula (5) by setting j = 0. Convergence of the Fourier series is discussed in the next result. Theorem 5.5 (Fourier Expansion). Assume that S(x) is the Fourier series for f (x) over [, ]. If f (x) is piecewise continuous on [, ] and has both a left- and right-hand derivative at each point in this interval, then S(x) is convergent for all x [, ]. The relation S(x) = f (x) holds at all points x [, ], where f (x) is continuous. If x = a is a point of discontinuity of f , then f (a ) + f (a + ) , S(a) = 2 where f (a ) and f (a + ) denote the left- and right-hand limits, respectively. With this understanding, we obtain the Fourier expansion: (7) f (x) = a0 + 2

(a j cos( j x) + b j sin( j x)).


j=1

A brief outline of the derivation of formulas (5) and (6) is given at the end of the subsection.
Example 5.13. Show that the function f (x) = x/2 for < x < , extended periodically by the equation f (x + 2 ) = f (x), has the Fourier series representation

f (x) =
j=1

sin(2x) sin(3x) (1) j+1 sin( j x) = sin(x) + . j 2 3

Using Eulers formulas and integration by parts, we get aj = 1


x x sin( j x) cos( j x) cos( j x) d x = + 2 2 j 2 j 2

=0

S EC . 5.4

F OURIER S ERIES AND T RIGONOMETRIC P OLYNOMIALS


y 1.5 1.0 0.5 x 1 0.5 1.0 1.5 2 3 y = S3(x) y = S2(x) y = S4(x) y = f(x)

299

Figure 5.19 The function f (x) = x/2 over [, ] and its trigonometric approximations S2 (x), S3 (x), and S4 (x).

for j = 1, 2, 3, . . . , and bj = 1

x cos( j x) sin( j x) x sin( j x) d x = + 2 2 j 2 j 2

(1) j+1 j

for j = 1, 2, 3, . . . . The coefcient a0 is obtained by a separate calculation: a0 = 1


x2 x dx = 2 4

= 0.

These calculations show that all the coefcients of the cosine functions are zero. The graph of f (x) and the partial sums S2 (x) = sin(x) sin(2x) , 2 sin(2x) sin(3x) S3 (x) = sin(x) + , 2 3 sin(2x) sin(3x) sin(4x) + 2 3 4

and S4 (x) = sin(x) are shown in Figure 5.19.

We now state some general properties of Fourier series. The proofs are left as exercises.

300

C HAP. 5

C URVE F ITTING

Theorem 5.6 (Cosine Series). Suppose that f (x) is an even function; that is, suppose that f (x) = f (x) holds for all x. If f (x) has period 2 and if f (x) and f (x) are piecewise continuous, then the Fourier series for f (x) involves only cosine terms: (8) where (9) aj = 2
0

a0 + f (x) = 2

a j cos( j x),
j=1

f (x) cos( j x) d x

for j = 0, 1, . . . .

Theorem 5.7 (Sine Series). Suppose that f (x) is an odd function; that is, f (x) = f (x) holds for all x. If f (x) has period 2 and if f (x) and f (x) are piecewise continuous, then the Fourier series for f (x) involves only the sine terms:

(10) where (11) bj = 2


0

f (x) =
j=1

b j sin( j x),

f (x) sin( j x) d x

for j = 1, 2, . . . .

Example 5.14. Show that the function f (x) = |x| for < x < , extended periodically by the equation f (x + 2 ) = f (x), has the Fourier cosine representation f (x) = (12) = 4 2 4 2
j=1

cos((2 j 1)x) (2 j 1)2 cos(3x) cos(5x) + + 32 52 .

cos(x) +

The function f (x) is an even function, so we can use Theorem 5.6 and need only to compute the coefcients {a j }: aj = 2 2x sin( j x) 2 cos( j x) + x cos( j x) d x = 0 0 j j2 j 1) 2 cos( j ) 2 2((1) = = for j = 1, 2, 3, . . . . j2 j2

Since ((1) j 1) = 0 when j is even, the cosine series will involve only the odd terms. The odd coefcients have the pattern a1 = 4 , a3 = 4 , 32 a5 = 4 , 52 ....

S EC . 5.4

F OURIER S ERIES AND T RIGONOMETRIC P OLYNOMIALS

301

The coefcient a0 is obtained by the separate calculation a0 = 2


0

x dx =

x2

= .

Therefore, we have found the desired coefcients in (12).

Proof of Eulers Formulas for Theorem 5.5. The following heuristic argument assumes the existence and convergence of the Fourier series representation. To determine a0 , we can integrate both sides of (7) and get a0 + f (x) d x = (a j cos( j x) + b j sin( j x)) d x 2
j=1

(13)

a0 dx + 2

aj
j=1

cos( j x) d x +
j=1

bj

sin( j x) d x

= a0 + 0 + 0. Justication for switching the order of integration and summation requires a detailed treatment of uniform convergence and can be found in advanced texts. Hence we have shown that (14) a0 = 1

f (x) d x.

To determine am , we let m > 0 be a xed integer, multiply both sides of (7) by cos(mx), and integrate both sides to obtain (15)

f (x) cos(mx) d x =

a0 2 +

cos(mx) d x +
j=1

aj

cos( j x) cos(mx) d x

bj
j=1

sin( j x) cos(mx) d x.

Equation (15) can be simplied by using the orthogonal properties of the trigonometric functions, which are now stated. The value of the rst term on the right-hand side of (15) is (16) a0 2

cos(mx) d x =

a0 sin(mx) 2m

= 0.

The value of the term involving cos( j x) cos(mx) is found by using the trigonometric identity (17) cos( j x) cos(mx) = 1 1 cos(( j + m)x) + cos(( j m)x). 2 2

302

C HAP. 5

C URVE F ITTING

When j = m, then (17) is used to get

aj (18)

cos( j x) cos(mx) d x =

1 aj 2

cos(( j + m)x) d x

1 + aj 2

cos(( j m)x) d x = 0 + 0 = 0.

When j = m, the value of the integral is

(19)

am

cos( j x) cos(mx) d x = am .

The value of the term on the right side of (15) involving sin( j x) cos(mx) is found by using the trigonometric identity (20) sin( j x) cos(mx) = 1 1 sin(( j + m)x) + sin(( j m)x). 2 2

For all values of j and m in (20), we obtain

bj (21)

sin( j x) cos(mx) d x =

1 bj 2

sin(( j + m)x) d x

1 + bj 2

sin(( j m)x) d x = 0 + 0 = 0.

Therefore, using the results of (16), (18), (19), and (21) in equation (15), we conclude that (22) am =

f (x) cos(mx) d x,

for m = 1, 2, . . . . Eulers formula (6) is proved

Therefore, Eulers formula (5) is established. similarly.

Trigonometric Polynomial Approximation


Denition 5.4. (23) A series of the form TM (x) = a0 + 2
M

(a j cos( j x) + b j sin( j x))


j=1

is called a trigonometric polynomial of order M.

S EC . 5.4

F OURIER S ERIES AND T RIGONOMETRIC P OLYNOMIALS

303

Theorem 5.8 (Discrete Fourier Series). Suppose that {(x j , y j )} N are N +1 points, j=0 where y j = f (x j ), and the abscissas are equally spaced: (24) x j = + 2 j N for j = 0, 1, . . . , N .

If f (x) is periodic with period 2 and 2M < N , then there exists a trigonometric polynomial TM (x) of the form (23) that minimizes the quantity
N

(25)
k=1

( f (xk ) TM (xk ))2 .

The coefcients a j and b j of this polynomial are computed with the formulas (26) and (27) 2 bj = N
N

aj =

2 N

f (xk ) cos( j xk )
k=1

for j = 0, 1, . . . , M,

f (xk ) sin( j xk )
k=1

for j = 1, 2, . . . , M.

Although formulas (26) and (27) are dened with the least-squares procedure, they can also be viewed as numerical approximations to the integrals in Eulers formulas (5) and (6). Eulers formulas give the coefcients for the Fourier series of a continuous function, whereas formulas (26) and (27) give the trigonometric polynomial coefcients for curve tting to data points. The next example uses data points generated by the function f (x) = x/2 at discrete points. When more points are used, the trigonometric polynomial coefcients get closer to the Fourier series coefcients.
Example 5.15. Use the 12 equally spaced points xk = + k/6, for k = 1, 2, . . . , 12, and nd the trigonometric polynomial approximation for M = 5 to the 12 data points {(xk , f (xk ))}12 , where f (x) = x/2. Also compare the results when 60 and 360 points k=1 are used and with the rst ve terms of the Fourier series expansion for f (x) that is given in Example 5.13. Since the periodic extension is assumed, at a point of discontinuity, the function value f ( ) must be computed using the formula (28) f ( ) = /2 /2 f ( ) + f ( + ) = = 0. 2 2

The function f (x) is an odd function; hence the coefcients for the cosine terms are all zero (i.e., a j = 0 for all j). The trigonometric polynomial of degree M = 5 involves only the sine terms, and when formula (27) is used with (28), we get (29) T5 (x) = 0.9770486 sin(x) 0.4534498 sin(2x) + 0.26179938 sin(3x) 0.1511499 sin(4x) + 0.0701489 sin(5x).

304

C HAP. 5

C URVE F ITTING
y 1.5 1.0 0.5 x 1 0.5 1.0 1.5 2 3 y = T5(x)

Figure 5.20 The trigonometric polynomial T5 (x) of degree M = 5, based on 12 data points that lie on the line y = x/2.

Table 5.9 Comparison of Trigonometric Polynomial Coefcients for Approximations to f (x) = x/2 over [, ]
Trigonometric polynomial coefcients 12 points b1 b2 b3 b4 b5 0.97704862 0.45344984 0.26179939 0.15114995 0.07014893 60 points 0.99908598 0.49817096 0.33058726 0.24633386 0.19540972 360 points 0.99997462 0.49994923 0.33325718 0.24989845 0.19987306 Fourier series coefcients 1.0 0.5 0.33333333 0.25 0.2

The graph of T5 (x) is shown in Figure 5.20. The coefcients of the fth-degree trigonometric polynomial change slightly when the number of interpolation points increases to 60 and 360. As the number of points increases, they get closer to the coefcients of the Fourier series expansion of f (x). The results are compared in Table 5.9.

Numerical Methods Using Matlab, 4th Edition, 2004 John H. Mathews and Kurtis K. Fink ISBN: 0-13-065248-2 Prentice-Hall Inc. Upper Saddle River, New Jersey, USA http://vig.prenhall.com/

You might also like