-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathTest_Simulation_TVHP.m
59 lines (50 loc) · 1.38 KB
/
Test_Simulation_TVHP.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Simulation Time-varying Hawkes Process
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
% time interval
T = 50;
% dimension
U = 2;
% intrinsic intensity
mu = [0.3;0.2];%rand(U,1)./U;
% parameter of decay function
w = 0.2;
% parameters for generating A(t)
Period = 0.3*[3,6;9,12];%2*rand(U)+1;
Shift = 0;%2*Period.^2;%.*rand(U);
Type = 2;
A = zeros(U,U,T,Type);
% the number of sequences
N = 2000;
Seqs = cell(Type,1);
for type = 1:Type%:-1:1
if type == Type
MaxInfect = 0.8/(U^2);
else
MaxInfect = 0.5/(U^2);
end
for t=1:T
A(:,:,t,type) = Infectivity_TVHP(T, t, Period, Shift, MaxInfect, type);
end
figure
for u=1:U
for v = 1:U
subplot(U,U,U*(u-1)+v)
tmp=A(u,v,:,type);
plot(1:T, tmp(:), 'r-');
title(sprintf('a_{%d%d}(t)',u,v));
end
end
Seqs{type} = Simulation_TVHP( N, T, mu, w, Period, Shift, MaxInfect, type );
%ShowTMHP(Seq{1,type}, mu, T, w, Period, Shift, MaxInfect, type)
end
MaxInfect = 0.8/(U^2);
save('SynData_TVHP.mat','Seqs','Period','Shift','mu','w','T','MaxInfect','Type');
%%
% show the intensity function for an event sequence
load SynData_TVHP.mat
type = 2;
Show_Intensity_TVHP(Seqs{type}(1), mu, T, w, Period, Shift, MaxInfect, type)