bug in conv() [changeset]

Ben Abbott bpabbott at mac.com
Mon Sep 29 09:58:29 CDT 2008


On Sep 29, 2008, at 9:55 AM, John W. Eaton wrote:

> On 29-Sep-2008, Ben Abbott wrote:
>
> |
> | On Sep 28, 2008, at 4:47 PM, dph.work wrote:
> |
> | > According to http://www.gnu.org/software/octave/FAQ.html#MATLAB-compatibility
> | > differences in Matlab and Octave are considered bugs.  The  
> attached
> | > m file
> | > illustrates how conv() produces a column vector in Matlab and a  
> row
> | > vector in
> | > Octave.
> | >
> | > Hope this helps.
> | > Dan
> | >
> | > % In Matlab the variable c ends up a column vector, while in
> | > Octave it
> | > % ends up a row vector.
> | > %
> | > % octave:9> conv_bug.m
> | > % ans =
> | > %
> | > %    1   29
> | > %octave:9> ver
> | > %
> | > %
> | >  
> ----------------------------------------------------------------------
> | > % GNU Octave Version 3.0.1
> | > % GNU Octave License: GNU General Public License
> | > % Operating System: Linux 2.6.18-4-amd64 #1 SMP Mon Mar 26  
> 11:36:53
> | > % CEST 2007 x86_64
> | > %
> | >  
> ----------------------------------------------------------------------
> | >
> | > % matlab>> conv_bug
> | > %
> | > % ans =
> | > %
> | > %    29     1
> | > %
> | > %matlab>> ver
> | > %
> | >  
> -----------------------------------------------------------------------
> | > % MATLAB Version 7.3.0.298 (R2006b)
> | > % MATLAB License Number:
> | > % Operating System: Linux 2.6.18-4-amd64 #1 SMP Mon Mar 26  
> 11:36:53
> | > % CEST 2007 x86_64
> | > % Java VM Version: Java is not enabled
> | > %
> | >  
> -----------------------------------------------------------------------
> | > % MATLAB                                     Version 7.3
> | > (R2006b)
> | > % Signal Processing Toolbox                  Version 6.6
> | > (R2006b)
> | >
> | > a = blackman(10);
> | > b = blackman(20);
> | > c = conv(a,b);
> | >
> | > size(c)
>
> We've discussed this "feature" before.  See for example
>
>  http://www.nabble.com/conv-does-not-preverve-orientation-of-input-td16342836.html
>  http://www.nabble.com/conv.m-compatibility-to421148.html#a429978
>
> I think the consensus before was to not change this behavior because
> no one could see a legitimate reason for it.
>
> | The attached changeset ensures the output from conv() respects the  
> row/
> | column orientation of the longer input, as Matlab does.
>
> This seems to be new information that no one noticed before.  If this
> is actually the motivation behind what in the past appeared to be
> arbitrary, then maybe we should make the change.
>
> Comments?
>
> jwe

Since Matlab's conv() and deconv() each are consistent in the  
orientation of the inputs/outputs, I think it is safe to assume it is  
intentional (not a bug). I favor making the change for the sake of  
compatibility (even though I'd qualify this as one of the many bad  
decisions made on Mathworks part).

Regarding deconv() the length of the residue should respect the  
orientation and length of "y" as well. I just sent that changeset a  
moment ago.

Ben









More information about the Bug-octave mailing list