view m-toolbox/classes/@mfir/fromA.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents f0afece42f48
children
line wrap: on
line source

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

function f = fromA(f, pli)
  
  VERSION = '$Id: fromA.m,v 1.17 2011/08/15 11:36:50 hewitson Exp $';
  
  ii = mfir.getInfo('mfir', 'From A');
  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);
  
  % Add default values
  pl = applyDefaults(ii.plists, pli);
  
  a  = find(pl, 'a');
  fs = find(pl, 'fs');
  
  % Checking the coefficients are listed in rows
  if size(a,1)~=1
    a = a';
  end
  
  % Zero pad coefficients to avoid zero length history
  if numel(a) <= 1
    a = [a 0];
  end
  
  f.fs      = fs;
  f.a       = a;
  f.gd      = (f.ntaps-1)/2;
  f.histout = zeros(1,f.ntaps-1); % initialise output history
  
  % Override some properties of the input plist
  if isempty(pl.find('name'))
    pl.pset('name', 'A');
  end
  
  % Add history
  f.addHistory(ii, pl, [], []);
  
  % Set object properties
  f.setObjectProperties(pl);
  
end % End fromA