From 23825ec9a16d324d8117bec7f61db420430bc46a Mon Sep 17 00:00:00 2001 From: Richard Graham Date: Fri, 17 Aug 2012 07:09:51 +0000 Subject: [PATCH] Fixed of-by-one bug in trapz integrator --- core/src/net/sf/openrocket/util/ArrayUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/util/ArrayUtils.java b/core/src/net/sf/openrocket/util/ArrayUtils.java index 8f0db5308..7d373096a 100644 --- a/core/src/net/sf/openrocket/util/ArrayUtils.java +++ b/core/src/net/sf/openrocket/util/ArrayUtils.java @@ -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;