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 response x are x=[X0, X1, ..., Xn].

Returns a real array with same number of columns and 2*nfreq rows, containing the time-domain response at times wecopttool.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 and nfreq are provided, it uses the time matrix wecopttool.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) component X0 is excluded, and the matrix/vector length is reduced by 1.

Opposite of wecopttool.td_to_fd().

Parameters:
  • fd (ArrayLike) – Array containing the complex Fourier coefficients.

  • f1 (float | None) – Fundamental frequency f1 [\(Hz\)].

  • nfreq (int | None) – Number of frequencies.

  • zero_freq (bool | None) – Whether the mean (DC) component is included.

Raises:

ValueError – If only one of f1 or nfreq is provided. Must provide both or neither.

Return type:

ndarray

See also

td_to_fd, time, time_mat