Mercurial > forge
changeset 8462:47ff9e62bbba octave-forge
impinvar/invimpinvar: removed private function pad_poly and replaced with octave-core prepad
author | carandraug |
---|---|
date | Sat, 01 Oct 2011 20:32:55 +0000 |
parents | b5d8ece749d6 |
children | 12f50e8822d1 |
files | main/signal/inst/impinvar.m main/signal/inst/private/h1_z_deriv.m main/signal/inst/private/inv_residue.m main/signal/inst/private/pad_poly.m |
diffstat | 4 files changed, 5 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/main/signal/inst/impinvar.m Fri Sep 30 19:06:11 2011 +0000 +++ b/main/signal/inst/impinvar.m Sat Oct 01 20:32:55 2011 +0000 @@ -1,4 +1,4 @@ -## Copyright 2007 R.G.H. Eschauzier <reschauzier@yahoo.com> +## Copyright (c) 2007 R.G.H. Eschauzier <reschauzier@yahoo.com> ## Copyright (c) 2011 Carnë Draug <carandraug+dev@gmail.com> ## Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch> ##
--- a/main/signal/inst/private/h1_z_deriv.m Fri Sep 30 19:06:11 2011 +0000 +++ b/main/signal/inst/private/h1_z_deriv.m Sat Oct 01 20:32:55 2011 +0000 @@ -27,13 +27,13 @@ d = (-1)^n; % Vector with the derivatives of H1(z) for i=(1:n-1) d = conv(d,[1 0]); % Shift result right (multiply by -z) - d += pad_poly(polyderiv(d),i+1); % Add the derivative + d += prepad(polyderiv(d), i+1, 0) % Add the derivative endfor %% Build output vector b = zeros(1,n+1); for i=(1:n) - b += d(i) * pad_poly(h1_deriv(n-i+1, ts), n+1); + b += d(i) * prepad(h1_deriv(n-i+1, ts), n+1, 0); endfor b *= ts^(n+1)/factorial(n);
--- a/main/signal/inst/private/inv_residue.m Fri Sep 30 19:06:11 2011 +0000 +++ b/main/signal/inst/private/inv_residue.m Sat Oct 01 20:32:55 2011 +0000 @@ -40,7 +40,7 @@ while (i<=n) term = [1 -p_in(i)]; % Term to be factored out p = r_in(i)*deconv(a_out,term); % Residue times resulting polynomial - p = pad_poly(p,n+1); % Pad for proper length + p = prepad(p, n+1, 0); % Pad for proper length b_out += p; m = 1; @@ -51,7 +51,7 @@ m++; mterm = conv(mterm, term); % Next multiplicity to be factored out p = r_in(i) * deconv(a_out, mterm); % Resulting polynomial - p = pad_poly(p, n+1); % Pad for proper length + p = prepad(p, n+1, 0); % Pad for proper length b_out += p; endwhile i++;
--- a/main/signal/inst/private/pad_poly.m Fri Sep 30 19:06:11 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -## Copyright 2007 R.G.H. Eschauzier <reschauzier@yahoo.com> -## Adapted by Carnë Draug on 2011 <carandraug+dev@gmail.com> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -## This function is necessary for impinvar and invimpinvar of the signal package - -## Pad polynomial to length n -function p_out = pad_poly(p_in,n) - l = length(p_in); % Length of input polynomial - p_out(n-l+1:n) = p_in(1:l); % Right shift for proper length - p_out(1:n-l) = 0; % Set first elements to zero -endfunction