0001 function [f,r] = resp(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 if nargin < 1
0024 error('### incorrect number of inputs.')
0025 end
0026
0027
0028 p = varargin{1};
0029 if ~isa(p, 'pole')
0030 error('### first argument should be a pole object.');
0031 end
0032
0033 f0 = get(p, 'f');
0034 Q = get(p, 'q');
0035
0036
0037 if nargin == 1
0038
0039 f = linspace(f0/10, 10*f0, 1000);
0040
0041 elseif nargin == 2
0042 if isa(varargin{2}, 'plist')
0043 pl = varargin{2};
0044 f = find(pl, 'f');
0045 f1 = find(pl, 'f1');
0046 f2 = find(pl, 'f2');
0047 nf = find(pl, 'nf');
0048 scale = find(pl, 'scale');
0049
0050 if ~isempty(f)
0051
0052 elseif ~isempty(f1) && ~isempty(f2) && ~isempty(nf)
0053 if isempty(scale) || strcmp(scale, 'lin')
0054 f = linspace(f1, f2, nf);
0055 elseif strcmp(scale, 'log')
0056 f = logspace(f1, f2, nf);
0057 else
0058 error('### unknown scale option for pole response.');
0059 end
0060 else
0061 error('### unknown parameter list for pole response.');
0062 end
0063
0064 else
0065 f = varargin{2};
0066 end
0067 elseif nargin == 4
0068 f1 = varargin{2};
0069 f2 = varargin{3};
0070 nf = varargin{4};
0071 f = linspace(f1, f2, nf);
0072 else
0073 error('### incorrect number of inputs.');
0074 end
0075
0076
0077 if Q>0.5
0078 re = 1 - (f.^2./f0^2);
0079 im = f ./ (f0*Q);
0080 r = 1./complex(re, im);
0081 else
0082 re = 1;
0083 im = f./f0;
0084 r = 1./complex(re, im);
0085 end
0086
0087
0088