view m-toolbox/classes/@rational/fromParfrac.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromParfrac
%
% DESCRIPTION: Construct a rational from parfrac model
%
% CALL:        r = Parfrac(a, pl)
%
% PARAMETER:   pl   - plist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function r = fromParfrac(r, pli)

  VERSION = '$Id: fromParfrac.m,v 1.10 2011/08/15 12:41:52 hewitson Exp $';


  % get pzmodel info
  ii = rational.getInfo('rational', 'From Parfrac');

  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);

  % Combine input plist with default values
  pl = applyDefaults(ii.plists, pli);
  
  % Extrac model
  
  pf = find(pl, 'parfrac');
  [a,b] = residue(pf.res,pf.poles,pf.dir);
  
  % Set fields
  r.num = a;
  r.den = b;

  % Override model properties from the parfrac object
  
  if isempty(pl.find('ounits'))
    pl.pset('ounits', pf.ounits);
  end
  
  if isempty(pl.find('iunits'))
    pl.pset('iunits', pf.iunits);
  end
    
  if isempty(pl.find('name'))
    pl.pset('name', sprintf('rational(%s)', pf.name));
  end
  
  if isempty(pl.find('description'))
    pl.pset('description', pf.description);
  end
  
  % Add history
  r.addHistory(ii, pl, [], pf.hist);

  % Set object properties
  r.setObjectProperties(pl);
  
end