wecopttool.fd_to_td
- fd_to_td(fd, f1=None, nfreq=None, zero_freq=True)[source]
Convert a complex array of Fourier coefficients to a real array of time-domain responses.
The input is a complex 2D array with each column containing the Fourier coefficients for some response. Columns are length
nfreq+1
, and the first row corresponds to the real-valued zero-frequency (mean, DC) components. The entries of a column representing a responsex
arex=[X0, X1, ..., Xn]
.Returns a real array with same number of columns and
2*nfreq
rows, containing the time-domain response at timeswecopttool.time(f1, nfreq, nsubsteps=1)
. The imaginary component of the highest frequency (the 2-point wave) is excluded, as it will always evaluate to zero.If both
f1
andnfreq
are provided, it uses the time matrixwecopttool.time_mat(f1, nfreq, nsubsteps=1)
, else it uses the inverse real FFT (numpy.fft.irfft()
).If
zero_freq = False
(not default), the mean (DC) componentX0
is excluded, and the matrix/vector length is reduced by 1.Opposite of
wecopttool.td_to_fd()
.- Parameters:
- Raises:
ValueError – If only one of
f1
ornfreq
is provided. Must provide both or neither.- Return type: