Computing magnitude and phase spectra of the grid

A DFT can be performed on each of the 25 grid signals to compute the magnitude and phase of their spectra. Here is an image showing the spectrum magnitude of all 25 EKG signals for frequencies up to 50 Hz:

(Click for larger image)

Note that a stable EKG signal is a continuous periodic function that goes to zero at both ends. Therefore, its spectrum should consist of a finite set of lines (i.e. the signal can be represented as a Fourier series). However, in the discrete case this is not so, as the spectrum of a discrete function is continuous. Since each EKG signal has been discretized by the data acquisition process (and it has been post-processed through a Fourier lowpass filter as well), it will have a continuous spectrum.

It is possible that the first few peaks in each of the spectra above do correspond to discrete lines in the continuous signal spectrum, and that these lines have been broadened by the exponential windowing function used in the DFT. However, for a signal of 256 points, the width of the window function is only about 13 points at the base, which is somewhat less than the width of the peaks shown here. Nevertheless, on both physical and theoretical grounds, I would expect that the waveforms of all EKG signals in this grid could be reduced to a finite and small number of interacting components. Thus reduction will be the topic of a further investigation.

Here is a surface and image plot of the first overall peak in the spectrum magnitude of the grid, which occurs at about 2.35 Hz:

Here is a surface and image plot of the second overall peak in the spectrum magnitude of the grid, which occurs at about 6.47 Hz:

Here is a surface and image plot of the third overall peak in the spectrum magnitude of the grid, which occurs at about 10.39 Hz:

Here is a combined image of the spectrum phase of all 25 EKG signals in the grid, for frequencies up to 50 Hz. Note that the plots appear jagged because they should actually be plotted in cylindrical coordinates, rather than in rectangular coordinates.

(Click for larger image)

When only a single "branch" of the spectrum phase is plotted, there is a 2 Pi ambiguity for values close to +- Pi. Therefore, for a grid of N signals there are 2^N different ways of plotting the same values. In order to reduce this ambiguity, and to make the surface plots more readable, I have created a statistics component which will alter some of the phase values in the grid by +- 2 Pi.

This component is able to "clean up" many of the 2^25 different possible configurations of the grid phase surface. For example, the component converts the following image on the left to the image on the right by altering some of the points in the surface by + or - 2 Pi.

The algorithm to perform this conversion is the following:

1. Compute the mean phase and phase variance of the grid.
2. Sequentially alter each phase point in the grid by the following amounts:
• Add 2 Pi to a phase value which is less than zero.
• Subtract 2 Pi from a phase value which is greater than zero.
3. Recompute the mean phase and phase variance. If the new variance is less, replace the original phase point with the altered phase point. If the new variance is greater, leave the original point.
4. Repeat 2 and 3 for all points in the grid over and over until either the variance does not continue to drop, or some maximum number of passes (e.g. 1000) have been made through all points in the grid.

Ideally, it would be best to try all 2^N different combinations of points, and then to choose the one producing the smallest variance. However, even 2^25 is a pretty big number. Doing the procedure point-by-point instead seems to work about as well, and is much faster.

Here are plots of the mean phase and phase variance resulting from performing the above algorithm on the 5x5 grid of EKG signals, for frequencies up to 50 Hz:

Note that for frequencies below 25 Hz, the phase variance contains a set of alternating minima and maxima, showing the frequencies at which the entire grid of 25 EKG signals is "in phase" with one another, and the frequencies where it is "out of phase". The "in phase" frequencies are of interest because the entire grid of signals is synchronized at those frequencies for their entire duration, and is acting as a unified whole rather than as a set of independent signal generators.

Actually, the peaks of the variance plot may not be quite as high as they appear, since the peak point may represent a phase configuration which was not completely "normalized" by the statistics component. Nevertheless, points next to or near the peaks do represent "correct" configurations of the phase surface, so that the peaks in the variance are indeed there, but perhaps attenuated by 3 db or so.

Here is a surface and image plot of the phase of the entire grid at the first minimum of the variance, which occurs at about 2.55 Hz:

Here is a surface and image plot of the phase of the entire grid near the first maximum of the variance, which occurs at about 5.10 Hz:

Here is a surface and image plot of the phase of the entire grid at the second minimum of the variance, which occurs at about 6.67 Hz:

Here is a surface and image plot of the phase of the entire grid near the second maximum of the variance, which occurs at about 9.02 Hz:

Here is a surface and image plot of the phase of the entire grid at the central minimum of the variance, which occurs at about 15.10 Hz:

Note that this minimum, and the general shape of the variance curve, is due to the forced synchronization of all 25 EKG signals about the R peak of the waveform. Thus, all points of the grid are maximally synchronized at this feature, which has a frequency of about 15 Hz, and become progressively less synchronized at frequencies away from 15 Hz. Finally, note that the first two minima of the phase variance occur at the same frequencies (+0.2 Hz) as the first two maxima of the spectrum magnitude.