-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

The functions residued() and residuez() seem to be broken in the current
release of octave. The reason is that they call residue() with a third
parameter specifying a tolerance, but residue does not accept such a
parameter.

The attached patch fixes the issue by removing the tolerance value
altogether. residuez() now passes all its tests.

For residued(), there was a problem with the last test. Test results
were correct, but the order of the poles differed from the expected
result, so the test was reported as failure. I swapped the columns in
the expected result so the function passes the test.

I hope removing the third parameter does not break anything... I checked
for occurrences of "residue" in all the signal processing toolbox files,
and there seems to be none affected. Is there a way to automatically run
all the tests for those functions?

Hope this helps,
Jonas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHt/Hs68Rj+pj1GF0RAp2GAKCsCTe4/g97A9rUeuH9koC9jfTu+ACgiibF
Vq5+QspwlLPaAeKTWCRpPCU=
=hIUW
-----END PGP SIGNATURE-----
--- residued_old.m      2008-02-17 15:52:49.000000000 +0800
+++ residued_new.m      2008-02-17 16:16:57.000000000 +0800
@@ -49,7 +49,7 @@
 %% @seealso{residue residued}
 %% @end deftypefn
 
-function [r, p, f, m] = residued(b, a, toler)
+function [r, p, f, m] = residued(b, a)
 % RESIDUED - return residues, poles, and FIR part of B(z)/A(z)
 %
 % Let nb = length(b), na = length(a), and N=na-1 = no. of poles.
@@ -75,7 +75,6 @@
 %
 % J.O. Smith, 9/19/05
   
-if nargin<3, toler=0.001; end
 NUM = b(:)';
 DEN = a(:)';
 nb = length(NUM);
@@ -86,7 +85,7 @@
   NUM = NUM - conv(DEN,f);
   NUM = NUM(nb-na+2:end);
 end
-[r,p,f2,m] = residuez(NUM,DEN,toler);
+[r,p,f2,m] = residuez(NUM,DEN);
 if f2, error('f2 not empty as expected'); end
 
 %!test 
@@ -155,5 +154,5 @@
 %!test 
 %! B=[1 0 0 0 1]; A=[1 0 0 0 -1];
 %! [r,p,f,m] = residued(B,A);
-%! assert({r,p,f,m},{[-1/2;-j/2;j/2;1/2],[-1;-j;j;1],1,[1;1;1;1]},100*eps);
+%! assert({r,p,f,m},{[+1/2;-1/2;-j/2;+j/2],[+1;-1;-j;+j],1,[1;1;1;1]},100*eps);
 %  Verified in maxima: ratsimp(%I/2/(1-%I * d) - %I/2/(1+%I * d)); etc.
--- residuez_old.m      2008-02-17 15:52:42.000000000 +0800
+++ residuez_new.m      2008-02-17 16:17:49.000000000 +0800
@@ -42,7 +42,7 @@
 %% @seealso{residue residued}
 %% @end deftypefn
 
-function [r, p, f, m] = residuez(B, A, tol)
+function [r, p, f, m] = residuez(B, A)
 % RESIDUEZ - return residues, poles, and FIR part of B(z)/A(z)
 %
 % Let nb = length(b), na = length(a), and N=na-1 = no. of poles.
@@ -67,10 +67,9 @@
 %
 % J.O. Smith, 9/19/05
   
-if nargin<3, tol=0.001; end
 NUM = B(:)'; DEN = A(:)';
 % Matlab's residue does not return m (since it is implied by p):
-[r,p,f,m]=residue(conj(fliplr(NUM)),conj(fliplr(DEN)),tol);
+[r,p,f,m]=residue(conj(fliplr(NUM)),conj(fliplr(DEN)));
 p = 1 ./ p;
 r = r .* ((-p) .^m);
 if f, f = conj(fliplr(f)); end
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to