MATH 480: Homework 5 SPRING 2011

Assigned: March 1, 2011
Due: March 9, 2011
MATH 480: Homework 5
SPRING 2011
Fourier Series:
1. (a) Find the Fourier sine series for f (x) = 1 − x defined on the interval 0 ≤ x ≤ 1.
(b) In MATLAB, plot the first 20 terms and the first 200 terms of the sine series
in the interval −3 ≤ x ≤ 3.
(c) To what value does the series converge at x = 0?
2. (a) Find the Fourier cosine series for f (x) = 1−x defined on the interval 0 ≤ x ≤ 1.
(b) In MATLAB, plot the first 20 terms and the first 200 terms of the cosine series
in the interval −3 ≤ x ≤ 3.
(c) To what value does the series converge at x = 0?
3. (a) Find the Fourier series for
(
0
f (x) =
1 − x2
if − 1 ≤ x < 0
if 0 < x ≤ 1
defined on the interval −1 ≤ x ≤ 1.
(b) In MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series
in the interval −3 ≤ x ≤ 3.
(c) To what value does the series converge at x = 0?
4. The Fourier series of the function f (x) = cos(ax) on the interval [−π, π], when a is
not an integer, is given by
"
#
∞
X
2a sin(aπ) 1
(−1)n+1
cos(ax) =
+
cos(nx)
π
2a2
n2 − a2
for
− π ≤ x ≤ π.
n=1
(a) Differentiate both sides of this equation with respect to x, differentiating the
series term by term, to find the Fourier series for sin(ax):
"∞
#
2 sin(aπ) X (−1)n n
sin(nx)
sin(ax) = −
π
n2 − a2
for
− π < x < π.
n=1
(b) Explain why this method for computing the Fourier series is valid.
(c) If you know the Fourier series for sin(ax) given in (a), why can you not differentiate it term by term with respect to x to derive the Fourier series for
cos(ax).
1
Assigned: March 1, 2011
Due: March 9, 2011
(d) Now consider the Fourier series of sin(ax) given in (a) as known. Explain why
it can be integrated term by term to get the Fourier expansion of cos(ax).
(e) Carry out this term by term integration from 0 to x, and use it to show that
∞
A0 =
sin(aπ)
2a sin(aπ) X (−1)n
=1+
.
aπ
π
n2 − a2
n=1
5. Let cn be the coefficients of the complex Fourier series of f (x). Show that if f (x) is
a real-valued function, then c−n = c̄n .
2
{* kt1lr
= ryl4
'
FlVaz2#fl
4 @'(v-r'j , /
'r =
==.yF(x-4
, / 7t7
0
x-/ =?E
C)=- / (,/ ,
Laz + 4tvJ
.*
k/r'al
).2,1/-nq1
)Treg22
D"-,t/-"P
'"rl tf
/'"-ta-n%
=-
--*Vx!q,(?(+-/)
/= 7
l7
7
r-
x7 O
_q # /14,4 :o/h
g.vo.u o 7cs
3p,
zA-c** tp Fo un'e-r
e1
f7t*n'z'r
_/
/- x "
o <x<y'
/,") - 4" - )_ /4oaa|!_i_lzdt:'Z!
1/-x')4.K - +
/-/- x') e& n vk zzr .=
1z-x) a'rrz* ax ,,-r_z tz.flac.lteA
ffrzaZl
_
M".tuA
€rzdnzr
d441-€.x
Fbum'er
-l
ef
Assigned: March 1, 2011
Due: March 9, 2011
Problem # 1 (b)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
HW # 5: pr1b.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clf;
x=-3:1e-3:3;
NN=20;
FS=0;
for n=1:NN
Bn=2/(n*pi);
FS=FS+Bn*sin(n*pi*x);
end
figure(1); clf(1)
subplot(2,1,1), plot(x,FS);
xlabel(’x’)
ylabel([’First ’,num2str(NN), ’ terms of Fourier sine series’])
title([’First ’,num2str(NN), ...
’ terms of the Fourier sine series for the function f(x)=1-x defined on 0<=x<=1’])
axis([-3 3 -1.5 1.5])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NN=200;
FS=0;
for n=1:NN
Bn=2/(n*pi);
FS=FS+Bn*sin(n*pi*x);
end
subplot(2,1,2), plot(x,FS);
xlabel(’x’)
ylabel([’First ’ ,num2str(NN), ’ terms of Fourier sine series’])
title([’First ’,num2str(NN), ...
’ terms of the Fourier sine series for the function f(x)=1-x defined on 0<=x<=1’])
axis([-3 3 -1.5 1.5])
print -depsc2 pr1b_graph.eps
Problem # 2 (b)
5
Assigned: March 1, 2011
Due: March 9, 2011
First 200 terms of Fourier sine series
First 20 terms of Fourier sine series
First 20 terms of the Fourier sine series for the function f(x)=1−x defined on 0<=x<=1
1.5
1
0.5
0
−0.5
−1
−1.5
−3
−2
−1
0
x
1
2
3
First 200 terms of the Fourier sine series for the function f(x)=1−x defined on 0<=x<=1
1.5
1
0.5
0
−0.5
−1
−1.5
−3
−2
−1
0
x
1
2
3
Figure 1: Problem 1 (b): Fourier sine series for f (x) = 1 − x. Note Gibbs phenomenon at
points of discontinuity of the Fourier sine series: overshoot of about 0.2. This overshoot
is about 9% of the function jump: 2 ∗ 0.9 = 0.18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HW #5: pr2b.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clf;
x=-3:1e-3:3;
NN=20;
FS=1/2;
for n=1:NN
An=2*(1-(-1)^n)/(n^2*pi^2);
FS=FS+An*cos(n*pi*x);
end
figure(1); clf(1)
subplot(2,1,1), plot(x,FS);
xlabel(’x’)
ylabel([’First ’,num2str(NN), ’ terms of Fourier cosine series’])
title([’First ’,num2str(NN), ...
6
Assigned: March 1, 2011
Due: March 9, 2011
’ terms of the Fourier cosine series for the function f(x)=1-x defined on 0<=x<=1’])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NN=200;
FS=1/2;
for n=1:NN An=2*(1-(-1)^n)/(n^2*pi^2);
FS=FS+An*cos(n*pi*x);
end
subplot(2,1,2), plot(x,FS);
xlabel(’x’)
ylabel([’First ’,num2str(NN), ’ terms of Fourier cosine series’])
title([’First ’,num2str(NN), ...
’ terms of the Fourier cosine series for the function f(x)=1-x defined on 0<=x<=1’])
First 200 terms of Fourier cosine series
First 20 terms of Fourier cosine series
print -depsc2 pr2b_graph.eps
First 20 terms of the Fourier cosine series for the function f(x)=1−x defined on 0<=x<=1
1
0.8
0.6
0.4
0.2
0
−3
−2
−1
0
x
1
2
3
First 200 terms of the Fourier cosine series for the function f(x)=1−x defined on 0<=x<=1
1
0.8
0.6
0.4
0.2
0
−3
−2
−1
0
x
1
2
3
Figure 2: Problem 2 (b): Fourier cosine series for f (x) = 1 − x. There is no Gibbs
phenomenon since Fourier cosine series for f (x) is continuous
7
Assigned: March 1, 2011
Due: March 9, 2011
Problem # 3 (b)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HW # 5: pr3b.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clf;
x=-3:1e-3:3;
NN=20;
FS=1/3;
for n=1:NN
An=2*(-1)^(n+1)/(n^2*pi^2);
Bn=(2*(-1)^(n+1)+n^2*pi^2+2)/(n^3*pi^3);
FS=FS+An*cos(n*pi*x)+Bn*sin(n*pi*x);
end
figure(1);clf(1)
subplot(2,1,1), plot(x,FS);
xlabel(’x’)
ylabel([’First ’,num2str(NN), ’ terms,of Fourier series’])
title([’First ’,num2str(NN), ...
’ terms of the Fourier series for the function f(x)=1-x defined on 0<=x<=1’])
axis([-3 3 -0.2 1.2])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NN=200;
FS=1/3;
for n=1:NN
An=2*(-1)^(n+1)/(n^2*pi^2);
Bn=(2*(-1)^(n+1)+n^2*pi^2+2)/(n^3*pi^3);
FS=FS+An*cos(n*pi*x)+Bn*sin(n*pi*x);
end
subplot(2,1,2), plot(x,FS);
xlabel(’x’)
ylabel([’First ’,num2str(NN), ’ terms of Fourier series’])
title([’First ’,num2str(NN), ...
’ terms of the Fourier series for the function f(x)=l-x defined on 0<=x<=l’])
axis([-3 3 -0.2 1.2])
8
Assigned: March 1, 2011
Due: March 9, 2011
print -depsc2 pr3b_graph.eps
First 20 terms,of Fourier series
First 20 terms of the Fourier series for the function f(x)=1−x defined on 0<=x<=1
1.2
1
0.8
0.6
0.4
0.2
0
−0.2
−3
−2
−1
0
x
1
2
3
First 200 terms of Fourier series
First 200 terms of the Fourier series for the function f(x)=l−x defined on 0<=x<=l
1
0.8
0.6
0.4
0.2
0
−0.2
−3
−2
−1
0
x
1
2
3
Figure 3: Problem 3 (b): Fourier series for f (x). Note Gibbs phenomenon at points 0,
±2, ±4, . . . , ±2n, . . ., n integer, where Fourier series is discontinuous. The overshoot there
is about 0.1 that agrees with the theoretical prediction since function jump is 1, so that
9% of it is 1 ∗ 0.09 = 0.09 ≈ 0.1. At points ±1, ±3, . . . , ±(2n + 1), . . ., there is no Gibbs
phenomenon since Fourier series is continuous there.
9
/o
{-9:L4zJ 1=?
Z
oa,/ (zzr,
-v-<axzT
lraf?<j
lzkt/
/L bh /tr?
.- a.alz ltzr
/(r' /77 -
-/ )
/ / "'-12
- v4-r,zz
, h zz hrz /
/no4!r.z
L" e€4afir;Lzatry
)* iaalrzr )
'-
J7'/r't-( -
? 1/ a ./.{
tZ, ?-1 1 +T-Ati
:+):ze'ry21'r7)= 7n1ar
vlzszzt- -r1a7rt:
"4 '/+,
/-/J -/ A!Ll-.44€'-, r'oolg+
t4z!, ra_,{Z}_ aE- - :/2* e.:qe4--
/?/'/c e,
a)z(a.r
.4at
Ft-t
t /.,2
,y'2/42)
?'
d€,,"/4/
td(
/z.eA 4
O/
tllLl-7
vtd{
4
zzr+
761-4t72)-o
lt
Ahea
/z.kr.
,Qzt-.ao
,q42-
/1/-
Fzl/szZ
4rt1az,4
7p zz1/4 zrz at "1 Xa a4 /za-a._
rru7,a>z
k.€
-&: 1t'?t'*"*,'.*.7
ltaza./aaf
{i
",
2t
rzz#c;
A, q
zz-a/
z"rrrz-+.2
/,/
v_+-E_at.,-r--
:- /1l*t<4-4 --
,/5;el;s=-4."t?a4=
S"Srv2.aty'.
'
lid1Jt)x
tk -/-
Z
-4a-:-/:
I
.44 c,P.J,,7y
.4 --.lt hk7- ---=4
/,2*-)
t'
-ee,--i4r-
'f
( -/ )
,1=7 //,_4
-
r'"z
'..)
*
z
c,"
e
*. nFr/z-
y't) e
= lft;
aP a6s'7'r,r'72roro. -=a ff.)
*{,, e
e-r
/ /+t
"q:J
rrtrrolll
:
C.
e