From: <mtm...@us...> - 2012-08-15 06:33:56
|
Revision: 10874 http://octave.svn.sourceforge.net/octave/?rev=10874&view=rev Author: mtmiller Date: 2012-08-15 06:33:49 +0000 (Wed, 15 Aug 2012) Log Message: ----------- fir2: fix default frequency response interpolation parameters * Increase default interpolation size for larger filter length. * Default transition width is 1/25 of interpolation size. Modified Paths: -------------- trunk/octave-forge/main/signal/inst/fir2.m Modified: trunk/octave-forge/main/signal/inst/fir2.m =================================================================== --- trunk/octave-forge/main/signal/inst/fir2.m 2012-08-14 20:50:42 UTC (rev 10873) +++ trunk/octave-forge/main/signal/inst/fir2.m 2012-08-15 06:33:49 UTC (rev 10874) @@ -28,7 +28,7 @@ ## grid_n: length of ideal frequency response function ## defaults to 512, should be a power of 2 bigger than n/2 ## ramp_n: transition width for jumps in filter response -## defaults to grid_n/20; a wider ramp gives wider transitions +## defaults to grid_n/25; a wider ramp gives wider transitions ## but has better stopband characteristics. ## window: smoothing window ## defaults to hamming(n+1) row vector @@ -75,7 +75,14 @@ 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 - if isempty (grid_n), grid_n = 512; endif + ## Default grid size is 512... unless n+1 >= 1024 + if isempty (grid_n) + if n+1 < 1024 + grid_n = 512; + else + grid_n = n+1; + endif + endif ## ML behavior appears to always round the grid size up to a power of 2 grid_n = 2 ^ nextpow2 (grid_n); @@ -85,7 +92,7 @@ error ("fir2: grid size must be greater than half the filter order"); endif - if isempty (ramp_n), ramp_n = fix (grid_n / 20); endif + if isempty (ramp_n), ramp_n = fix (grid_n / 25); endif ## Apply ramps to discontinuities if (ramp_n > 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-08-15 12:07:18
|
Revision: 10876 http://octave.svn.sourceforge.net/octave/?rev=10876&view=rev Author: carandraug Date: 2012-08-15 12:07:12 +0000 (Wed, 15 Aug 2012) Log Message: ----------- fir2: replace calls to soon to be deprecated usage Modified Paths: -------------- trunk/octave-forge/main/signal/inst/fir2.m Modified: trunk/octave-forge/main/signal/inst/fir2.m =================================================================== --- trunk/octave-forge/main/signal/inst/fir2.m 2012-08-15 10:36:54 UTC (rev 10875) +++ trunk/octave-forge/main/signal/inst/fir2.m 2012-08-15 12:07:12 UTC (rev 10876) @@ -52,16 +52,13 @@ ## verify frequency and magnitude vectors are reasonable t = length(f); if t<2 || f(1)!=0 || f(t)!=1 || any(diff(f)<0) - usage("frequency must be nondecreasing starting from 0 and ending at 1"); - endif - if t != length(m) - usage("frequency and magnitude vectors must be the same length"); - endif - + error ("fir2: frequency must be nondecreasing starting from 0 and ending at 1"); + elseif t != length(m) + error ("fir2: frequency and magnitude vectors must be the same length"); ## find the grid spacing and ramp width - if (nargin>4 && length(grid_n)>1) || \ - (nargin>5 && (length(grid_n)>1 || length(ramp_n)>1)) - usage("grid_n and ramp_n must be integers"); + elseif (nargin>4 && length(grid_n)>1) || \ + (nargin>5 && (length(grid_n)>1 || length(ramp_n)>1)) + error ("fir2: grid_n and ramp_n must be integers"); endif if nargin < 4, grid_n=[]; endif if nargin < 5, ramp_n=[]; endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-08-15 13:15:18
|
Revision: 10877 http://octave.svn.sourceforge.net/octave/?rev=10877&view=rev Author: carandraug Date: 2012-08-15 13:15:12 +0000 (Wed, 15 Aug 2012) Log Message: ----------- fir2: replace more calls to soon to be deprecated usage Modified Paths: -------------- trunk/octave-forge/main/signal/inst/fir2.m Modified: trunk/octave-forge/main/signal/inst/fir2.m =================================================================== --- trunk/octave-forge/main/signal/inst/fir2.m 2012-08-15 12:07:12 UTC (rev 10876) +++ trunk/octave-forge/main/signal/inst/fir2.m 2012-08-15 13:15:12 UTC (rev 10877) @@ -70,7 +70,7 @@ if nargin < 6, window=w; endif if isempty(window), window=hamming(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 + if length(window) != n+1, error ("fir2: window must be of length n+1"); endif ## Default grid size is 512... unless n+1 >= 1024 if isempty (grid_n) @@ -136,6 +136,7 @@ else b = b' .* window; endif + b = b' endfunction %% Test that the grid size is rounded up to the next power of 2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |