public double[][] getPotentialProfile() {
        double[] x = new double[intervals.size()];
        double[] y = new double[x.length];
        for (int i = 0; i < y.length; i++) {
            x[i] = intervals.get(i).getX();
            y[i] = intervals.get(i).getY();
        }
        return new double[][]{x, y};
    }