rfft function Null safety

ArrayComplex rfft(
  1. Array x,
  2. {dynamic n}

Compute the one-dimensional discrete Fourier Transform for a Real input.

  • x A Array with the input
  • n : optional Length of the transformed axis of the output. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input is used. return A ArrayComplex with FFT output


1 "Fast Fourier Transform". https://rosettacode.org/wiki/Fast_Fourier_transform#C++. Retrieved 2019-07-23.

  1. "what is numpy fft rfft and numpy fft irfft and its equivalent code in matlab". https://stackoverflow.com/questions/45778504/what-is-numpy-fft-rfft-and-numpy-fft-irfft-and-its-equivalent-code-in-matlab. Retrieved 2019-07-23.


var x = Array([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]);



ArrayComplex rfft(Array x, {n}) {
  var buffer = arrayToComplexArray(x);
  var afft = fft(buffer, n: n);
  return afft.getRangeArray(0, (afft.length / 2).floor() + 1); //  return afft;