CONV_NOISEGEN calls the matlab function conv.m to convolute poles and zeros from a given pzmodel The function is a private one and is called from ngconv.m in the noisegenerator folder. Inputs (from ngconv.m): - pol - zero Outputs: - b: denominator coefficients of transfer function - a: numerator coefficients of transfer function A Monsky 24-07-07 $Id: conv_noisegen.m,v 1.2 2008/08/01 13:19:42 ingo Exp $
0001 % CONV_NOISEGEN calls the matlab function conv.m to convolute poles and zeros from a given pzmodel 0002 % 0003 % The function is a private one and is called from ngconv.m in the 0004 % noisegenerator folder. 0005 % 0006 % Inputs (from ngconv.m): 0007 % - pol 0008 % - zero 0009 % 0010 % Outputs: 0011 % - b: denominator coefficients of transfer function 0012 % - a: numerator coefficients of transfer function 0013 % A Monsky 24-07-07 0014 % 0015 % $Id: conv_noisegen.m,v 1.2 2008/08/01 13:19:42 ingo Exp $ 0016 % 0017 0018 function [b,a] = conv_noisegen(pol,zer) 0019 0020 [m,k] = size(pol); 0021 [n,l] = size(zer); 0022 0023 coefb = pol(1,:); 0024 0025 for i = 2:m 0026 coefb = conv(coefb, pol(i,:)); 0027 end 0028 0029 b = nonzeros(coefb); 0030 0031 if n~=0 0032 coefa = zer(1,:); 0033 for i = 2:n 0034 coefa = conv(coefa, zer(i,:)); 0035 end 0036 a = nonzeros(coefa); 0037 else 0038 a = 1; 0039 end 0040 0041 %normalize to bn = 1 0042 m = length(b); 0043 normfac = b(m); 0044 b = b/normfac; 0045 a = a/(normfac*sqrt(2)); 0046 0047 end 0048