Reconstruction of the EKG signal as a finite Fourier series

This page shows an example of reconstructing the average V(3,3) EKG signal from the previously shown set of line spectra. In the images that follow, the EKG signal is synthesized as a discrete series of the following form:

y(i, t)) = sum(j = 0 to i, mag(j) * cos( j * t + phase(j) ))

where i = 0, 1, 2,..., 32 (Hz at integer frequencies), t = 0 to 2 * pi (256 pts), mag(j) is the magnitude of the spectral line at j Hz, and phase(j) is the phase of the line at j Hz. The cosine function is used since this represents the real part of Euler's relation exp(i * theta) = cos(theta) + i * sin(theta).

Here is the measured average V(3,3) signal:

Here are the series partial sums for different frequency ranges (at integer frequencies only):

Here is a comparison of the series sum for 0-32 Hz (in red) and the actual signal (in blue). The reconstructed signal has been scaled so that the magnitudes are equal.

Note that this series converges very slowly. That is, about 29 or more terms of the series are necessary for the reconstructed signal to closely approximate the actual signal. Even with 33 terms, there are still high-frequency "wiggles" present in the reconstructed signal.