|
Foxes Team
|
This is a quite unknown problem that arise when
we want to plot
univariate function f(x) sampled with regular step. This usually
happens, for example, in a spreadsheet. We have to admit that it is very rare,
but, when it happens, it can lead to catastrophic conclusion. Let' see.
Example
1
Take the following function
![]()
with w = 316
We want to approximate in the given range 0 ≤ t ≤
8 its non trivial zeros and its maximum
and minimum with a moderate accuracy, for example about
10%,
Pretend you are a bit lazy student and you are
searching for a quick and easy solution.
Let's prepare the function plot in Excel. We
presume that a plot with 80 points should be fine. Therefore we choose a
sampling step h = 8/80 = 0.1
|
|
Insert
the functions: =$B$2+A5
in the cell A6 =EXP(-A6)*SIN($B$1*A6)
in cell B6 Select the
range A6:B6 and drag it down for generating the points that you want, For
example up to A90:B90 |
Now select the range A4: B90 and draw a scatter
graph ![]()
h=0.1 , 80 points

The plot seems quite good. It shows that the
first non trivial zero crosses near
t0 @ 1.7 ; the
maximum happens for about tmax @ 0.6 and the minimum for about about
tmin @ 2.3
Is all that OK?
Unfortunately not, because the conclusions are
COMPLETELY WRONG !
The plot that we are watching is completely
false. It shows a function that does not exist!
We are watching something generated by the aliasing
phenomenon; as kind of mirage.
To check the presence of the aliasing is easy.
Simply change a little the step h , increasing or
decreasing by a relative smal amount, for example h = 0.1+0.01.
The curve will changes
suddenly.
h = 0.11, 80 points

Now we start to think that there is something
that does not work.
We guess to solve the problem reducing the step
and increasing the number of the points
We presume that a plot with 800 points should
be OK. Therefore we choose a sampling step h = 8/800 = 0.01
The function plot looks like the following
h=0.01, 800 points

Also this immage is completely false. It is
only another pattern generated by the aliasing.
It may be interesting, but it is not the true
function plot.
But what is the true plot of the function f(t)?
We have to admit that, despite the apparently
simple formula of the function f(t), it's rather difficult to obtain a good plot.
The reason is quite similar to a "stiff" differential problem. Before
plotting, we have to study a bit the function itself. There are two very
different time constants that requires two separate
plots in order to achieve a good, global comprehension of the function
evolution.
The first time constant is the period of the
oscillating part.
![]()
The second time constant comes form the exponential part
![]()
Taking a step h << T we surely avoid the aliasing and we
obtain a true image of the f(t)
h = 0.0005, points = 800

We finally note the rapid oscillating behavior
of the function. We can observe also the slowly decaying of the envelope of the
function itself. As we increase the scale, the oscillations
approaches each other until they are undistinguishable while the
envelope assume the characteristic exponential decay.
An "ideal" image of the plot could be
the following, where the coloured area represent the
oscillations

One way to observe the envelope image is to
choose a random sampling plot
where the x values are obtained with the function
= a+(b-a)*RANDOM(), with a = 0, and b = 5
A random plot looks like the following
[t = 5*RANDOM(), y =
Exp(-t)*SIN(316*t) ], 800 points

Or, alternatively, a "quick and
dirty" method for observing the envelope is to regulate the step h until
the image looks reasonable good. Usually choosing decimal values breaks the
aliasing effect.
h= 0.00433, 800 steps

Then, synthesizing, aliasing effects may appear
when
Automatic symbolic plotting programs like CAS
that operates directly on the functions f(t) itself instead
of the sampled data [ti, f(ti)],
may avoid the aliasing traps giving you the correct information, but... do not
trust in them too much. Always study the function and check the results.
Good Bye