On Fri, Jul 27, 2012 at 10:14 AM, Carnë Draug wrote: > On 6 July 2012 03:11, Mike Miller <mtmil...@ieee.org> wrote: >> >> The only thing that is not clear to me is whether this matches ML >> behavior, and whether we care, e.g. if the caller passes in a 4th arg >> too small, does ML generate an error or silently make it larger like >> this line 29 does? > > MatLab gives an error in somes cases and silently makes it larger in others. > >>> f = [0 0.6 0.6 1]; m = [1 1 0 0]; >>> b5 = fir2(30,f,m, 5); > Error using fir2 (line 135) > The number of grid points npt must be greater than or equal to 16 for > filter order 30. > >>> b8 = fir2(30,f,m, 8); > Error using fir2 (line 135) > The number of grid points npt must be greater than or equal to 16 for > filter order 30. > >>> b9 = fir2(30,f,m, 9); >>> b15 = fir2(30,f,m, 15); >>> b16 = fir2(30,f,m, 16); >>> b17 = fir2(30,f,m, 17); >>> isequal (b9, b15) > > ans = > > 1 > >>> isequal (b15, b16) > > ans = > > 1 > >>> isequal (b16, b17) > > ans = > > 0 > > > Seems that MatLab behaviour is to adjust number of points (to the > minimum), if the value is more than half of it and error otherwise. > > Not sure what's the best behavior but I'd guess at least a warning > should be given.
Finally got back to this, it's now closer to what you showed here. It's clear that Matlab is forcing the 4th argument to always be a power of 2, even though that's not in the help text. I implemented that, added an error message for the case of the argument being too small (after conversion to a power of 2), and added a test case based on your examples above. Thanks for those! -- mike ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev