-
Notifications
You must be signed in to change notification settings - Fork 7
/
trnasferFun.m
92 lines (85 loc) · 1.87 KB
/
trnasferFun.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
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
function [posOut]=trnasferFun(pos,temp,ID)
if ID==1
s=1/(1+exp(-2*temp)); %S1 transfer function
end
if ID==2
s=1/(1+exp(-temp)); %S2 transfer function
end
if ID==3
s=1/(1+exp(-temp/2)); %S3 transfer function
end
if ID==4
s=1/(1+exp(-temp/3)); %S4 transfer function
end
% if ID==5
% s=abs(erf(((sqrt(pi)/2)*temp))); %V1 transfer function
% end
% if ID==6
% s=abs(tanh(temp)); %V2 transfer function
% end
% if ID==7
% s=abs(temp/sqrt((1+temp^2))); %V3 transfer function
% end
% if ID==8 % we use this one 8
% s=abs((2/pi)*atan((pi/2)*temp)); %V4 transfer function
% end
%
% if ID<=4 %S-shaped transfer functions
% if rand<s % Equation (4) and (8)
% posOut=1;
% else
% posOut=0;
% end
% end
% if ID>4 && ID<=8 %V-shaped transfer functions
% if rand<s %Equation (10)
% posOut=~pos;
% else
% posOut=pos;
% end
% end
if ID==5
if (temp<=0)
s=1-(2/(1+exp(-2*temp))); %V1 transfer function
else
s=(2/(1+exp(-2*temp)))-1;
end
end
if ID==6
if (temp<=0)
s=1-(2/(1+exp(-temp))); %V1 transfer function
else
s=(2/(1+exp(-temp)))-1;
end
end
if ID==7
if (temp<=0)
s=1-(2/(1+exp(-temp/2))); %V1 transfer function
else
s=(2/(1+exp(-temp/2)))-1;
end
end
if ID==8
if (temp<=0)
s=1-(2/(1+exp(-temp/3))); %V1 transfer function
else
s=(2/(1+exp(-temp/3)))-1;
end
end
if ID<=4 %S-shaped transfer functions
if rand<s % Equation (4) and (8)
posOut=1;
else
posOut=0;
end
end
if ID>4 && ID<=8 %V-shaped transfer functions
if rand<=s && temp <= 0% Equation (4) and (8)
posOut=0;
elseif rand<=s && temp > 0% Equation (4) and (8)
posOut=1;
else
posOut=pos;
end
end
end