Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/conv_noisegen.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 % CONV_NOISEGEN calls the matlab function conv.m to convolute poles and zeros from a given pzmodel | |
2 % | |
3 % The function is a private one and is called from ngconv.m in the | |
4 % noisegenerator folder. | |
5 % | |
6 % Inputs (from ngconv.m): | |
7 % - pol | |
8 % - zero | |
9 % | |
10 % Outputs: | |
11 % - b: denominator coefficients of transfer function | |
12 % - a: numerator coefficients of transfer function | |
13 % A Monsky 24-07-07 | |
14 % | |
15 % $Id: conv_noisegen.m,v 1.2 2008/08/01 13:19:42 ingo Exp $ | |
16 % | |
17 | |
18 function [b,a] = conv_noisegen(pol,zer) | |
19 | |
20 [m,k] = size(pol); | |
21 [n,l] = size(zer); | |
22 | |
23 coefb = pol(1,:); | |
24 | |
25 for i = 2:m | |
26 coefb = conv(coefb, pol(i,:)); | |
27 end | |
28 | |
29 b = nonzeros(coefb); | |
30 | |
31 if n~=0 | |
32 coefa = zer(1,:); | |
33 for i = 2:n | |
34 coefa = conv(coefa, zer(i,:)); | |
35 end | |
36 a = nonzeros(coefa); | |
37 else | |
38 a = 1; | |
39 end | |
40 | |
41 %normalize to bn = 1 | |
42 m = length(b); | |
43 normfac = b(m); | |
44 b = b/normfac; | |
45 a = a/(normfac*sqrt(2)); | |
46 | |
47 end | |
48 |