NGINIT is called by the function LTPDA_NOISEGEN it takes the pole zero model pzm (user input to LTPDA_NOISEGEN) as input and returns as outputs: - a: numerator coefficients - b: denominator coefficients of the target transfer function A Monsky 24-07-07 $Id: ngconv.m,v 1.2 2008/01/23 17:23:56 anneke Exp $
0001 function [a,b] = ngconv(pzm) 0002 % NGINIT is called by the function LTPDA_NOISEGEN 0003 % it takes the pole zero model pzm (user input to LTPDA_NOISEGEN) 0004 % as input and returns as 0005 % outputs: 0006 % - a: numerator coefficients 0007 % - b: denominator coefficients 0008 % of the target transfer function 0009 % A Monsky 24-07-07 0010 % 0011 % $Id: ngconv.m,v 1.2 2008/01/23 17:23:56 anneke Exp $ 0012 0013 0014 0015 zs = get(pzm, 'zeros'); 0016 ps = get(pzm, 'poles'); 0017 0018 %% 0019 f_zer = []; 0020 q_zer = []; 0021 for j=1:length(zs) 0022 z = zs(j); 0023 f_zer(j,1) = [get(z,'f')]; 0024 q_zer(j,1) = [get(z,'q')]; 0025 %if isnan(q_zer(j)) 0026 % q_zer(j,1) = 0; 0027 %end 0028 %zv(j,1:2) = [f q]; 0029 end 0030 0031 f_pol = []; 0032 q_pol = []; 0033 for j=1:length(ps) 0034 p = ps(j); 0035 f_pol(j,1) = [get(p,'f')]; 0036 q_pol(j,1) = [get(p,'q')]; 0037 %if isnan(q_pol(j)) 0038 % q_pol(j,1) = 0; 0039 %end 0040 end 0041 %% calculate factors from f and q 0042 pol = fq2fac(f_pol,q_pol); 0043 zer = fq2fac(f_zer,q_zer); 0044 %% 0045 [b,a] = conv_noisegen(pol,zer); 0046 0047 0048 0049 %END