(2)O O O (1)O 9.3 Application Fourier Series of Piecewise Smooth Functions (p608)To define piecewise functions you can use either piecewise (do ?piecewise for the syntax) or use the book's suggestion, which is to define a function "unit" that is one on the interval (a,b) and zero otherwise:unit := (t,a,b) -> Heaviside(t-a) - Heaviside(t-b);unit:=t,a,b/HeavisidetKaKHeavisidetKbplot(unit(t,0.5,1.5),t=-2..2);K2K1 0 1 20.20.40.60.81.0Here is the function in Figure 9.3.8. This function is even, thus to find its Fourier coefficients we only need to define it on [0,Pi]:f := t -> (Pi/3)*unit(t, 0, Pi/6) + (Pi/2 - t)*unit(t, Pi/6, 5*Pi/6) + (-Pi/3)*unit(t, 5*Pi/6, Pi);f:=t/13 p unit t, 0,16 p C12 pKt unit t,16 p,56 pK13 p unit t,56 p, pTo double check that we have the correct expression we can plot the functionplot(f(t),t=0..Pi);(3)O O (5)O (4)1 2 3K1.0K0.500.51.0Since the function is EVEN b_n = 0 for n>=1, thus we only compute the a_n:a := n -> (2/Pi) * int(f(t)*cos(n*t),t=0..Pi);a:=n/2 0pf t cosn tdtpThe "assuming integer" at the end of the expression tells Maple that n is an integer for addition simplifications, however an expression does not come to mind!a(n) assuming integer;2 cos16 n pKcos56 n pp n2So we simply compute the Fourier sum, with say 25 termsfouriersum := a(0)/2 + sum(a(n)*cos(n*t),n=1..25);fouriersum:=2 cost 3pK225 3 cos 5 tpK249 3 cos 7 tp(5)O C2121 3 cos 11 tpC2169 3 cos 13 tpK2289 3 cos 17 tpK2361 3 cos 19 tpC2529 3 cos 23 tpC2625 3 cos 25 tpAnd we check that the Fourier sum is consistent with the function we asked.plot(fouriersum, t= -2*Pi..3*Pi);K6K4K202 4 6 8K1.0K0.50.51.0In the same way it is possible to compute the coefficients b(n) for odd functions or more generally the a(n) and b(n) for general (not odd neither even)
View Full Document