WAVELETX.OMS
Script File:
# Description:
# Filters a sine wave by dropping the high order wavelet details.
#
clear
# number of data points
n = 32
#
# x and y values for each point
x = 2 * pi * seq(n) / real(n)
y = sin(x)
#
# geometry for each of the plotting windows
geometry = { ...
[0, 0, 200, 300], ...
[200, 0, 200, 300], ...
[400, 0, 200, 300] ...
}
for i = 1 to 3 begin
m = 2 * i
#
# transform y
w = wavelet(m, y)
#
# zero high order details
w = {w.row(1, n / 2), fill(0., n / 2, 1)}
#
# inverse wavelet transform
yapx = iwavelet(m, w)
#
caption = [ntoa(2 * i), " coefficient wavelet"]
gaddwin(caption, geometry.row(i))
gtitle("Filtered Sin(x)")
gplot(x, yapx)
end
Output:
|