I am having trouble with zero-padding. As I understand it, in theory, zero-padding in the time-domain should 'sinc-interpolate' the FFT of the signal in the frequency domain.
This would mean, that 1) none of the values of the original signal change. 2) the overall profile of the FFT doesnt change- aka the peaks remain around the same point.
However, in simulations this does not work.
For example, I FFT the following sequence
x=[0 1 0 1 0 1 0 1]
at an imaginary same frequency, Fs=1Hz. With no zero-padding (FFT-8),
With 2x zero-padding (FFT-14),
As $N \rightarrow \infty$, $|X(f=.3125)| \rightarrow 0\ $. Also, the peak of the FFT shifts from .3125 to .25 as $N \rightarrow \infty$.
Here is my code. The relavent parameter is ZP, which controls the amount of zero-padding (N=8*ZP):
ZP=0; % of times of original length of signal to ZP with x=[0 1 0 1 0 1 0 1]; x=[x,zeros(1,length(x)*2^ZP-length(x))]; X=fft(x); Fs=1; L=length(x); df=.5*Fs/L; t=(1:L)*(1/Fs); f=(1:L)*df; figure(12), subplot(211), stem(x); subplot(212), stem(f,abs(X)); xlim([-.02,.52]) test_pnt=.3125; I=find(f==test_pnt); title(['abs[X(' mat2str(test_pnt) ')]=' mat2str(abs(X(I)))]);