Hello Peter (and Soren) No You are not mistaken.
I am using octave version 3.0.3 windows installation package which installs signal package version 1.0.8, so I didn't notice that this issue has been already fixed in the source repository.
Thanks. Nitzan Peter Lanspeary wrote:
Hi Nitzan, I am looking at revision 5430 of xcorr.m . Line 174 is "## insignificant complex portion left over from the FFT" I think that if you look at this code, you may find the problem is already fixed: ------------------------------------------- 184 elseif strcmp(scale, 'coeff') 185 ## R = R ./ R(maxlag+1) works only for autocorrelation 186 ## For cross correlation coeff, divide by rms(X)*rms(Y). 187 if !isvector(X) 188 ## for matrix (more than 1 column) X 189 rms = sqrt( sumsq(X) ); 190 R = R ./ ( ones(rows(R),1) * reshape(rms.'*rms,1,[]) ); 191 elseif isempty(Y) 192 ## for autocorrelation, R(zero-lag) is the mean square. 193 R = R / R(maxlag+1); 194 else 195 ## for vectors X and Y 196 R = R / sqrt( sumsq(X)*sumsq(Y) ); 197 endif --------------------------------------------- Please let me know if I am mistaken. Thanks Peter On Thu, Mar 26, 2009 at 04:50:16PM +0200, nit ar wrote: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
------------------------------------------------------------------------------
_______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
