% Construct an miir from a parfrac%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FUNCTION: fromParfrac%% DESCRIPTION: Construct an miir from a parfrac%% CALL: f = fromParfrac(f, pli)%% PARAMETER: type: String with filter type description% pli: Parameter list object%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function f = fromParfrac(f, pli) VERSION = '$Id: fromParfrac.m,v 1.12 2011/08/15 11:22:43 hewitson Exp $'; ii = miir.getInfo('miir', 'From Parfrac'); % Set the method version string in the minfo object ii.setMversion([VERSION '-->' ii.mversion]); % Add default values pl = applyDefaults(ii.plists, pli); % Get parameters pf = find(pl, 'parfrac'); fs = find(pl, 'fs'); if isempty(fs) % get max freq in pzmodel fs = 8*getupperFreq(pf); warning([sprintf('!!! no sample rate specified. Designing for fs=%2.2f Hz.', fs)... sprintf('\nThe filter will be redesigned later when used.')]); end % make MIIR filter pfstruct = utils.math.lp2z('INOPT', 'PF', 'RES', pf.res, 'POLES', pf.poles, ... 'DTERMS', pf.dir, 'MODE', 'DBL', 'FS', fs); for jj=1:numel(pfstruct) pl = copy(pl,1); f(jj).a = pfstruct(jj).num; f(jj).b = pfstruct(jj).den; f(jj).fs = fs; if isempty(pl.find('name')) pl.pset('name', sprintf('iir(%s_%d)', pf.name, jj)); end if isempty(pl.find('description')) pl.pset('description', pf.description); end if isempty(pl.find('iunits')) pl.pset('iunits', pf.iunits); end if isempty(pl.find('ounits')) pl.pset('ounits', pf.ounits); end % Add history f(jj).addHistory(ii, pl, [], pf.hist); end % Set object properties f.setObjectProperties(pl);end % End fromParfrac