comparison m-toolbox/classes/@pzmodel/respCore.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 % RESPCORE returns the complex response of one pzmodel object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: RESPCORE returns the complex response of one pzmodel object
5 % as a data-vector. This function should only be used by the
6 % resp method of the ltpda_tf class.
7 %
8 % CALL: r = respCore(obj, f);
9 %
10 % VERSION: $Id: respCore.m,v 1.3 2010/03/15 15:49:53 ingo Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function r = respCore(varargin)
15
16 %%% Get Inputs
17 obj = varargin{1};
18 f = varargin{2}; % Row vector
19
20 gain = obj.gain;
21 poles = obj.poles;
22 zeros = obj.zeros;
23 delay = obj.delay;
24 np = numel(poles);
25 nz = numel(zeros);
26
27 %%% Compute response
28 r = gain*ones(size(f));
29
30 for j=1:np
31 if ~isnan(poles(j).f)
32 [f, pr] = resp(poles(j),f);
33 r = r .* pr;
34 end
35 end
36
37 for j=1:nz
38 if ~isnan(zeros(j).f)
39 [f, zr] = resp(zeros(j),f);
40 r = r ./zr;
41 end
42 end
43
44 r = r .* exp(-2*pi*f*1i*delay); % Row vector
45
46 end
47