I agree that our implementation should be compatible with the one in Matlab. Could you provide a patch for the change? Also, could you be persuaded into changing the documentation such that it reflects the change?
Thanks Søren tor, 26 03 2009 kl. 16:50 +0200, skrev nit ar: > > 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! Try it! > ------------------------------------------------------------------------------ > _______________________________________________ > Octave-dev mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/octave-dev ------------------------------------------------------------------------------ _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
