Mercurial > hg > ltpda
diff m-toolbox/classes/@pz/setRI.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@pz/setRI.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,37 @@ +% SETRI Set the property 'ri' and computes 'f' and 'q' +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: SETRI Set the property 'ri' and computes 'f' and 'q' +% +% CALL: obj = obj.setRI(val); +% obj = setRI(obj, val); +% +% INPUTS: obj - is a pz object +% +% VERSION: $Id: setRI.m,v 1.2 2011/02/18 16:48:54 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function ii = setRI(ii, val) + + %%% decide whether we modify the pz-object, or create a new one. + ii = copy(ii, nargout); + + if numel(val) == 1 + % add conjugate + val = [val conj(val)]; + elseif numel(val) == 2 + if val(1) ~= conj(val(2)) + error('### Please enter a conjugate pair to specify a complex pole.'); + end + else + error('### A pole/zero must be defined with a conjugate pair or a single complex number'); + end + + %%% set 'ri' + ii.ri = val; + %%% Then compute and set f and Q + [f,q] = pz.ri2fq(ii.ri); + ii.f = f; + ii.q = q; +end