From: Nikhil Divekar on
Hi
I am trying to cross-cohere large amounts of data. My Fs is 1000S/s but I am only interested in coherence values from 0-50Hz. Therefore I feed in the frequeny vector into mscohere instead of a single nfft value as follows.

freqs = linspace(0,50,251);
[Cxy,f] = mscohere(eeg(:,i),abs(emg(:,j)),[1000],[500],freqs,1000);

Unfortunately I find that this is extremely slow as compared to:

[Cxy,f] = mscohere(eeg(:,i),abs(emg(:,j)),[1000],[500],500,1000);

In both cases the function calculates coherence at the same number of frequencies i.e. 251 points. Why is it much slower in the first case and how can I speed it up??