Fixed of-by-one bug in trapz integrator

This commit is contained in:
Richard Graham 2012-08-17 07:09:51 +00:00
parent 22a81bc9be
commit 23825ec9a1

View 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;