本文整理了Java中us.ihmc.robotics.filters.ZeroLagLowPassFilter.getFilteredArray()
方法的一些代码示例,展示了ZeroLagLowPassFilter.getFilteredArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroLagLowPassFilter.getFilteredArray()
方法的具体详情如下:
包路径:us.ihmc.robotics.filters.ZeroLagLowPassFilter
类名称:ZeroLagLowPassFilter
方法名:getFilteredArray
[英]This is a zero phase lag filter with the same performance and the Matlab filtfilt function when the filter type is a first order low pass filter. This will extrapolate beginning and end of data sequence using a "reflection method". Slopes of original and extrapolated sequences match at the end points. This reduces end effects.
[中]这是一个零相位滞后滤波器,当滤波器类型为一阶低通滤波器时,具有相同的性能和Matlab Filt函数。这将使用“反射法”推断数据序列的开始和结束。原始序列和外推序列的斜率在端点处匹配。这减少了终端效应。
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public static void main(String[] args)
{
ArrayList<Double> list = new ArrayList<Double>();
double[] newList = new double[10];
for(int i=0; i<10; i++)
{
list.add((double)i + 1);
newList[i]=i+ 1;
}
// System.out.println("Original List:");
// ArrayTools.printArray(newList, System.out);
// System.out.println("");
// ZeroLagLowPassFilter.preAndPostPendedToList(list);
//
// ArrayTools.printArray(list, System.out);
double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(newList, 0.5);
System.out.println(Arrays.toString(filteredList));
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public static void main(String[] args)
{
ArrayList<Double> list = new ArrayList<Double>();
double[] newList = new double[10];
for(int i=0; i<10; i++)
{
list.add((double)i + 1);
newList[i]=i+ 1;
}
// System.out.println("Original List:");
// ArrayTools.printArray(newList, System.out);
// System.out.println("");
// ZeroLagLowPassFilter.preAndPostPendedToList(list);
//
// ArrayTools.printArray(list, System.out);
double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(newList, 0.5);
System.out.println(Arrays.toString(filteredList));
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
/**
* This is a zero phase lag filter with the same performance and the Matlab filtfilt function
* when the filter type is a first order low pass filter. This will extrapolate beginning and end of data sequence using a "reflection method".
* Slopes of original and extrapolated sequences match at the end points. This reduces end effects.
* @param arrayToFilter
* @param alpha this is [0, 1]. 0 = no filter, 1= all filter.
* @return
*/
public static ArrayList<Double> getFilteredArray(ArrayList<Double> arrayToFilter, double alpha)
{
double[] filteredArray = getFilteredArray(ArrayUtils.toPrimitive(arrayToFilter.toArray(new Double[arrayToFilter.size()])), alpha);
return new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(filteredArray)));
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
/**
* This is a zero phase lag filter with the same performance and the Matlab filtfilt function
* when the filter type is a first order low pass filter. This will extrapolate beginning and end of data sequence using a "reflection method".
* Slopes of original and extrapolated sequences match at the end points. This reduces end effects.
* @param arrayToFilter
* @param alpha this is [0, 1]. 0 = no filter, 1= all filter.
* @return
*/
public static ArrayList<Double> getFilteredArray(ArrayList<Double> arrayToFilter, double alpha)
{
double[] filteredArray = getFilteredArray(ArrayUtils.toPrimitive(arrayToFilter.toArray(new Double[arrayToFilter.size()])), alpha);
return new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(filteredArray)));
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroFiltering()
{
double[] list = new double[10];
for(int i=0; i<10; i++)
{
list[i]=i+ 1;
}
double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.0);
assertEquals(list.length, filteredList.length);
for(int i=0; i < list.length; i++)
{
assertEquals(list[i], filteredList[i], 1e-8);
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroNonZeroAlpha()
{
double[] list = new double[10];
for(int i=0; i<10; i++)
{
list[i]=i+ 1;
}
double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.5);
assertEquals(list.length, filteredList.length);
double[] answer = new double[]{ 1.083089195191860, 2.041178390383720, 3.019856780767441, 4.008463561534882, 5.001302123069763, 5.994791746139526, 6.985677242279053, 7.969401359558106, 8.937826156616211, 9.875164031982422};
assertEquals(answer.length, filteredList.length);
for(int i=0; i < list.length; i++)
{
assertEquals(answer[i], filteredList[i], 1e-8);
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroNonZeroAlpha2()
{
double[] list = new double[10];
for(int i=0; i<10; i++)
{
list[i]=i+ 1;
}
double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.3);
assertEquals(list.length, filteredList.length);
double[] answer = new double[]{ 1.008900871140671, 2.002669570468903, 3.000798568229678, 4.000231894098929, 5.000043980329763, 5.999927901099211, 6.999694060330704, 7.998960518102349, 8.996529155441165, 9.988428746667216};
assertEquals(answer.length, filteredList.length);
for(int i=0; i < list.length; i++)
{
assertEquals(answer[i], filteredList[i], 1e-8);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!