Example #1
0
//! apply ChebyshevI filter on a matrix
//! @param[in] matrix	matrix to be filtered
//! @return 			filtered matrix
mat ChebyshevFilter(mat matrix)
{
	float **floatMatrix = matToFloat(matrix);
	Dsp::SimpleFilter<Dsp::ChebyshevI::LowPass<5>,3> filter;
	int filterOrder = 2;
	int samplingFreq = 44;
	float cutFreq = 0.25;
	float passRipple = 0.001;

//	cout<<"ChebyshevFilter: floatMatrix"<<endl;
//	for (int i = 0; i < matrix.n_rows; i++)
//	{
//		for (int j = 0; j < matrix.n_cols; j++)
//			cout<< floatMatrix[i][j]<<" ";
//		cout<<endl;
//	}

	filter.setup(filterOrder, samplingFreq, cutFreq, passRipple);
	filter.process(matrix.n_cols, floatMatrix);
	mat lowpassComponent = floatToMat(floatMatrix, matrix.n_rows, matrix.n_cols);
//	cout<<"ChebyshevFilter: gravity "<<endl;
//	lowpassComponent.print();

	return lowpassComponent;
}
Example #2
0
//! apply ChebyshevI filter on a matrix
//! @param[in] matrix	matrix to be filtered
//! @return 			filtered matrix
mat ChebyshevFilter(mat matrix)
{
	float **floatMatrix = matToFloat(matrix);
	Dsp::SimpleFilter<Dsp::ChebyshevI::LowPass<5>,3> filter;
	int filterOrder = 2;
	int samplingFreq = 32;
	float cutFreq = 0.25;
	float passRipple = 0.001;

	filter.setup(filterOrder, samplingFreq, cutFreq, passRipple);
	filter.process(matrix.n_cols, floatMatrix);
	mat lowpassComponent = floatToMat(floatMatrix, matrix.n_rows, matrix.n_cols);

	return lowpassComponent;
}