How to fasten up MATLAB function 'mscohere' -


is there hack how fasten matlab funcion mscohere? i'm computing coherence between each 2 of 26 large vectors. takes lots of time.

i'm using piece of code every pair of vectors.

coherencematrix{i,j} = mscohere(double(data.ch(indexes(i)).data),double(data.ch(indexes(j)).data),window,noverlap) ; 

i don't know hack improve mscohere, if need multiple calls mscohere, parallel computing toolbox speed process. following code runs 2.5x faster (4.7 s vs 11.8s) when use 4 workers parfor vs regular for loop:

rng default r = randn(16384,26); h = fir1(30,0.2,rectwin(31)); h1 = ones(1,10)/sqrt(10); tic cxy_outer=cell(size(r,2),1); parfor =1:size(r,2)     cxy_inner=cell(size(r,2),1);     j= 1:size(r,2)         if i<j             x=filter(h1,1,r(:,i));             y=filter(h,1,filter(h1,1,r(:,j)));             cxy_inner{j}=mscohere(x,y,hanning(1024),512,1024);         end     end     cxy_outer{i}=cxy_inner; end toc 

edit: save output results, parfor has rules on how variable can sliced- hence "cell array of cell arrays"


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -