changeset 9619:bf1a6199ecf6 octave-forge

signal: Applying patches from devian packaging group. Generator Rafael Laboissiere rafael@laboissiere.net
author jpicarbajal
date Sat, 10 Mar 2012 12:40:15 +0000
parents 6ffa69556df6
children 22fc7f0bd338
files main/signal/inst/filtfilt.m main/signal/inst/fir1.m main/signal/inst/fir2.m main/signal/inst/impinvar.m main/signal/inst/invimpinvar.m main/signal/inst/residued.m
diffstat 6 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/main/signal/inst/filtfilt.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/filtfilt.m	Sat Mar 10 12:40:15 2012 +0000
@@ -105,11 +105,11 @@
 %! y = filtfilt(b, a, r+s);
 %! assert (size(r), size(y));
 %! assert (mean(abs(y)) < 1e3);
-%! assert (corrcoef(s(250:750), y(250:750)) > .95)
+%! assert (corr(s(250:750), y(250:750)) > .95)
 %! [b,a] = butter(2, [4e-4 8e-2]);
 %! yb = filtfilt(b, a, r+s);
 %! assert (mean(abs(yb)) < 1e3);
-%! assert (corrcoef(y, yb) > .99)
+%! assert (corr(y, yb) > .99)
 
 %!test
 %! randn('state',0);
--- a/main/signal/inst/fir1.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/fir1.m	Sat Mar 10 12:40:15 2012 +0000
@@ -92,7 +92,7 @@
   if rem(n,2)==1 && m(2*bands)==1, 
     warning("n must be even for highpass and bandstop filters. Incrementing.");
     n = n+1;
-    if isvector(window) && isreal(window)
+    if isvector(window) && isreal(window) && !ischar(window)
       ## Extend the window using interpolation
       M = length(window);
       if M == 1,
--- a/main/signal/inst/fir2.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/fir2.m	Sat Mar 10 12:40:15 2012 +0000
@@ -72,7 +72,7 @@
   if length(ramp_n)>1, w=ramp_n; ramp_n=grid_n/20; endif
   if nargin < 6, window=w; endif
   if isempty(window), window=hamming(n+1); endif
-  if !isreal(window), window=feval(window, n+1); endif
+  if !isreal(window) || ischar(window), window=feval(window, n+1); endif
   if length(window) != n+1, usage("window must be of length n+1"); endif
 
   ## make sure grid is big enough for the window
--- a/main/signal/inst/impinvar.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/impinvar.m	Sat Mar 10 12:40:15 2012 +0000
@@ -123,7 +123,7 @@
 %!
 %!  % calculate impulse response of continuous time system
 %!  % at discrete time intervals 1/fs
-%!  ys=impulse(s,1,(n-1)/fs,n);
+%!  ys=impulse(s,(n-1)/fs,1/fs)';
 %!
 %!  % impulse response of discrete time system
 %!  yz=filter(bz,az,[1 zeros(1,n-1)]);
--- a/main/signal/inst/invimpinvar.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/invimpinvar.m	Sat Mar 10 12:40:15 2012 +0000
@@ -126,7 +126,7 @@
 %!
 %!  % calculate impulse response of continuous time system
 %!  % at discrete time intervals 1/fs
-%!  ys=impulse(s,1,(n-1)/fs,n);
+%!  ys=impulse(s,(n-1)/fs,1/fs)';
 %!
 %!  % impulse response of discrete time system
 %!  yz=filter(bz,az,[1 zeros(1,n-1)]);
--- a/main/signal/inst/residued.m	Sat Mar 10 04:18:08 2012 +0000
+++ b/main/signal/inst/residued.m	Sat Mar 10 12:40:15 2012 +0000
@@ -15,9 +15,9 @@
 
 %% -*- texinfo -*-
 %% @deftypefn {Function File} {[@var{r}, @var{p}, @var{f}, @var{m}] =} residued (@var{B}, @var{A})
-%% Compute the partial fraction expansion (PFE) of filter 
+%% Compute the partial fraction expansion (PFE) of filter
 %% @math{H(z) = B(z)/A(z)}.
-%% In the usual PFE function @code{residuez}, 
+%% In the usual PFE function @code{residuez},
 %% the IIR part (poles @var{p} and residues
 %% @var{r}) is driven @emph{in parallel} with the FIR part (@var{f}).
 %% In this variant (@code{residued}) the IIR part is driven
@@ -26,7 +26,7 @@
 %%
 %% INPUTS:
 %% @var{B} and @var{A} are vectors specifying the digital filter @math{H(z) = B(z)/A(z)}.
-%% Say @code{help filter} for documentation of the @var{B} and @var{A} 
+%% Say @code{help filter} for documentation of the @var{B} and @var{A}
 %% filter coefficients.
 %%
 %% RETURNED:
@@ -42,9 +42,9 @@
 %%   Say @code{test residued verbose} to see a number of examples.
 %% @end example
 %%
-%% For the theory of operation, see 
+%% For the theory of operation, see
 %% @indicateurl{http://ccrma.stanford.edu/~jos/filters/residued.html}
-%% 
+%%
 %% @seealso{residue residued}
 %% @end deftypefn
 
@@ -60,21 +60,21 @@
   %
   % This is the same result as returned by RESIDUEZ.
   % Otherwise, the FIR part f will be nonempty,
-  % and the returned filter is 
+  % and the returned filter is
   %
   % H(z) = f(1) + f(2)/z + f(3)/z^2 + ... + f(nf)/z^M + R(z)/z^M
   %
   % where R(z) is the parallel one-pole filter bank defined above,
   % and M is the order of F(z) = length(f)-1 = nb-na.
-  % 
+  %
   % Note, in particular, that the impulse-response of the parallel
   % (complex) one-pole filter bank starts AFTER that of the the FIR part.
   % In the result returned by RESIDUEZ, R(z) is not divided by z^M,
   % so its impulse response starts at time 0 in parallel with f(n).
   %
   % J.O. Smith, 9/19/05
-    
-  if nargin==3, 
+
+  if nargin==3,
     warning("tolerance ignored");
   end
   NUM = b(:)';
@@ -91,7 +91,7 @@
   if f2, error('f2 not empty as expected'); end
 end
 
-%!test 
+%!test
 %! B=1; A=[1 -1];
 %! [r,p,f,m] = residued(B,A);
 %! assert({r,p,f,m},{1,1,[],1},100*eps);
@@ -99,38 +99,38 @@
 %! assert({r,p,f,m},{r2,p2,f2,m2},100*eps);
 % residuez and residued should be identical when length(B)<length(A)
 
-%!test 
+%!test
 %! B=[1 -2 1]; A=[1 -1];
 %! [r,p,f,m] = residued(B,A);
 %! assert({r,p,f,m},{0,1,[1 -1],1},100*eps);
 
-%!test 
+%!test
 %! B=[1 -2 1]; A=[1 -0.5];
 %! [r,p,f,m] = residued(B,A);
 %! assert({r,p,f,m},{0.25,0.5,[1 -1.5],1},100*eps);
 
-%!test 
+%!test
 %! B=1; A=[1 -0.75 0.125];
 %! [r,p,f,m] = residued(B,A);
 %! [r2,p2,f2,m2] = residuez(B,A);
 %! assert({r,p,f,m},{r2,p2,f2,m2},100*eps);
 % residuez and residued should be identical when length(B)<length(A)
 
-%!test 
+%!test
 %! B=1; A=[1 -2 1];
 %! [r,p,f,m] = residued(B,A);
 %! [r2,p2,f2,m2] = residuez(B,A);
 %! assert({r,p,f,m},{r2,p2,f2,m2},100*eps);
 % residuez and residued should be identical when length(B)<length(A)
 
-%!test 
+%!test
 %! B=[6,2]; A=[1 -2 1];
 %! [r,p,f,m] = residued(B,A);
 %! [r2,p2,f2,m2] = residuez(B,A);
 %! assert({r,p,f,m},{r2,p2,f2,m2},100*eps);
 % residuez and residued should be identical when length(B)<length(A)
 
-%!test 
+%!test
 %! B=[1 1 1]; A=[1 -2 1];
 %! [r,p,f,m] = residued(B,A);
 %! assert(r,[0;3],1e-7);
@@ -138,7 +138,7 @@
 %! assert(f,1,100*eps);
 %! assert(m,[1;2],100*eps);
 
-%!test 
+%!test
 %! B=[2 6 6 2]; A=[1 -2 1];
 %! [r,p,f,m] = residued(B,A);
 %! assert(r,[8;16],3e-7);
@@ -146,7 +146,7 @@
 %! assert(f,[2,10],100*eps);
 %! assert(m,[1;2],100*eps);
 
-%!test 
+%!test
 %! B=[1,6,2]; A=[1 -2 1];
 %! [r,p,f,m] = residued(B,A);
 %! assert(r,[-1;9],3e-7);
@@ -154,8 +154,8 @@
 %! assert(f,1,100*eps);
 %! assert(m,[1;2],100*eps);
 
-%!test 
+%!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;1/2;-j/2;j/2],[-1;1;-j;j],1,[1;1;1;1]},100*eps);
+%! assert({r,p,f,m},{[-j/2;j/2;1/2;-1/2],[-j;j;1;-1],1,[1;1;1;1]},100*eps);
 %  Verified in maxima: ratsimp(%I/2/(1-%I * d) - %I/2/(1+%I * d)); etc.