public double[] computePowerSpectrum(double[] dataReal) {
        double sum = 0;
        for (int i = 0; i < dataReal.length; i++) {
            sum += dataReal[i];
        }

        if (sum == 0)
            return computeMagnitude(dataReal);

        double multiplicator = 2.0 / sum;
        double multiplicatorQuadr = multiplicator * multiplicator;

        double[] mag = computeMagnitude(dataReal);

        int fftLength = mag.length;

        /* divide / energy, multiply by 2, take power of 2 */
        // X = fft(wav(idx).*w,p.fft_size);
        // dlinear(:,i) = abs(X(1:p.fft_size/2+1)/sum(w)*2).^2; %% normalized
        // powerspectrum
        for (int i = 0; i < fftLength; i++) {
            mag[i] = mag[i] * mag[i] * multiplicatorQuadr;
        }
        return mag;
    }