From the fft documentation: Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X. - If X is a vector and the length of X is less than n, then X is padded with trailing zeros to length n.
- If X is a vector and the length of X is greater than n, then X is truncated to length n.
The original ‘x’ has a length of 101. That is not compromised in the computation of ‘Y1’ becasue zero-padding simply increases the frequency resolution. The length of ‘x’ in ‘Y2’ is 64, so 37 elements of the original signal have been removed before the Fourier transform was calculated.
To illustrate:
Y1 = fft(x,nfft1)*dt;
Y2 = fft(x,nfft2)*dt;
Y3 = fft(x(1:64))*dt;
Y1Y2 = mean(abs(Y1)) - mean(abs(Y2))
Y2Y3 = mean(abs(Y2)) - mean(abs(Y3))
produces:
Y1Y2 =
-0.003722334257938
Y2Y3 =
0
There is no difference between ‘Y2’ and ‘Y3’. (The small difference between ‘Y1’ and ‘Y2’ is the effect of zero-padding in creating a longer ‘Y1’ vector without changing any of the other elements.)
Best Answer