This is an impulse signal. It’s made up of a single sample value of 1 in
an infinitely long stream of zeros. You can think about it as a burst of energy,
which arrives very quickly, and dissipates just as quickly. Suffice to say, a 1 sample
burst of energy doesn’t occur naturally in nature, but it can be generated via code.
A comparable example to an impulse would be clapping your hand, or bursting a balloon.
A very profound thing about this impulse signal is that this simple signal, this tiny 1 sample pulse
contains sinusoids of all possible frequencies representable for that sampling rate.
This may be difficult to appreciate, and certainly hard to grasp, but it practically
contains all possible frequencies. Because of this property, the impulse signal is very useful
in systems analysis, and in this particular series, filter analysis as we’ll soon see.
But first, let’s actually create an impulse signal, and put its wild claim to the test.
I’m going to use Python to create a test signal and subject it to spectrum analysis. I’ll make
the scripts available as Jupyter Notebook projects so that you may be able to interactively try these
out on your own machines if you’re interested. In another video, we can go through the scripts in
more detail, but in this video I’ll brush past the details and get cracking.
Here I’ll create a stream of zeros, say a length of 1024 samples.
For the very first sample, I’ll assign the value to be 1. This is our impulse signal,
and if we plot it, we can see a time domain graph of the impulse signal, with a single peak.
We can hear what it sounds like. I’m going to take this stream of numbers and feed it into a
function which will interpret it as sound, and I’ll see a sampling rate of 44.1kHz.
This is what it sounds like.
Unimpressive obviously, what did you expect? It sounds like a click or a glitch.
Now, for the interesting part, if we take this impulse signal and subject it to Fourier
analysis using the Fast Fourier Transforms or the FFT algorithm, we can then get the frequency
domain analysis of the signal. The output of the FFT operation is a complex signal,
and if we extract the real part of this signal and plot it on a frequency domain graph, we get this.
A straight line of magnitude 1. This indicates that all frequencies have a magnitude of 1,
and hence all frequencies of equal magnitude are present in this impulse signal.
Quite wild. We can use a more traditional spectrum analyzer to confirm this fact as well.
We heard what the impulse sounded like. Let’s just write that into a wav file,
and I’ll import it into Sonic Visualizer and open up the spectrogram?
and we can see again, that all frequencies are present.
But why? We see from the plots that an impulse signal contains sinusoids of every frequency,
there is no denying that, but how can we build our intuition towards this fact?
Here’s a demonstration that might help. I’ll head over to the desmos graphing calculator,
and over here, let’s plot a sinusoid. y = cos(x). The reason I’m using the cosine function here is
because its peak falls at x = 0, and it just looks better for this visualization. This is a sinusoid
with a frequency of 1 unit, let’s say. Now, the idea here is to add sinusoids of several different
frequencies together. So this is a sinusoid of frequency of 2 units, 3, 4, 5 and so on. We can
see that for all of these sinusoids, the peak coincides at x = 0, so if we add them together,
the peak constructively interferes. Let’s write a simple summation of n values, where n goes from
a value of 1 frequency unit, to k frequency units, which is controlled by this slider.
As I increase k, we can see the resulting plot has a local maximum at x=0. It is the same at
several other places, but let’s just focus on x=0. Since this plot will grow quite large,
I’ll normalize the values between 1 and -1, by just dividing the whole term with k.
And now, as we increase k, which increases the number of sinusoids being summed, we get a sharper
plot, with the maximum localized value constrained to a narrower region. This is now at k=200, which
means that 200 sinusoids of increasing frequencies are being summed. But as you can imagine, if you
keep increasing the number of sinusoids being added further and as this number reaches infinity,
the plot tends to become a unit impulse. But we are in the digital domain afterall,
so sinusoids with an infinite frequency is not something we can achieve, we are governed
by the Nyquist Shannon sampling theorem, so if we were to take a sampling rate of say, 400Hz,
we can only represents frequencies up to the Nyquist limit, which is 200Hz. If we go by the
desmos calculator, we are already at a combination of sinusoids of up to 200 frequency units,
but there isn’t a single point like we see in an impulse signal. Obviously, we are looking
at this from the lens of a continuous system. If we were to take this same signal and discretize
it at a sample rate of 400Hz, we’d get a single point, since at that sample rate,
only one sample gets quantized to 1, and the rest of the samples are quantized to zero.
I can quickly demonstrate this by adding an arbitrary number of sinusoids in the
python script. If we take a sampling rate of 400, and any frequency less than 200,
and plot only a period of the waveform, we can see that in the discrete form, it’s an arbitrary
waveform. But as we approach a frequency close to the Nyquist, close to 200, we get a signal
which closely resembles an impulse, and at exactly 200Hz, we get the impulse signal.
So, what we see here, is a continuous time equivalent of the discrete impulse signal. And
this continuous signal has special significance, and it’s called the sinc function, or the sine
cardinal function. The function definition of the sinc function is basically sin(x) over x.
So, here, it would be sin(kx) over kx. And it’s quite similar to the summed cosines.
Infact if I change this term slightly, the 2 signals are equivalent.
The sinc function is quite useful in signal processing for a variety of reasons.
But in this video, we’ll see how a sinc function in continuous time is
actually just the impulse signal in discrete time.
There are 2 general variants to the sinc function. The unnormalized form, which is sin(x)/x,
and the normalized form, which is sin(pix)/pix.
The normalized form is the most useful form of the sinc function
in signal processing. And we can see why. At x=1 on the number line, the sinc function
equates to zero, it’s zero at x=2, and x=3 and x=4 it’s zero as well. Going over to the
negative axis, it’s zero at =-1, -2 and so on. So at every integral point on the number line,
except for x=0 the value of the normalized sinc function is 0. And we can imagine what this means
in discrete time. In discrete time, we sample this signal and capture values at discrete intervals,
like 1, 2, 3 and so on and disregard values in between. So if we discretize this normalized
sinc function, we get an impulse signal. In the script, we previously got an impulse
signal, by summing up all the frequencies up to the Nyquist.
But now, all we need is a single normalized sinc function, and we get an impulse signal.
We can see the form that the sinc function would take if it was unnormalized,
and it resembles the sinc function that we saw in desmos.
But the normalized form results in a perfect impulse signal.
So, summing up, the impulse signal is a signal that comprises every frequency possible for a
particular sampling rate. Because of this really unique property of impulse signals,
you can imagine why they are so useful in systems analysis. If you pass an impulse signal through a
filter, it is akin to passing every possible sinusoidal frequency through the filter.
And once you get an impulse response as the output of the filter, it’s akin to getting a frequency
response for every possible frequency. If we compare these 2 frequency domain plots, we’ll
now get a fair idea of how this filter will behave to a specific frequency passed as an input.
This has been a fairly long exposition of impulse signals,
but now let’s get back to what we were doing in the earlier video.
We’ll feed an impulse signal through our first order feedforward filter.