From 118c14ed88ed76b892071638156dcb10cc69fd42 Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Fri, 31 Mar 2017 15:48:37 -0500 Subject: Add Filter class. This is not tested to be working yet. --- src/filter.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/filter.cpp (limited to 'src/filter.cpp') diff --git a/src/filter.cpp b/src/filter.cpp new file mode 100644 index 0000000..3ef4c58 --- /dev/null +++ b/src/filter.cpp @@ -0,0 +1,85 @@ +/* + * ===================================================================================== + * + * Filename: filter.cpp + * + * Description: Class for FIR and IIR filters + * + * Version: 1.0 + * Created: 03/31/2017 02:40:02 PM + * Revision: none + * Compiler: gcc + * + * Author: Martin Miller (MHM), miller7@illinois.edu + * Organization: Aerospace Robotics and Controls Lab (ARC) + * + * ===================================================================================== + */ +#include "filter.h" + +/* + *-------------------------------------------------------------------------------------- + * Class: Filter + * Method: Filter + * Description: constructor + *-------------------------------------------------------------------------------------- + */ +Filter::Filter (const VectorXd &b, const VectorXd &a) +{ + int rows = b.rows()+a.rows(); + F = Matrix::Zero(rows,1); + F.head(b.rows()) = b; + F.segment(b.rows(),a.rows()) = -a; + + Vector3d z; + z << 0,0,0; + for (int i=0; i M; + int rows = X.size() + Y.size(); + M = Matrix::Zero(rows,3); + + int row = 0; + for (auto i=X.begin(); i!=X.end(); ++i,++row) { + M.row(row) = *i; + } + for (auto i=Y.begin(); i!=Y.end(); ++i,++row) { + M.row(row) = *i; + } + + return M; +} + -- cgit v1.1