wecopttool.core.real_to_complex
- real_to_complex(fd, zero_freq=True)[source]
Convert from two real amplitudes to one complex amplitude per frequency.
The input is a real 2D array with each column containing the real and imaginary components of the Fourier coefficients for some response, excluding the imaginary component of the highest frequency (2-point wave). The column length is
2*nfreq
. The entries of a column representing a responsex
arex=[X0, Re(X1), Im(X1), ..., Re(Xn)]
.Returns a complex 2D array with each column containing the complex Fourier coefficients. 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]
.If
zero_freq = False
, the mean (DC) componentX0
is excluded, and the column length is reduced by 1.- Parameters:
fd (ArrayLike) – Array containing the real and imaginary components of the Fourier coefficients.
zero_freq (bool | None) – Whether the mean (DC) component is included.
- Return type:
See also