1
$\begingroup$

I have time sequence in which the data is sampled at 0.8 Hz. The data is related to chromatography (chemical analysis), that is why the sampling frequency is relatively low. The instrument cannot sample faster at this moment.

I was exploring the idea of upsampling by zero padding in the frequency domain as follows in MATLAB.

FFT_S=fft(Signal); % FFT of Signal of Interest

FFT_ZP=[FFT_S(1:length(t)/2,1); zeros(1000,1); FFT_S(length(t)/2+1:end,1)]; % Zero padding with 1000 zeros.

Signal_Up=real(ifft(FFT_ZP)); % Upsampled data

The original data consists of 716 points. The upsampled data has 1716 points but the amplitude has reduced - which is undesirable.

Is there a simple multiplying factor to correct the amplitude in MATLAB based on total number of points before and after upsampling?

EDIT:

Fortunately for this analytical chemistry purpose the trade offs of zero padding are not relevant. Qualitatively, in order to keep the amplitude the same, I found that if we double the sampling rate, the amplitude after inverse fft had to be multiplied by 2, if we triple the sampling rate by zero padding, the amplitude had to be multiplied by 3. Ignoring the trade offs, there must be a generalized method to correct the final amplitude based on the initial and final number of data points?

Thanks.

$\endgroup$
2
  • 1
    $\begingroup$ Interesting that you are sampling at the Schumann resonance frequency. That aside, why are you wanting to upsample at all? I am assuming you are going to best fit either a Gaussian peak or a Poisson peak to your data. Upsampling won't improve those results as no new information is added. Indeed, you may be introducing a distortion. Also, with an even number of points you should be splitting the Nyquist bin in half, one half in each range. $\endgroup$ Sep 6, 2020 at 12:35
  • $\begingroup$ Interesting but this sampling frequency is "by chance" only-nothing to do with Schumann :-). The signal is generated by a microwave spectrometer. Most people are used to looking at 20 points per peak, currently I have 8. The reason for upsampling is aesthetic only. Another reason is that with more points I can do denoising with wavelets. Still any idea about a general formula for correcting amplitude? $\endgroup$
    – AChem
    Sep 6, 2020 at 13:46

2 Answers 2

2
$\begingroup$

If you use an 1/N normalized DFT, then you shouldn't have any problems with your amplitude when you take the inverse DFT (with no normalization factor/factor of 1). Consider the case of a pure tone with a whole number of cycles in the frame. Only one bin pair will be non-zero. No matter how many extra zeroes you insert, the inverse DFT will reconstruct the same signal in the same duration, just appropriately upsampled. The amplitude of the signal will be twice the magnitude of of each bin value independent of your sample count.


If the normalization factors are already hard coded in your routines as "1" forward, "1/N" inverse, you can simply use them in reverse roles. Take the "inverse" of your signal, zero pad it (splitting the Nyquist), then take the "forward".

Alternatively, just multiply your final results by a factor of $\frac{N_{new}}{N_{old}}$, which confirms your observations in the update.

$\endgroup$
1
  • 1
    $\begingroup$ I was playing around with it after reading your answer. The following works in MATLAB. I divided the FFT of the original signal by the number of points, i.e., 716. After zero padding I had 1716 points. After zero filling and doing the inverse, I multiplied the inverse of the zero padded FFT by 1716. This recovers the original amplitude. $\endgroup$
    – AChem
    Sep 6, 2020 at 14:52
0
$\begingroup$

Sample rate conversion is well researched and documented topic and there are plenty of libraries out there including Matlab's $resample()$ or $interp()$

It's not a trivial process and there is a fair bit of trade offs involved, including phase distortion, transient distortion, maximum usable frequency, pass band ripple, amount of aliasing suppression, cost, latency, etc.

You should make sure that you understand the trade offs and can map them to the specific needs of your application. This being said, zero padding in the frequency domain is a very poor method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.