 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%% Calculate Coherence %%%%%%%%%%%%%%%%%%%%%%%</span>
0053 midway = floor(Nx/2)+1;
0054 Xf = fft(E .* repmat(X,P,1),[],2);      Xf = Xf(:,1:midway);     Pxx = conj(Xf).*Xf;    
0055 Yf = fft(E .* repmat(Y,P,1),[],2);      Yf = Yf(:,1:midway);     Pyy = conj(Yf).*Yf;
0056 Cxy = (conj(Xf) .* Yf) ./ sqrt((Pxx.*Pyy));
0057 Cxy = mean(Cxy,1);
0058 
0059 
0060 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plot if Needed %%%%%%%%%%%%%%%%%%%%%%%%%%</span>
0061 F =