Closed arturgower closed 2 years ago
I suppose there's no reason not to have both, one called DiscreteImpulse
and the other ContinuousImpulse
. Users wouldn't even have to see them, they'd just use the most relevant constructor and multiple dispatch will decide how to compute with them.
Currently the struct
impulse
is very elegant: it has two fields, which are functions representing the impulse in time and frequency (one being the analytic Fourier Transform of the other). However, I think the struct should be easy to use and understand for the most common cases of use. These are: 1) simple analytic functions like a discrete delta and Gaussian 2) providing a discrete impulse in either time (most common) or frequency. This is always the case when comparing with experiments.In both cases, it should be easy to plot both the impulse in time and frequency, even if the user only provided the impulse in, say, time. Currently I think it is not easy to provide 2, and even the inability to plot the discrete delta function in 1 will confuse most. For example, after sampling the discrete delta in frequency, it can be useful to look at the resulting impulse in time, and vice-versa (a common exercise in signal processing). It helps decide how to sample the frequency.
I think it will make our lives easier to use instead
One draw back is that it seems that both the vectors
ω
andt
need to be supplied. But this is not really an issue in practice, and, for example, the impulse in time can be easily re-sampled from the impulse in frequency for a differentt
vector.Although the struct
impulse
is elegant, and is more flexible than above, there is no clear example where this flexibility is needed. And I think it is not worth the added complications of trying to convert impulse vectors to functions.