Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ao/ngconv.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,48 @@ +% NGCONV is called by the function fromPzmodel +% it takes the pole zero model pzm (user input to ao constructor) +% 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.4 2008/10/20 08:38:29 anneke Exp $ + +function [a,b] = ngconv(pzm) + + zs = pzm.zeros; + ps = pzm.poles; + + f_zer = zeros(length(zs)); + q_zer = zeros(length(zs)); + for j=1:length(zs) + z = zs(j); + f_zer(j,1) = z.f; + q_zer(j,1) = z.q; + %if isnan(q_zer(j)) + % q_zer(j,1) = 0; + %end + %zv(j,1:2) = [f q]; + end + + f_pol = zeros(length(ps)); + q_pol = zeros(length(ps)); + for j=1:length(ps) + p = ps(j); + f_pol(j,1) = p.f; + q_pol(j,1) = p.q; + %if isnan(q_pol(j)) + % q_pol(j,1) = 0; + %end + end + + %%% calculate factors from f and q + pol = ao.fq2fac(f_pol,q_pol); + zer = ao.fq2fac(f_zer,q_zer); + + %%% + [b,a] = ao.conv_noisegen(pol,zer); +end + +