comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % SETRI Set the property 'ri' and computes 'f' and 'q'
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: SETRI Set the property 'ri' and computes 'f' and 'q'
5 %
6 % CALL: obj = obj.setRI(val);
7 % obj = setRI(obj, val);
8 %
9 % INPUTS: obj - is a pz object
10 %
11 % VERSION: $Id: setRI.m,v 1.2 2011/02/18 16:48:54 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function ii = setRI(ii, val)
16
17 %%% decide whether we modify the pz-object, or create a new one.
18 ii = copy(ii, nargout);
19
20 if numel(val) == 1
21 % add conjugate
22 val = [val conj(val)];
23 elseif numel(val) == 2
24 if val(1) ~= conj(val(2))
25 error('### Please enter a conjugate pair to specify a complex pole.');
26 end
27 else
28 error('### A pole/zero must be defined with a conjugate pair or a single complex number');
29 end
30
31 %%% set 'ri'
32 ii.ri = val;
33 %%% Then compute and set f and Q
34 [f,q] = pz.ri2fq(ii.ri);
35 ii.f = f;
36 ii.q = q;
37 end