forked from vmve/ASWC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigure5R1.m
60 lines (50 loc) · 1.33 KB
/
Figure5R1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% An average sliding window correlation method for dynamic functional
% connectivity.
% Vergara VM, Abrol A, Calhoun VD
%
% Hum Brain Mapp. 2019 Jan 19. doi: 10.1002/hbm.24509
%
%
% Average Sliding Window Correlation (ASWC)
% Figure 5
%
% This code plots the frequency responses of SWC and ASWC methods.
%
% Victor M. Vergara, PhD
% Created on 2018-July-15
%
clear;close all;clc;
TR = 1;
N = 1000;
f = 0:1/N:0.05;
FZ = 18;
hswc = 100 ; % in sec
haswc= 44; % in sec
gaswc= 50; % in sec
FH = figure('rend','painters','pos',[128 128 900 300]);
subplot(1,2,1);
x = pi*TR*f;
y = (1/hswc)*abs(sin(x*hswc)./sin(x));
plot(f,y,'LineWidth',2);
title('SWC Frequency Response','FontSize',FZ);
xlabel('Frequency Hz','FontSize',FZ);
legend('H_h: h_{SWC} = 100 sec');
set(gca,'FontSize',14);
axis([0 0.05 0 1]);
grid on;
subplot(1,2,2);
x = pi*TR*f;
y1 = (1/haswc)*abs(sin(x*haswc)./sin(x));
y2 = (1/gaswc)*abs(sin(x*gaswc)./sin(x));
y = y1.*y2;
plot(f,y1,'.',f,y2,'--',f,y,'LineWidth',2)
title('ASWC Frequency Response','FontSize',FZ);
xlabel('Frequency Hz','FontSize',FZ);
legend('H_h: h_{ASWC} = 44 sec',['H_g: g_{ASWC} = ', ...
num2str(gaswc),' sec'],'ASWC: H_h H_g');
set(gca,'FontSize',14);
axis([0 0.05 0 1]);
grid on;
%% Save the figure
saveas(FH,'Figure5R1','png');
saveas(FH,'Figure5R1','fig');