Fixed of-by-one bug in trapz integrator
This commit is contained in:
parent
22a81bc9be
commit
23825ec9a1
@ -95,7 +95,7 @@ public class ArrayUtils {
|
|||||||
* dt is the time step between each array value
|
* dt is the time step between each array value
|
||||||
*/
|
*/
|
||||||
public static double trapz(double[] y, double dt){
|
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;
|
if (y.length <= 1 || dt <= 0) return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user