Hi markzzz,

I assume you know how complex numbers work, and you've just mixed up a couple of things (otherwise it'd probably help to run through some more maths reading before playing with frequency domain and phase).

You're creating a complex number from real and imaginary parts, so you want something like:

Code: Select all

```
double amp = 1;
double phase = M_PI/2;
freqWaveRe[secHarm] = amp*cos(phase); // will be 0 in this case
freqWaveIn[secHarm] = amp*sin(phase); // will be `amp` in this case
// and then the complex conjugate for the negative frequencies
freqWaveRe[tableLen - secHarm] = amp*cos(phase);
freqWaveIn[tableLen - secHarm] = -amp*sin(phase); // -amp
```

(BTW, 90° in radians is is π/2, not π, hence the value for "phase".)

Because we know the complex phase is π/2, we

*could* have skipped the sin()/cos() and just stuck in 0/amp/-amp directly.

Geraint