Hello octaveforge developers,

I am reporting again about the xcorr(...,'coeff') matlab compatibility issue 
(or bug ?!):

see previous message for description.

This problem can be easily solved by changing current lines 174 to 175 in 
xcorr.m

  elseif strcmp(scale,'coeff')
    R = R ./ ( ones(rows(R),1) * R(maxlag+1, :) );

to:

  elseif strcmp(scale,'coeff')
    if isempty(Y)
      sumx2=sum(abs(X).^2);
      csumx2=sumx2.'*sumx2;
      R = R ./ sqrt( ones(rows(R),1) * csumx2(:).' );
    else
      R = R / sqrt( sum(abs(X).^2) * sum(abs(Y.^2)) );
    end


Regards
Nitzan Arazi
From: [email protected]
To: [email protected]
Subject: xcorr incompatibilty
Date: Mon, 4 Feb 2008 09:04:58 +0200








Hello octaveforge developers,

I have found some incompatibility of the xcorr function between Octave and 
Matlab.

When using c=xcorr(x,y,'coeff'), the 'coeff' scale is used by Octave to 
normalize the cross correlation c at lag=0 to the value 1.0.
On the other hand, Matlab uses the 'coeff' scale to normalize the the cross 
correlation with an equivalent factor such that the autocorrelations of both x 
and y are 1.0 at lag=0 !

This produce different scaling by xcorr(x,y,'coeff') in Octave and Matlab !
I assume that this is not a bug since the different behavior is clearly 
documented as different. It may be useful to change the definition of Octave's 
xcorr scale parameter to be compatible with Matlab definition (this can be 
easily done in the xcorr.m code).

Nitzan Arazi


Express yourself instantly with MSN Messenger! MSN Messenger
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
------------------------------------------------------------------------------
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to