Home > classes > @pzmodel > display.m

display

PURPOSE ^

DISPLAY overloads display functionality for pzmodel objects.

SYNOPSIS ^

function txt = display(p, varargin)

DESCRIPTION ^

 DISPLAY overloads display functionality for pzmodel objects.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: DISPLAY overloads display functionality for pzmodel objects.

 CALL:        txt     = display(pzmodel)

 INPUT:       pzmodel - pole/zero model object

 OUTPUT:      txt     - cell array with strings to display the pole/zero model object

 VERSION:     $Id: display.m,v 1.5 2008/01/07 18:13:10 ingo Exp $

 HISTORY:     30-01-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function txt = display(p, varargin)
0002 % DISPLAY overloads display functionality for pzmodel objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: DISPLAY overloads display functionality for pzmodel objects.
0007 %
0008 % CALL:        txt     = display(pzmodel)
0009 %
0010 % INPUT:       pzmodel - pole/zero model object
0011 %
0012 % OUTPUT:      txt     - cell array with strings to display the pole/zero model object
0013 %
0014 % VERSION:     $Id: display.m,v 1.5 2008/01/07 18:13:10 ingo Exp $
0015 %
0016 % HISTORY:     30-01-2007 M Hewitson
0017 %                 Creation
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 VERSION = '$Id: display.m,v 1.5 2008/01/07 18:13:10 ingo Exp $';
0022 
0023 % Check if this is a call for parameters
0024 if nargin == 2
0025   if isa(p, 'pzmodel') && ischar(varargin{1})
0026     in = char(varargin{1});
0027     if strcmp(in, 'Params')
0028       txt = plist();
0029       return
0030     elseif strcmp(in, 'Version')
0031       txt = VERSION;
0032       return
0033     end
0034   end
0035 end
0036 
0037 txt = {};
0038 
0039 for i=1:numel(p)
0040   banner = sprintf('---- pzmodel %d ----', i);
0041   txt{end+1} = banner;
0042 
0043   % get key and value
0044   name  = get(p(i), 'name');
0045   g     = get(p(i), 'gain');
0046   ps    = get(p(i), 'poles');
0047   zs    = get(p(i), 'zeros');
0048   np    = length(ps);
0049   nz    = length(zs);
0050 
0051   % display
0052   txt{end+1} = ['model:    ' name];
0053   txt{end+1} = ['gain :    ' num2str(g)];
0054   for j=1:np
0055     txt{end+1} = [sprintf('pole %03d: ', j) char(ps(j)) ];
0056   end
0057   for j=1:nz
0058     txt{end+1} = [sprintf('zero %03d: ', j) char(zs(j)) ];
0059   end
0060 
0061   banner_end(1:length(banner)) = '-';
0062   txt{end+1} = banner_end;
0063 
0064 end
0065 
0066 if nargout == 0
0067   for ii=1:length(txt)
0068     disp(txt{ii});
0069   end
0070 end
0071

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003