# What does it mean when you zero pad data and why does one do it? [duplicate]

I am struggling to understand what effect zero padding data would have on EMG data. How does it improve the signals? Any help in simple terms that's not too mathematical would be greatly appreciated!

• You probably want to observe the frequency spectrum associated with the EMG data using FFT function ? – Fat32 Nov 2 '17 at 21:12

There are a few reasons to zero pad, improvement is mostly in terms of advantages in manipulating the signals, not explicit SNR enhancement.

• Delay, Advance (by n), and/or Add a signal of length M with respect to a longer signal of length N. These are operations used in languages with linear algebra calls like Matlab. These are essentially programming considerations.
• LazyMan FFT, Most DSP libraries have FFT libraries which have lengths that are a power of 2. A common way to perform a FFT on sequences is to zero pad them so that have a length corresponding to a power of 2. A library like FFTW is much more flexible in the lengths that can be selected but FFTW isn't available for every processor and there is a possibility that the zero pad approach may be faster.
• Convolution by FFT (circular convolution IFFT(FFT(x).$*$ FFT(Y)), where $.*$ denotes element by element by element multiplication ), When one convolves a sequence of length M with a sequence of length N, the result is a sequence has length M+N-1, The Element by Element multiplication requires that both sequences be the same length (prior to DFT, hence same after DFT), so the shorter is zero padded so that both sequences have the same length. There are 2 variation of FFT convolution, one requires that both sequences be zero padded to at least M+N in length.
• Zero padding to interpolate a DFT, usually by a whole factor, double, triple, ... The orthogonal bases of a DFT are of length N for a N point DFT, so we can use zero padding to calculate intermediate points of the DFT of a short sequence. The resolution isn't increased, the magnitude plots are smoother. One can zero pad in front or in back, the phase is different in the resulting DFT but the magnitudes are identical
• Arbitrary Time shift of signal with a window. In beamforming for instance, a number of sequences are produced by sensors and these sequences need to be time shifted prior to being added. This can be achieved by zero padding each time sequence, performing a DFT, using the DFT time shift property, and performing the beamforming superposition in the frequency domain, and inverse transforming the delayed and summed frequency domain sequences.
• Zero padding is often relatively cheap. A FFT algorithm can be modified so that zero padding avoids math operations relative to a full DFT acting on zeros.
• Linearity and Time Invariance, Zero padding is often used to take advantage of those properties, and are implicit in all the above bullets
• While inserting zeros between samples isn't called zero padding, interleaving zeros (with filtering) can be used to interpolate in the time domain.

.

• it's a good answer. mind if i jazz up the third and fourth bulletted items? – robert bristow-johnson Nov 3 '17 at 1:51
• Go for it no problem – Stanley Pawlukiewicz Nov 3 '17 at 1:54