@Test public void testBartlettMethod() { for (int len = 1; len < 12; ++len) { new WindowFunction(WindowType.Bartlett, len).compute(i -> fn.get(Math.abs(i))); } }
public double compute(IntToDoubleFunction fn){ double v=fn.applyAsDouble(0)*window[0]; for (int i=1; i<window.length; ++i){ v+=window[i]*fn.applyAsDouble(i); v+=window[i]*fn.applyAsDouble(-i); } return v; }
WindowFunction { public double compute(IntToDoubleFunction fn){ double v=fn.applyAsDouble(0)*window[0]; for (int i=1; i<window.length; ++i){ v+=window[i]*fn.applyAsDouble(i); v+=window[i]*fn.applyAsDouble(-i); } return v; } }
WindowFunction { public double compute(IntToDoubleFunction fn){ double v=fn.applyAsDouble(0)*window[0]; for (int i=1; i<window.length; ++i){ v+=window[i]*fn.applyAsDouble(i); v+=window[i]*fn.applyAsDouble(-i); } return v; } WindowFunction(WindowType type, int len); }
WindowFunction { public double compute(IntToDoubleFunction fn){ double v=fn.applyAsDouble(0)*window[0]; for (int i=1; i<window.length; ++i){ v+=window[i]*fn.applyAsDouble(i); v+=window[i]*fn.applyAsDouble(-i); } return v; } WindowFunction(WindowType type, int len); double computeSymmetric(IntToDoubleFunction fn); double compute(IntToDoubleFunction fn); }
WindowFunction { public double compute(IntToDoubleFunction fn){ double v=fn.applyAsDouble(0)*window[0]; for (int i=1; i<window.length; ++i){ v+=window[i]*fn.applyAsDouble(i); v+=window[i]*fn.applyAsDouble(-i); } return v; } WindowFunction(WindowType type, int len); double computeSymmetric(IntToDoubleFunction fn); double compute(IntToDoubleFunction fn);  }