6 Discrete sine transform and cosine transform

We mentioned (without giving proof) that the set of functions cos(n2π(xx0)(2L)) and sin(n2π(x x0)(2L)) with n = 0,1,is a “complete set” in expanding any function in the interval (x0,x0 + 2L), where x0 is an arbitrary point. Therefore Fourier series use both cosine and sine as basis functions to expand a function. Let us introduce another conclusion (again without giving proof) that the set of sine functions sin((x x0)(2L)) with n = 1,2,is a “complete set” in expanding any function h in the interval (x0,x0 + 2L). A similar conclusion is that the set of cosine functions cos((x x0)(2L)) with n = 0,1,2,is a “complete set” in expanding any function h in the interval (x0,x0 + 2L). Note that the argument of the basis functions used in the Fourier expansion differ from those used in the sine/cosine expansion by a factor of two.

The first five basis functions used in Fourier expansion, sine expansion, and cosine expansion are plotted in Fig. 2.


pict

Figure 2: The first five basis functions used in Fourier expansion (upper), sine expansion (middle), and cosine expansion (lower) in the interval [x0,x0 + 2L] with x0 = 0 and L = 1.

 

The basis function bk(x) used in the Fourier expansion have the properties bk(x) = bk(x0 + 2L). Therefore Fourier expansion works best for function that satisfy h(x0) = h(x0 + 2L). For a functions that do not satisfies this condition, i.e., a function with h(x0)h(x0 + 2L), the function can still be considered as a periodic function with period 2L but having discontinuity points at the interval boundary. It is well known that Gibbs oscillations appear near discontinuity points, which can be inner points in the interval or at the interval boundaries.

The basis functions bk(x) used in the sine expansion have the properties bk(x0) = bk(x0 + 2L) = 0. Therefore this expansion works best for functions that satisfy h(x0) = h(x0 + 2L) = 0. For functions that do not satisfies this condition, there will be Gibbs oscillations near the boundaries when approximated by using the sine expansion. Examples are shown in Fig. 3.


pict pict

Figure 3: Left: constant function h(x) = 1 approximated by using the sine expansion. Right: linear function h(x) = x 1 approximated by using the sine expansion. Gibbs oscillation appears near the boundaries, where h(x) does not satisfy the condition h(x0) = h(x0 + L) = 0 (x0 = 0 and L = 2 for this case). The expansion coefficients Hk are obtained via the discrete sine transform (55) with number of sampling point N = 50. The reconstruction formula is given by h(x) = 2-
N k=1N1Hk sin(kπx
 L).

Similarly, the basis functions bk(x) used in the cosine expansion have the properties bk(x0) = bk(x0 + 2L) = 0. Therefore this expansion works best for functions that satisfy h(x0) = h(x0 + 2L) = 0. For functions that do not satisfies this condition, there will be Gibbs oscillations near the boundaries when approximated by using the cosine expansion (to be verified numerically).

Next, let us discuss the sine and cosine transformation. Figure 4 illustrates the grids used in the following discussion.


pict

Figure 4: Grid indexes start from 0 and ends at N. h0 = hN = 0, i.e., h(x0) = h(x0 + L) = 0.

 6.1 Traditional defintion of discrete Sine Transform (DST)
 6.2 Define DST via DFT
 6.3 Reconstruct original function using DST
  6.3.1 Inverse DST
 6.4 Discrete Cosine transform