Revisiting an issue which has already been discussed previously - in order to check whether mlab.csd really does exactly what Matlab’s cpsd is doing, we wrote a couple of scripts, one in matlab and one in Python. They both run on the attached data. The comparison of the results show that they are very similar. However - two elements are off by a factor of approximately 2 - the very first element and the very last. The last one may be off just because it is very small, the difference between the two is tiny. But for the first one - this is not the case - there is actually a difference in the values. This is not only due to the fact that the DC component is very small, because even if I add a DC component to the time-series, there is still discrepancy of a factor of ~2 for that element. Does anyone have any idea why this would be the case?
tseries12.txt (9.38 KB)
compare_csd.m (367 Bytes)
compare_csd.py (345 Bytes)
Helen Wills Neuroscience Institute
University of California, Berkeley