Mercurial > hg > ltpda
diff m-toolbox/classes/@miir/mkbandpass.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@miir/mkbandpass.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,34 @@ +% MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: MKBANDPASS return a bandpass filter miir(). +% A Cheby filter is used. +% +% CALL: f = mkbandpass(f, pl) +% +% VERSION: $Id: mkbandpass.m,v 1.11 2011/04/04 11:37:02 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function f = mkbandpass(f, pl) + + g = find(pl, 'gain'); + fc = find(pl, 'fc'); + fs = find(pl, 'fs'); + order = find(pl, 'order'); + ripple = find(pl, 'ripple'); + + utils.helper.checkFilterOptions(pl); + + % Build filter coefficients + [a, b] = cheby1(order, ripple, 2.*fc./fs); + + % Set filter properties + f.name = 'bandpass'; + f.fs = fs; + f.a = g.*a; + f.b = b; + f.histin = zeros(1,f.ntaps-1); % initialise input history + f.histout = zeros(1,f.ntaps-1); % initialise output history +end +