|


Using Phase Shifts to Modify a Sine CurveDate: 06/30/2005 at 11:03:53 From: John Subject: Fattening a Sine wave. Hi. What modifiers can be used to fatten a sine wave while not affecting the zeros and peaks? It seems the addition of a cos(angle) to the angle in the sin() can do this, but I have difficulty controlling the rest of the wave.
Date: 06/30/2005 at 12:47:25
From: Doctor Douglas
Subject: Re: Fattening a Sine wave.
Hi John.
You can think about this problem in the following way. First,
consider the graph of the sine wave:
y(t)
|
| cC This is crude ASCII art;
| B D view using a monospaced font.
|
-A----+--e-E----+----I------> t
|
| F H
| Gg
|
Curve ABCDEFGHI is your regular sine wave, which has zeroes at
t = 0, pi, 2*pi (points A,E,I respectively). The peak is at t = pi/2
(point C) and the valley is at t = 3*pi/2 (point G).
Now think about pulling the curve to get the shape you want. For
example, maybe you want to make the peak C occur earlier (say at point
c) and G be later (at g). Let us also advance point E by an amount
twice the shift of c and g (point e). Note that these movements are
HORIZONTAL movements of the peak, valley, and zero-crossing. You also
can define horizontal movements of other points such as D to d and H
to h (not shown), to keep a smooth curve. Points A and I must remain
fixed. The new curve is AbcdefghI in the above diagram (although
points b,d,f and h are not shown).
The function that goes through these points is the following:
y = A*sin[2*pi*t + phi(t)]
where the phase phi(t) has the following properties:
1. If phi(t) = 0, the point is unshifted.
2. If phi(t) > 0, the point is advanced. (Wwhy? If phi>0, then
it takes a smaller value of t to arrive at that level.)
3. If phi(t) < 0, the point is retarded.
Now you can use your graph of y vs t to construct a set of points
through which phi must pass. You can make phi continuous, or
piecewise linear, or use whatever interpolation method you want, as
long as it goes through all of the control points {A,b,c,...} that you
need. It's usually wise to keep |phi(t)| small (certainly no more
than 2*pi) so that your resulting sine wave is a gentle distortion,
rather than being ripped apart into some unrecognizable shape.
For the above graph of y vs t, the graph of phi will look something
like this:
phi(t)
| e phi(ABCDEFGHI) is identically 0.
| d
| c phi(Abcdefghi) is some messy
| b f but continuous curve.
-A-B--C--D-E-F--G--H-I----
| h
| g
Any graph that goes through AbcdefghI will work. You can probably see
how one could define phi as a piecewise linear function, as in the
example in this archived answer:
Irregular Sinusoidal Curves
http://mathforum.org/library/drmath/view/65463.html
But it doesn't have to be that way if you don't want. For example, if
the zero-crossing point E is *unshifted*, you can see that we get a
graph of phi(t) that could look like this:
|
| c
| b d
-A-B--C--D-E-F--G--H-I----
| f h
| g
That is, phi(t) could have the form -K*sin(t), where the constant
K is probably not too large. Now you can write y(t) in one line:
y = A*sin[2*pi*t - K*sin(t)]. This function will have an advanced
peak and a retarded valley.
You question above is how to "fatten a sine wave while not affecting
the zeros and peaks". I'm not exactly sure what you mean, but perhaps
it is a distortion of the form
y(t)
|
| C
|bB Dd
|
-A---------E---------I------> t
|
| fF Hh
| G
where the zero-crossings A,E,I are unaffected, as are the peak C and
the valley G. The excursions BCD and FGH are "fattened" to bCd and
fGh. If you go through the graphing of phi in the same way as the
example above, you get a graph that looks something like this:
|
| Points b and f are advanced.
| b f Points d and h are retarded.
-A-B--C--D-E-F--G--H-I----
| d h
|
Kind of looks like a sine-wave with twice the frequency, eh? Try
y(t) = y = A*sin[2*pi*t - K*sin(2*t)] and see what happens. Of course
you could also make a piecewise linear function that goes through
AbCdEfGhI in the last graph above.
I should remark that this is not the only way to generate distortions
of a sine wave. Another method is to write the distortion in terms of
Fourier Series:
y(t) = A*sin[2*pi*t] + B*sin[4*pi*t + b] + C*sin[4*pi*t + c]
+ ...
If the various harmonics and their amplitudes {B,C,...} are somehow
important, then Fourier series is the way to go (this leads to
mathematics that involves lots of integral calculus). But if you are
drawing smooth computer graphics distortions, then maybe the phase
modulation method is simpler to implement, requiring only a good
working knowledge of the trigonometric functions. It really depends
on the nature of the problem and what you're trying to do.
- Doctor Douglas, The Math Forum
http://mathforum.org/dr.math/
Date: 06/30/2005 at 13:25:24 From: John Subject: Thank you (Fattening a Sine wave.) You are horrifyingly brilliant. Thank you for all the help. I've come up with: m*sin(4*w * t/d - K * sin(2*4*w*t/d - k * sin(2*4*w*t/d))) It's ugly, but embodies the needed skew and fattening and twisting to nudge a sine wave onto the difference curve between angular and NURB spaces representing a circle. Thanks again! John |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]


Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/