public double[] computeMagnitude(double[] dataReal) {
        double[] complex = new FFTReal().computeFFTReal(dataReal);
        int fftLength = complex.length / 2;

        double[] mag = new double[fftLength];

        for (int i = 0; i < fftLength; i++) {
            mag[i] = Math.sqrt(complex[2 * i] * complex[2 * i] + complex[2 * i + 1]
                    * complex[2 * i + 1]);
        }
        return mag;
    }