// sosfilt.cc -- Second order IIR filtering // This file may be used under the terms defined by the GNU // General Public License [write to the Free Software Foundation, // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA] // // WITHOUT ANY WARRANTY; without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // Copyright (C) 2008 Eric Chassande-Mottin, CNRS (France) // #include #include #include using namespace std; #include #include #include #include #include #include #include #include using namespace std; DEFUN_DLD (sosfilt, args,, "Second order IIR filtering\n") { octave_value_list retval; int nargin = args.length (); if (nargin < 2) { error("Usage: y = sosfilt(sos,x)"); return retval; } Matrix sos( args(0).matrix_value() ); ColumnVector x( args(1).vector_value() ); int n=x.length(); if (sos.columns()!=6) { error("Second-order matrix must be a non-empty Lx6 matrix"); return retval; } ColumnVector y(n,0.0); for (int j=0; j