result of FFT
Timon Gehr
timon.gehr at gmx.ch
Wed Jul 9 11:57:43 UTC 2025
On 7/8/25 23:06, Timon Gehr wrote:
>
> auto fToWave(R)(size_t N,R coefficients_f){
> return iota(N/2+1).map!(j=>
> tuple!("magnitude","frequency","phase")(
> (j==N/2?1.0:2.0)*abs(coefficients_f[j]).re,
> K(j)*sample_rate/N,
> std.complex.log(coefficients_f[j]).im)
> );
> }
As `f_0` is also real, similar to `f_(N/2)`, this should of course have
been:
```d
auto fToWave(R)(size_t N,R coefficients_f){
return iota(N/2+1).map!(j=>
tuple!("magnitude","frequency","phase")(
(j==0||j==N/2?1.0:2.0)*abs(coefficients_f[j]).re,
K(j)*sample_rate/N,
std.complex.log(coefficients_f[j]).im)
);
}
```
More information about the Digitalmars-d-learn
mailing list