wecopttool.complex_to_real

complex_to_real(fd, zero_freq=True)[source]

Convert from one complex amplitude to two real amplitudes per frequency.

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 2D array with each column containing the real and imaginary components of the Fourier coefficients. The imaginary component of the highest frequency (the 2-point wave) is excluded, as it will always evaluate to zero. The column length is 2*nfreq. The entries of a column representing a response x are x=[X0, Re(X1), Im(X1), ..., Re(Xn)].

If zero_freq = False (not default), the mean (DC) component X0 is excluded, and the vector length is reduced by 1.

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

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

Return type:

ndarray

See also

real_to_complex