skewness measures the asymmetry about the mean.
Kurtosis is the fourth moment about the mean. It measures the
peakedness/flatness of a distribution relative to a normal distribution.
‘Smoothing’ a series of data values, often a function of time, allows us to look at a data set and find some information about the data that indicates the general trends. Usually this is performed by applying a low-pass or band-pass filter using the process of convolution which we will discuss later. However, this ‘filtered’ information can be contaminated by ‘noise spikes’ or outliers. Before smoothing the data, we can remove ‘noise spikes’ by applying a median filter.
The median is the middle value of a set of numbers. A median filter picks the median of a set of numbers from a group of numbers specified by the window length. This idea can be used to remove noise spikes from a data set. Let
1, 4, 5, 3, 6, 4 ,52, 1, 3, 5, 4, 23, 5, 5, 3, 6, –100, 9, 6
be the measured data. The large values, e.g., 52, 23 and –100, are probably noise. We can remove these ‘outliers’ with a 3 point median filter.
2nd window 4, 5, 3 sort = 3, 4, 5, median = 4
3rd window 5, 3, 6 sort = 3, 5, 6 median = 5
etc.
You can implement a median filter by using a sort subroutine and passing to the subroutine the data to be filtered beginning at the start of each window in succession.
Assume that the subroutine SORT is given a vector X of Length NSORT and returns the sorted vector Y. The following code will work except for end points:
PARAMETER (NX = 100, NSORT = 3)
REAL X(NX), Y(NSORT), F(NX)
:
:
ISORT = NSORT/2
DO J=1, NX – NSORT + 1
CALL SORT (X(J), NSORT, Y)
F(J + ISORT) = Y (ISORT + 1)
END DO
The median filtered result is now in F.
Why is the DO LOOP terminated at NX – NSORT + 1?
What are the first and final values for F?
What happens if NSORT = 5?
Convolution is described by the mathematical equation:
or
h (t) = f (t) * g (t)
Note that the symbol (*) does not mean multiplication, it means convolution.
This operation can also be done after a Fourier transform, by taking the Fourier transform of f(t) and g(t), to obtain F(w) and G(w) and then multiplying F(w) and G(w) to get H(w). Then take the inverse Fourier transform of H(w) to get h(t). Note:
where e-iwt and
eiwt are the kernals of the Fourier transform.
We will come back to this later.
There are 3 ways to perform the convolution integral:
Construct the following table:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h0 = g0f0
h1 = g1f0 + g0f1
h2 = g2f0 + g1f1 + g0f2
h3 = g2f1 + g1f2
h4 = g2f2
2) Delay, multiply, and add.
Begin, by flipping (reversing) one of the series. We assume that
all undefined positions are zero.
| g0 | g1 | g2 | ||||
| f2 | f1 | f0 |
| g0 | g1 | g2 |
|
|||
| f2 | f1 | f0 |
| g0 | g1 | g2 |
|
|||
| f2 | f1 | f0 |
c) Delay again by 1, multiply, and add to get h2.
| g0 | g1 | g2 |
|
|||
| f2 | f1 | f0 |
d) Delay again by 1, multiply, and add to get h3.
| g0 | g1 | g2 |
|
|||
| f2 | f1 | f0 |
e) Delay one last time, multiply, and add to get h4.
| g0 | g1 | g2 |
|
|||
| f2 | f1 | f0 |
Use this algorithm to write your computer program.
3) Z-transforms (polynomial multiplication).
LetF(z) = f0 + f1z-1+ f2 z-2
and
G(z) =g0 + g1z-1+ g2 z-2
If we let z = eiw, then:
F (w) = f0+ f1 e-iw+ f2 e-2iw
and
G (w) = g0+ g1
e-iw+ g2
e-2iw
Convolution Theorem: f (t) * g (t) < --------> F (w) G (w)
f (t) * g (t) < --------> F (z) G (z)
therefore
F (z) G (z) = (f0 + f1z-1+
f2 z-2)(g0+
g1 z-1+ g2
z-2)
= g0f0
+ (g1f0 + g0f1)z-1
+ (g2f0 + g1f1 + g0f2)z-2
+ (g2f1 + g1f2)z-3
+ g2f2 z-4