view m-toolbox/classes/@miir/fromAB.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Construct an miir from coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromAB
%
% DESCRIPTION: Construct an miir from coefficients
%
% CALL:        f = fromAB(f, pli)
%
% PARAMETER:   pli: Parameter list object
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function f = fromAB(f, pli)
  
  ii = miir.getInfo('miir', 'From AB');
  % Set the method version string in the minfo object
  ii.setMversion(['$Id: fromAB.m,v 1.22 2011/09/15 11:50:05 hewitson Exp $-->' ii.mversion]);
  
  % Add default values
  pl = applyDefaults(ii.plists, pli);
  
  a  = find(pl, 'a');
  b  = find(pl, 'b');
  fs = find(pl, 'fs');
  
  % Checking the coefficients are listed in rows
  if size(a,1)~=1
    a = a';
  end
  if size(b,1)~=1
    b = b';
  end
  
  % Zero pad to avoid 0 length history vector
  if numel(a) <= 1
    a = [a 0];
  end
  if numel(b) <= 1
    b = [b 0];
  end
  
  f.fs      = fs;
  f.a       = a;
  f.b       = b;
  f.histin  = zeros(1,f.ntaps-1);  % initialise input history
  f.histout = zeros(1,f.ntaps-1);  % initialise output history
  
  if isempty(pl.find('name'))
    pl.pset('name', 'AB');
  end
  
  % Add history
  f.addHistory(ii, pl, [], []);
  
  % Set object properties
  f.setObjectProperties(pl, {'a', 'b', 'fs'});
  
end % End fromAB