-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnon_linear_analysis.m
More file actions
executable file
·102 lines (71 loc) · 1.92 KB
/
non_linear_analysis.m
File metadata and controls
executable file
·102 lines (71 loc) · 1.92 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
% Project Timeseries 2017-2018
% Team 29
% Diamanti Maria 8133
% Ntzioni Dimitra 8209
%% a
data = VarName1;
%2-d diagram
m = 2;
tau = 100;
[xM2] = embeddelays(data, m, tau);
figure (1)
plotd2d3(xM2,'Data29v1 - 2d');
%3-d diagram
m = 3;
[xM3] = embeddelays(data, m, tau);
figure (2)
plotd2d3(xM3,'Data29v2 - 3d');
%% b
% Find ô from the autocorrelation diagram
n = length(data);
sdnoise = 10;
mux2= 20;
perseason = 12;
maxtau = 100;
alpha = 0.05;
zalpha = norminv(1-alpha/2);
acxM = autocorrelation(data, maxtau);
autlim = zalpha/sqrt(n);
figure(4)
clf
hold on
for ii=1:maxtau
plot(acxM(ii+1,1)*[1 1],[0 acxM(ii+1,2)],'b','linewidth',1.5)
end
plot([0 maxtau+1],[0 0],'k','linewidth',1.5)
plot([0 maxtau+1],autlim*[1 1],'--c','linewidth',1.5)
plot([0 maxtau+1],-autlim*[1 1],'--c','linewidth',1.5)
xlabel('\tau')
ylabel('r(\tau)')
title(sprintf('autocorrelation'))
%Diagram of the mutual Information
[mutM] = mutualinformation(data, tau);
[locextM,xV] = extremes(mutM(:,2),0,1,0,0,1);
chosen_t = locextM(1,1);
% Find m
mmax = 10;
[fnnM,mdistV,sddistsV] = falsenearest(data,chosen_t,mmax,10,0,'m');
chosen_m = 5; %% chosen from the diagram of the false nearest neighboors
%% c
% Diagrams to specify the value of m and to find the v(m)
[rcM,cM,rdM,dM,nuM] = correlationdimension(data,chosen_t,mmax);
%% d
% Prediction
chosen_t = 1; % the chosen value of ô
chosen_m = 5; % the chosen value of m
n1 = length(data)/2;
Tmax = 10;
q = 0;
start = length(data)/2;
stop = length(data)/2 + 9;
nrmseValue = [];
for i = 1:20
[preV] = localpredictmultistep(data,n1,chosen_t,chosen_m,Tmax,i,q);
nrmseV = nrmse(data(start:stop),preV);
nrmseValue = [nrmseValue, nrmseV];
end
nrmseValue
index = find(nrmseValue == min(nrmseValue))
[preV] = localpredictmultistep(data,n1,chosen_t,chosen_m,Tmax,index,q,'Prediction');
%
plot(nrmseValue);