Overview
This section demonstrates signal processing of sinusoidal and random signals. The PSDs are computed using Welch's method as implemented in the bci.js function set (bci.js.org).
Time signal
You can adjust the frequency and amplitude of a sinusoidal tone and broad-band random noise (normally distributed), along with a filter frequency. The time history plot is 'zoomable'. Use your mouse to zoom in smaller time sections to better visualize the waveforms.
Spectral analysis
Compute power spectra or power spectral densities using Welch's method, which averages spectra computed over 'blocks' or 'windows' of the time history. The time history is subdivided into a number of blocks (which are limited to powers of 2 here). You can adjust the sampling frequency (which sets the maximum frequency of the spectra), the number of blocks to divide the time history into (watch the grid on the upper time history plot change as you adjust number of blocks), and the block overlap percentage (advanced version only). You can also zoom in on the spectral plot.
Window effects (advanced version only)
It is common to apply windows to each time block when computing averaged spectra. A rectangular or 'boxcar' window is the default, and does not change the time histories at all. There are many smoothing windows, but the Hanning is the most popular. The time signals are attenuated to zero at the beginning and end of the window. This can affect the spectral levels of tones and resonances. Adjust the tonal frequency with the default rectangular windowing and you will find conditions where the tone becomes artificially widened. This is caused by lack of periodicity between the beginning and end of a window (the tone doesn't align with itself at the window edges). A Hanning window attenuates the 'leakage' or 'spill' caused by this non-periodicity, but doesn't always eliminate it.
Spectra types
Power spectra (PS) and power spectral densities (PSDs) are based on the same data, but with different scaled amplitudes. A power spectrum has the units of Engineering Units (EU) squared and represents the amount of energy within a frequency band. Since the frequency bandwidth changes with time record length and number of blocks you've subdivided that time record into, this affects the power spectral level (watch the frequency resolution in the title above the plots as you change signal parameters). A power spectral density is just the power spectra divided by the frequency bandwidth. When the signal processing yields a 1 Hz frequency bandwidth, there is no difference between a PS or PSD (try it after adjusting the parameters until you have a 1 Hz resolution).
The major differences between a PS and PSD are in the amplitudes of tones and broad-band random signals. Tonal amplitudes remain constant for power spectra when the frequency bandwidths change, but broad-band levels change. A tone has all of its energy in a single frequency so if you change the frequency bandwidth the total energy within that band remains the same. Divide by the frequency resolution to compute a PSD, however, and the tonal peak value shifts upward or downward. Broad-band random energy is spread equally over all frequencies. Increasing the frequency bandwidth will therefore increase the energy in a power spectral level. Divide by the frequency resolution, though, and the PSD broad-band levels remain the same. Try adjusting parameters to view the effects on peak levels of the tones and broad-band signals.
It is also common to integrate the energy within a power spectrum over specific frequency bandwidths, such as octave bands or one-third octave bands. These bands are often called 'constant percentage bandwidths'. In this demonstrator you can select one-third octave band integrations. These are typically plotted as total power levels, not PSDs, and also on a log frequency x-axis (since the bandwidths increase with frequency).
Filters (advanced version only)
You can apply a few simple Infinite Impulse Response (IIR) filters. I've included first order Butterworth low and high pass filters, along with second order resonance filters (low-pass, high-pass, and band-pass with either 0 peak amplification or 0 'skirt' amplification). You can adjust the filter center frequency, but I've set the Q of the resonance filters to 10 (the loss factor of 1/Q = 0.1).
|
Hz |
EU |
EU |
|
Hz |
|