(1.2)O (2.1)(1.1)O O O (2.2)O Gibb's phenomenon (example 9.1.1 in the book)Step function (square wave)stepfun := t -> piecewise(-Pi<t and t<0,-1,0<t and t<Pi,1);stepfun:=t/piecewiseKp !tandt! 0,K1, 0 !tandt! p, 1f := (t,N) -> (4/Pi)*sum(sin((2*k-1)*t)/(2*k-1),k=1..N);f:=t,N/4 >k= 1Nsin 2 kK1 t2 kK1pplot({f(t,10),stepfun(t)},t=-Pi..Pi);K3K2K101 2 3K1.0K0.50.51.0Even saw tooth functionsawtoothfun := t -> abs(t);sawtoothfun:=t/tg := (t,N) -> Pi/2 + sum( -4*Pi*cos((2*k-1)*t)/((2*k-1)*Pi)^2, k=1..N);O O (3.2)(2.2)O (3.1)O g:=t,N/12 p C>k= 1NK4 p cos 2 kK1 t2 kK12 p2plot({g(t,1),sawtoothfun(t)},t=-Pi..Pi);K3K2K1 0 1 2 30.51.01.52.02.53.0Odd saw tooth functionsawtoothfun2 := t -> t;sawtoothfun2:=t/th := (t,N) -> sum( (-1)^(n+1) * (2/n) * sin(n*t), n=1..N);h:=t,N/>n= 1N2 K1nC 1 sinn tnplot({h(t,10),sawtoothfun2(t)},t=-Pi..Pi);O (2.2)K3K2K101 2
View Full Document