


PZ is the ltpda class that provides a common definition of poles and zeros.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: PZ is the ltpda class that provides a common definition of
poles and zeros.
CONSTRUCTORS:
p = pz(f) % specify frequency
p = pz(f,q) % specify frequency and Q
p = pz(c) % create with complex representation
SUPER CLASSES: ltpda_nuo < ltpda_obj
PROPERTIES:
Inherit Properties (read only)
version - cvs-version string.
Protected Properties (read only)
f - frequency of pole/zero
q - quality factor of pole/zero
ri - complex representation of pole/zero
PZ METHODS:
Defined Abstract methods:
char - returns one character string which represents the object
copy - copies an object
display - displays an object
update_struct - updates a object structure to the current tbx-version
Public methods:
cz2iir - return a,b IIR filter coefficients for a complex zero designed
using the bilinear transform.
cp2iir - return a,b IIR filter coefficients for a complex pole designed
using the bilinear transform.
rp2iir - return a,b coefficients for a real pole designed using the
bilinear transform.
rz2iir - return a,b IIR filter coefficients for a real zero designed using
the bilinear transform.
Protected methods:
setF - set the frequency property
setQ - set the quality factor
setRI - set the complex form of the pole/zero
ri2fq - convert comlpex pole/zero into frequency/Q pole/zero representation.
fq2ri - convert frequency/Q pole/zero representation
M-FILE INFO: The following call returns an minfo object that contains
information about the pz constructor:
>> info = pz.getInfo
or >> info = pz.getInfo('pz')
You can get information about class methods by calling:
>> info = pz.getInfo(method)
e.g. >> info = pz.getInfo('eq')
You can also restrict the sets of parameters contained in
the minfo object by calling:
>> info = pz.getInfo(method, set)
e.g. >> info = pz.getInfo('param', 'Default')
VERSION: $Id: pz.m,v 1.21 2008/08/11 07:25:39 hewitson Exp $
HISTORY: 19-05-2008 Diepholz
Creation.
SEE ALSO: ltpda_obj, ltpda_nuo, pzmodel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 % PZ is the ltpda class that provides a common definition of poles and zeros. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: PZ is the ltpda class that provides a common definition of 0005 % poles and zeros. 0006 % 0007 % CONSTRUCTORS: 0008 % 0009 % p = pz(f) % specify frequency 0010 % p = pz(f,q) % specify frequency and Q 0011 % p = pz(c) % create with complex representation 0012 % 0013 % 0014 % SUPER CLASSES: ltpda_nuo < ltpda_obj 0015 % 0016 % PROPERTIES: 0017 % 0018 % Inherit Properties (read only) 0019 % version - cvs-version string. 0020 % 0021 % Protected Properties (read only) 0022 % f - frequency of pole/zero 0023 % q - quality factor of pole/zero 0024 % ri - complex representation of pole/zero 0025 % 0026 % PZ METHODS: 0027 % 0028 % Defined Abstract methods: 0029 % char - returns one character string which represents the object 0030 % copy - copies an object 0031 % display - displays an object 0032 % update_struct - updates a object structure to the current tbx-version 0033 % 0034 % Public methods: 0035 % cz2iir - return a,b IIR filter coefficients for a complex zero designed 0036 % using the bilinear transform. 0037 % cp2iir - return a,b IIR filter coefficients for a complex pole designed 0038 % using the bilinear transform. 0039 % rp2iir - return a,b coefficients for a real pole designed using the 0040 % bilinear transform. 0041 % rz2iir - return a,b IIR filter coefficients for a real zero designed using 0042 % the bilinear transform. 0043 % 0044 % Protected methods: 0045 % setF - set the frequency property 0046 % setQ - set the quality factor 0047 % setRI - set the complex form of the pole/zero 0048 % ri2fq - convert comlpex pole/zero into frequency/Q pole/zero representation. 0049 % fq2ri - convert frequency/Q pole/zero representation 0050 % 0051 % M-FILE INFO: The following call returns an minfo object that contains 0052 % information about the pz constructor: 0053 % >> info = pz.getInfo 0054 % or >> info = pz.getInfo('pz') 0055 % 0056 % You can get information about class methods by calling: 0057 % >> info = pz.getInfo(method) 0058 % e.g. >> info = pz.getInfo('eq') 0059 % 0060 % You can also restrict the sets of parameters contained in 0061 % the minfo object by calling: 0062 % >> info = pz.getInfo(method, set) 0063 % e.g. >> info = pz.getInfo('param', 'Default') 0064 % 0065 % VERSION: $Id: pz.m,v 1.21 2008/08/11 07:25:39 hewitson Exp $ 0066 % 0067 % HISTORY: 19-05-2008 Diepholz 0068 % Creation. 0069 % 0070 % SEE ALSO: ltpda_obj, ltpda_nuo, pzmodel 0071 % 0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0073 0074 classdef pz < ltpda_nuo 0075 0076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0077 % Property definition % 0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0079 0080 %---------- Public (read/write) Properties ---------- 0081 properties 0082 end 0083 0084 %---------- Protected read-only Properties ---------- 0085 properties (SetAccess = protected) 0086 f = NaN; 0087 q = NaN; 0088 ri = NaN; 0089 end 0090 0091 %---------- Private Properties ---------- 0092 properties (GetAccess = protected, SetAccess = protected) 0093 end 0094 0095 %---------- Abstract Properties ---------- 0096 properties (Abstract = true, SetAccess = protected) 0097 end 0098 0099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0100 % Check property setting % 0101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0102 0103 methods 0104 function obj = set.f(obj, val) 0105 if ~isnumeric(val) || isempty(val) || ~isreal(val) 0106 error('### The value for the property ''f'' must be a real positive number'); 0107 end 0108 obj.f = val; 0109 end 0110 function obj = set.q(obj, val) 0111 if ~isnumeric(val) || isempty(val) || ~isreal(val) 0112 error('### The value for the property ''q'' must be a real positive number'); 0113 end 0114 obj.q = val; 0115 end 0116 function obj = set.ri(obj, val) 0117 if ~isnumeric(val) || isempty(val) 0118 error('### The value for the property ''ri'' must be a number'); 0119 end 0120 obj.ri = val; 0121 end 0122 end 0123 0124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0125 % Constructor % 0126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0127 0128 methods 0129 function obj = pz(varargin) 0130 0131 %%% Call superclass 0132 obj = obj@ltpda_nuo(varargin{:}); 0133 0134 %%%%%%%%%% Set dafault values %%%%%%%%%% 0135 %%% Exept for a struct as an input 0136 if ~(nargin == 1 && isstruct(varargin{1})) 0137 % set version 0138 obj.setVersion('$Id: pz.m,v 1.21 2008/08/11 07:25:39 hewitson Exp $'); 0139 end 0140 0141 if nargin == 0 0142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% no inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0145 0146 elseif nargin == 1 0147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0150 0151 %%%%%%%%%% Copy ltpda_obj Object %%%%%%%%%% 0152 if isa(varargin{1}, 'pz') 0153 obj = copy(varargin{1}, 1); 0154 0155 %%%%%%%%%% real or complex pole/zero 0156 elseif isnumeric(varargin{1}) 0157 if isreal(varargin{1}) 0158 obj.setF(varargin{1}); 0159 obj.setQ(NaN); 0160 else 0161 obj.setRI(varargin{1}); 0162 end 0163 elseif isa(varargin{1}, 'plist') 0164 pl = varargin{1}; 0165 f = find(pl, 'f'); 0166 q = find(pl, 'q'); 0167 ri = find(pl, 'ri'); 0168 if ~isempty(f) 0169 obj.setF(f); 0170 if ~isempty(q) 0171 obj.setQ(q); 0172 end 0173 elseif ~isempty(ri) 0174 obj.setRI(ri); 0175 else 0176 error('### Unknown plist constructor'); 0177 end 0178 elseif isstruct(varargin{1}) 0179 0180 %%%%%%%%%% obj = pz(structure) %%%%%%%%%% 0181 0182 %%% Set properties which are declared in this class 0183 obj.f = varargin{1}.f; 0184 obj.q = varargin{1}.q; 0185 obj.ri = varargin{1}.ri; 0186 0187 else 0188 error('### Unknown call of the pz constructor.'); 0189 end 0190 0191 elseif nargin == 2 0192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0195 0196 %%%%%%%%%% obj = pz(f, q) %%%%%%%%%% 0197 % f,q constructor 0198 obj.setF(varargin{1}); 0199 obj.setQ(varargin{2}); 0200 else 0201 error('### Unknown number of arguments.'); 0202 end 0203 0204 end 0205 0206 end 0207 0208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0209 % Methods (public) % 0210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0211 0212 methods 0213 varargout = cp2iir(varargin) 0214 varargout = cz2iir(varargin) 0215 varargout = rz2iir(varargin) 0216 varargout = rp2iir(varargin) 0217 end 0218 0219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0220 % Methods (protected) % 0221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0222 0223 methods (Access = protected) 0224 ii = setF(ii, val) 0225 ii = setQ(ii, val) 0226 ii = setRI(ii, val) 0227 end 0228 0229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0230 % Methods (public) % 0231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0232 0233 methods 0234 varargout = copy(varargin) 0235 [f,r] = resp(varargin) 0236 varargout = string(varargin) 0237 end 0238 0239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0240 % Methods (protected, static) % 0241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0242 0243 methods( Access = protected, Static) 0244 [f0, q] = ri2fq(c); 0245 ri = fq2ri(f0, Q); 0246 end 0247 0248 0249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0250 % Methods (static) % 0251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0252 0253 methods (Static) 0254 0255 varargout = update_struct(varargin); 0256 0257 function out = VEROUT() 0258 out = '$Id: pz.m,v 1.21 2008/08/11 07:25:39 hewitson Exp $'; 0259 end 0260 0261 function ii = getInfo(varargin) 0262 ii = utils.helper.generic_getInfo(varargin{:}, 'pz'); 0263 end 0264 0265 function out = SETS() 0266 out = {'Default'}; 0267 end 0268 0269 function out = getDefaultPlist(set) 0270 switch set 0271 case 'Default' 0272 out = plist(); 0273 otherwise 0274 out = plist(); 0275 end 0276 end 0277 0278 end 0279 0280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0281 % Methods (Static, Private) % 0282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0283 0284 methods (Static = true, Access = private) 0285 end 0286 0287 end % End classdef