Assume vector s is a set of time samples of length 1000. Assume vector h is a set of samples of length 50.
If I want to compute the convolution of those vectors, the result will be 1000+50-1 = 1049 points long, as expected.
If I want instead to calculate this using an FFT, I need to ensure that the circular convolution does not alias. Therefore, the FFT size of each vector must be >= 1049. However, I want an efficient FFT length, so I compute a 2048 size FFT of each vector, multiply them together, and take the ifft. This leaves me with a 2048 point answer.
In MATLAB:
H = fftshift(fft(h,2048));
S = fftshift(fft(s,2048));
result = fftshift(ifft(H.*S));
That result contains "extra" samples because of the fft zero padding. Theoretically it contains exactly 999 extra samples that I need to throw out. What's the systematic way to know exactly which samples of the resulting vector to throw away?