comparison m-toolbox/classes/+utils/@math/mtxiirresp2.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 % MTXIIRRESP calculate iir resp by matrix product
2 %
3 % A contains numerators coefficients (a row for each filter)
4 % A contains denominators coefficients (a row for each filter)
5 %
6 % NOTE: A and B should have the same size, zero pad if necessary
7 %
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9 function rsp = mtxiirresp2(A,B,freq,fs)
10 T = 1/fs;
11
12 % build Z matrix
13 Z = ones(size(A,2),numel(freq));
14 zz = exp(-2.*pi.*1i.*T.*freq);
15 for jj=2:size(Z,1)
16 Z(jj,:) = zz.^(jj-1);
17 end
18
19 % get numerator and denominator
20 num = A*Z;
21 den = B*Z;
22 % get response
23 rspm = num./den;
24 if size(A,1)>1
25 rsp = sum(rspm,1);
26 else
27 rsp = rspm;
28 end
29
30
31 end