comparison m-toolbox/classes/@ao/ngconv.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 % NGCONV is called by the function fromPzmodel
2 % it takes the pole zero model pzm (user input to ao constructor)
3 % as input and returns as
4 % outputs:
5 % - a: numerator coefficients
6 % - b: denominator coefficients
7 % of the target transfer function
8 % A Monsky 24-07-07
9 %
10 % $Id: ngconv.m,v 1.4 2008/10/20 08:38:29 anneke Exp $
11
12 function [a,b] = ngconv(pzm)
13
14 zs = pzm.zeros;
15 ps = pzm.poles;
16
17 f_zer = zeros(length(zs));
18 q_zer = zeros(length(zs));
19 for j=1:length(zs)
20 z = zs(j);
21 f_zer(j,1) = z.f;
22 q_zer(j,1) = z.q;
23 %if isnan(q_zer(j))
24 % q_zer(j,1) = 0;
25 %end
26 %zv(j,1:2) = [f q];
27 end
28
29 f_pol = zeros(length(ps));
30 q_pol = zeros(length(ps));
31 for j=1:length(ps)
32 p = ps(j);
33 f_pol(j,1) = p.f;
34 q_pol(j,1) = p.q;
35 %if isnan(q_pol(j))
36 % q_pol(j,1) = 0;
37 %end
38 end
39
40 %%% calculate factors from f and q
41 pol = ao.fq2fac(f_pol,q_pol);
42 zer = ao.fq2fac(f_zer,q_zer);
43
44 %%%
45 [b,a] = ao.conv_noisegen(pol,zer);
46 end
47
48