1
$\begingroup$

Given a harmonic signal of a certain frequency and amplitude, what is the optimal way of "turning on" this signal from zero to full amplitude within a given time window under the constraint to minimize bandwidth (lowest possible frequency cutoff)?

A mathematical formulation or sketch of the solution would be much appreciated, also any pointers towards the right toolkit (e.g. "variational ansatz", "Fourier integration" etc.).

Motivation: I'm writing a finite-difference time domain simulation to study the propagation of electromagnetic waves and noticed artefacts (violation of energy conservation, superluminal speeds, weird wavefronts and diffraction patterns). Upon closer inspection, I'm suspecting the abrupt turning-on of the source (emitter) as a possible cause and would like to test implementing a "smoothed" transient.

$\endgroup$
2
  • $\begingroup$ On a side note, I'm also wondering if there exists something like a brachistochrone for this problem, i.e. an optimal solution that also minimizes the time window required for turning on the signal. $\endgroup$ Aug 12, 2022 at 20:16
  • 2
    $\begingroup$ You could try $\exp(-t^{-2})$ for $t>0$. All derivatives vanish at $t\to+0$ and it fades from 0 to 1 as quickly as you want, simply by rescaling the t-axis. As time-derivatives are directly related to the asymptotic behaviour of the Fourier transform, you can make an educated hand-waving argument that this could be very close to ideal. $\endgroup$
    – Jazzmaniac
    Aug 12, 2022 at 22:15

2 Answers 2

1
$\begingroup$

The trick to designing or choosing the "best" fade-in is to decide what your requirements are and what criteria you will use to rank order them.

You can certainly view this as a windowing problem but there are different ways to look at it.

For starters, you want to choose the right phase. A sine wave is easier to fade-in than a cosine since it starts at 0 and you are not starting with a discontinuity.

Since you are looking a difference equations. It may be nice to control the derivatives of the fade-in window. Assuming you are fading in over the interval $[0 1]$ and what the derivatives to be continuous up to order $n$ you have the following boundary conditions

$$f(0) = 0, f(1) = 1, f^{(1)}(0) = ... = f^{(n)}(0) =0, f^{(1)}(1) = ... = f^{(n)}(1) =0 $$

That's $2n+2$ boundary conditions and can be met, for example, with a polynomial of order $2n+2$ . These general have the shape of

$$f_n(x) = \int x^n \cdot (x-1).^ dx $$

normalized to $f(1) =1 $. Examples $f_1(x) = -2x^3+3x^2$, $f_2(x) = 6x^5-15x^4+10x^3$ etc.

Whether these are "better" or not than conventional windows is hard to tell.

$\endgroup$
0
$\begingroup$

If you only mean the turn-on part then you mean one half of a window. And if your aim is to minimize the harmonics then what you're looking for is the window which has the minimum effect on harmonics. I'd go with the discrete prolate spheroidal window. The next best would be the Kaiser, Saramaki, Ultraspherical, Dolph-Chebyshev, or any others that fit your requirements (see this list on Wikipedia, for example). Or if you manage to coerce an equiriple impulse response to give you an approximation for the window but, beware, you wil get monsters, since the optimization ruins the zero crossings of the $\text{sinc}()$.


Well, here's a bit of a cold shower: it doesn't matter what you're using as long as it starts gradually from sero to maximum. Yes, even a basic, discontinuous ramp will do. It doesn't even matter what length the fade-in is. Here are some tests made with the 3rd order smooth step (as proposed by @Hilmar), with Kaiser and Bartlett windows, respectively, all with fade-ins from 10% to 90%, with 10% increment:

length of fade-in doesn't matter

The Bartlett window has its characteristic attenuation (more like hints of it), otherwise all are almost overlapping. Here's a larger plot for 50% fade-in:

50%, all the same

The signal is a sine with 1 rad phase, x=sin(2*pi*1/13*t+1), for 100 samples, to show both that the initial phase of the signal doesn't matter as long as the fade-in starts from zero, and that the non-zero sample at the end has no influence since it's out of the fade-in's reach. Using it with a clean sine will show a very similar graph (don't take my word for it, test it). Plus, if the signal starts with a non-zero phase then that will count as a step input, which means you need that attenuated, since minimal bandwidth is one of your requirements.

$\endgroup$
5
  • $\begingroup$ Hi, thanks for your input! I'm looking through the Wiki now...what do you mean by the last sentence, i.e. coercing an equiriple response and "monsters"? $\endgroup$ Aug 12, 2022 at 21:14
  • $\begingroup$ Ok, I understood your point regarding "equi-riple" response (meaning the minimization of sidelobes). I'm wondering, though, how to algorithmically apply a half-window function to just the beginning of the signal. Maybe section-wise definition, e.g. in pseudo-code for time <= t_halfwindow: half_hanning(time)*sine(time); for time > t_halfwindow: sine(time)? $\endgroup$ Aug 12, 2022 at 21:25
  • $\begingroup$ By the way, the signal (obviously) is discretized onto a grid with a step size of typically 1/10 wavelength (i.e. sampling rate of 10) $\endgroup$ Aug 12, 2022 at 21:57
  • $\begingroup$ @mattze_frisch Either calculate the window and discard the last half (and multiply the input by it) or, if you're using a for() loop, use it only until half. About the equiripple part, calculate the impulse response for some filter, then do the same with the basic sinc() (with as close as possible parameters). Then divide the two. If you'll be doing this with a window vs no window, you should get back the window (within numerical limits, there may be close to zero samples). It works because the zero crossings are not affected by the window, while the equiripple changes them. $\endgroup$ Aug 13, 2022 at 8:03
  • $\begingroup$ Just to be clear: that's not to say that the properly windowed whole signal will not be affected by the window -- it will be, obviously, since the ends of the window take care that the samples are zero, or close to zero at both ends (e.g. Tukey). $\endgroup$ Aug 14, 2022 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.