Home > classes > @pole > display.m

display

PURPOSE ^

DISPLAY overloads display functionality for pole objects.

SYNOPSIS ^

function txt = display(p, varargin)

DESCRIPTION ^

 DISPLAY overloads display functionality for pole objects.

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

 DESCRIPTION: DISPLAY overloads display functionality for pole objects.

 CALL:        txt  = display(pole)

 INPUT:       pole - pole object

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

 VERSION:     $Id: display.m,v 1.5 2008/02/12 21:38:23 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 pole objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: DISPLAY overloads display functionality for pole objects.
0007 %
0008 % CALL:        txt  = display(pole)
0009 %
0010 % INPUT:       pole - pole object
0011 %
0012 % OUTPUT:      txt  - cell array with strings to display the pole object
0013 %
0014 % VERSION:     $Id: display.m,v 1.5 2008/02/12 21:38:23 hewitson Exp $
0015 %
0016 % HISTORY:     30-01-2007 M Hewitson
0017 %                 Creation
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 VERSION  = '$Id: display.m,v 1.5 2008/02/12 21:38:23 hewitson Exp $';
0022 CATEGORY = 'Output';
0023 
0024 % Check if this is a call for parameters
0025 if nargin == 2
0026   if isa(p, 'pole') && 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_start = sprintf('---- pole %d ----', i);
0045   txt{end+1} = banner_start;
0046 
0047   % get key and value
0048   name = get(p(i), 'name');
0049   f    = get(p(i), 'f');
0050   q    = get(p(i), 'q');
0051   ri   = get(p(i), 'ri');
0052 
0053   % display
0054   if ~isempty(f)
0055     if q > 0.5
0056       txt{end+1} = [ sprintf('%s: %g Hz, Q=%g [', name, f, q) num2str(ri(1)) ']'];
0057     else
0058       txt{end+1} = sprintf('%s: %g Hz', name, f);
0059     end
0060   end
0061 
0062   banner_end(1:length(banner_start)) = '-';
0063   txt{end+1} = banner_end;
0064 
0065 end
0066 
0067 if nargout == 0
0068   for ii=1:length(txt)
0069     disp(txt{ii});
0070   end
0071 end
0072

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