Fixed of-by-one bug in trapz integrator
[debian/openrocket] / core / src / net / sf / openrocket / util / ArrayUtils.java
index 8f0db53081f6ac14609ab9343e005fe2de66c309..7d373096a3cae4930e878b4f47de9521f0137628 100644 (file)
@@ -95,7 +95,7 @@ public class ArrayUtils {
         * dt is the time step between each array value
         */
        public static double trapz(double[] y, double dt){
-               double stop = y.length * dt;
+               double stop = (y.length -1) * dt;
                
                if (y.length <= 1 || dt <= 0) return 0;