The Neurophysiological Biomarker Toolbox (NBT)



3. Influence of the size of the segmenting window

figure
col= {'r','m','b','k', 'g','y'};
n = 0.5; %level of noise
i = 1;
hold on
for j = 1:6
    s1 = A1*sin(2*pi*t*f1)+A2*sin(2*pi*t*f2)+n*randn(size(t)); % signal 1 + noise
    s2 = A1*sin(2*pi*t*f1/2)+A2*sin(2*pi*t*f2)+n*randn(size(t)); % signal 2 + noise
    %--- window function
    W_length = 2^j;
    W = hamming(W_length);
    %--- extract frequency vector f from coherence function
    [C,f]=mscohere(s1,s2,W,[],W_length,fs);

    subplot(1,2,1)
    plot(t,s1,'b')
    hold on
    axis tight
    plot(t,s2,'r')
    xlabel('time sec')
    subplot(1,2,2)
    hold on
    plot(f,C,col{i})
    text(f(end),C(end), num2str(W_length),'Color', col{i})
    ylabel('MSC')
    xlabel('frequency')
    axis tight
    ylim([0 1])
    pause(0.5)
    i = i+1;
end
tutorial/coherence/cohercode3.txt · Last modified: 2012/01/09 15:26 by Giusi Schiavone
The NBTwiki platform - version 2.8 - 9 May 2013
Copyright (C) 2008-2015