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.6 2008/02/12 20:07:37 hewitson 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.6 2008/02/12 20:07:37 hewitson Exp $
0015 %
0016 % HISTORY:     30-01-2007 M Hewitson
0017 %                 Creation
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 VERSION  = '$Id: display.m,v 1.6 2008/02/12 20:07:37 hewitson Exp $';
0022 CATEGORY = 'Output';
0023 
0024 % Check if this is a call for parameters
0025 if nargin == 2
0026   if isa(p, 'pzmodel') && ischar(varargin{1})
0027     in = char(varargin{1});
0028     if strcmp(in, 'Params')
0029       txt = plist();
0030       return
0031     elseif strcmp(in, 'Version')
0032       txt = VERSION;
0033       return
0034     elseif strcmp(in, 'Category')
0035       txt = CATEGORY;
0036       return
0037     end
0038   end
0039 end
0040 
0041 txt = {};
0042 
0043 for i=1:numel(p)
0044   banner = sprintf('---- pzmodel %d ----', i);
0045   txt{end+1} = banner;
0046 
0047   % get key and value
0048   name  = get(p(i), 'name');
0049   g     = get(p(i), 'gain');
0050   ps    = get(p(i), 'poles');
0051   zs    = get(p(i), 'zeros');
0052   np    = length(ps);
0053   nz    = length(zs);
0054 
0055   % display
0056   txt{end+1} = ['model:    ' name];
0057   txt{end+1} = ['gain :    ' num2str(g)];
0058   for j=1:np
0059     txt{end+1} = [sprintf('pole %03d: ', j) char(ps(j)) ];
0060   end
0061   for j=1:nz
0062     txt{end+1} = [sprintf('zero %03d: ', j) char(zs(j)) ];
0063   end
0064 
0065   banner_end(1:length(banner)) = '-';
0066   txt{end+1} = banner_end;
0067 
0068 end
0069 
0070 if nargout == 0
0071   for ii=1:length(txt)
0072     disp(txt{ii});
0073   end
0074 end
0075

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003