-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_z_train.m
56 lines (38 loc) · 1.49 KB
/
create_z_train.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
function [z_train, output_single] = create_z_train(input_subj, train_inds, ...
EXOG, Nfeats)
%CREATE_Z_TRAIN Summary of this function goes here
% Detailed explanation goes here
exog_now = EXOG{1};
input_train_now = exog_now{train_inds(1)}';
for feat_ind = 2 : Nfeats
exog_now = EXOG{feat_ind};
input_train_now = [input_train_now exog_now{train_inds(1)}'];
end
output_train_now = input_subj{train_inds(1)}';
z_now = iddata(output_train_now, input_train_now);
output_single = input_subj{train_inds(1)}';
if length(train_inds) > 1
input_train_now = [];
exog_now = EXOG{1};
input_train_now = exog_now{train_inds(2)}';
for feat_ind = 2 : Nfeats
exog_now = EXOG{feat_ind};
input_train_now = [input_train_now exog_now{train_inds(2)}'];
end
output_train_now = input_subj{train_inds(2)}';
z_now2 = iddata(output_train_now, input_train_now);
z_train = merge(z_now, z_now2);
for kk = 3 : length(train_inds)
exog_now = EXOG{1};
input_train_now = exog_now{train_inds(kk)}';
for feat_ind = 2 : Nfeats
exog_now = EXOG{feat_ind};
input_train_now = [input_train_now exog_now{train_inds(kk)}'];
end
output_train_now = input_subj{train_inds(kk)}';
z_now = iddata(output_train_now, input_train_now);
z_train = merge(z_train, z_now);
end
else
z_train = z_now;
end