How to removed ripples cause by zero-padding in fft?
Windowing the time domain function prior to zero padding will reduce the ripples caused by zero padding (due to the otherwise sharp truncation of the time domain function). Without additional windowing you are equivalently multiplying your longer time domain function with a rectangular window, which Fourier Transform is a Sinc function. To reproduce this exactly in frequency the frequency must extend to infinity, which is doesn't in the discrete system so aliasing of these tails in frequency occurs, resulting in ripple. Choose a window whose Fourier Transform has tails that are much lower at the aliasing frequencies and the ripple will be significantly reduced! (I personally like the Kaiser window as you can adjust the trade between width of the main lobe (frequency resolution) and depth of the tails (dynamic range) by adjusting the Beta factor in the window construction.