comparison m-toolbox/classes/@pz/cp2iir.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 % CP2IIR Return a,b IIR filter coefficients for a complex pole designed using the bilinear transform.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CP2IIR Return a,b IIR filter coefficients for a complex pole
5 % designed using the bilinear transform.
6 %
7 % CALL: [a,b] = cp2iir(p, fs)
8 %
9 % REMARK: This is just a helper function. This function should only be
10 % called from class functions.
11 %
12 % INPUT: p - pole object
13 % fs - the sample rate for the filter
14 %
15 % VERSION: $Id: cp2iir.m,v 1.7 2011/02/18 16:48:54 ingo Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = cp2iir(varargin)
20
21 p = varargin{1};
22 fs = varargin{2};
23
24 f0 = p.f;
25 q = p.q;
26
27 w0 = f0*2*pi;
28 w02 = w0^2;
29
30 k = (q*w02 + 4*q*fs*fs + 2*w0*fs) / (q*w02);
31 b(1) = 1;
32 b(2) = (2*w02-8*fs*fs) / (k*w02);
33 b(3) = (q*w02 + 4*q*fs*fs - 2*w0*fs) / (k*q*w02);
34
35 a(1) = 1/k;
36 a(2) = -2/k;
37 a(3) = -1/k;
38 a = a*-2;
39
40 varargout{1} = a;
41 varargout{2} = b;
42 end
43