view m-toolbox/classes/@mfir/fromA.m @ 40:977eb37f31cb database-connection-manager

User friendlier errors from utils.mysql.connect
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 18:04:03 +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