# How do I zero pad time samples if I only have frequency samples?

Related to this question: Convolution in frequency space with fft and ifft -> num output samples?

When doing convolution in time domain by doing multiplication in frequency domain, you apparently can zero pad the time domain samples if you want the time domain convolution result (ifft of the fft multiplication result), to make the resulting time domain convolution be the "correct" length (len(a)+len(b)-1).

What I'm wondering is what do you do if you don't have the time domain samples yet?

I'm generating two sets of IFFT bin data, doing convolution by multiplying in the frequency domain, and then using IFFT to turn the convolution result into time domain data.

When i do this, the result is the same length as my IFFT bins though, instead of the length i would expect.

How do I lengthen the result in the frequency domain?

Thanks!

• "I'm generating two sets of IFFT bin data..." -- i'm gonna call them $H_1[k]$ and $H_2[k]$. what time-domain functions, $h_1[n]$ and $h_2[n]$ do they correspond to? do they appear zero-padded? – robert bristow-johnson Apr 10 '15 at 23:45
• Hey RBJ, they are one period of a band limited saw wave and a bl square wave and no they don't look zero padded but I sure would like them to look like they were (: trying to make equivalent output (for demonstration purposes) of doing convolution both ways (frequency and time domain) when starting with ifft bin data. – Alan Wolfe Apr 10 '15 at 23:50
• well, to convolve using the FFT, you have to guarantee that $X_1[k]$ and $X_2[k]$ are the DFT of discrete functions $x_1[n]$ and $x_2[n]$ that are zero-padded with a total of N-1 zeroed samples. (N is the FFT length.) so if you're constructing $X_1[k]$ and $X_2[k]$ directly in the frequency domain, you don't know that until you iFFT back to time domain and, likely window to zero samples or, say double the size (double N). – robert bristow-johnson Apr 10 '15 at 23:57
• Oh wow, so is it basically not possible (or not easily done in the general case)? Thanks so much for the help (: – Alan Wolfe Apr 11 '15 at 0:01
• hey, maybe you want circular convolution. the DFT is has periodicity built into it. – robert bristow-johnson Apr 11 '15 at 0:13