-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmax_hat.m
More file actions
60 lines (49 loc) · 870 Bytes
/
max_hat.m
File metadata and controls
60 lines (49 loc) · 870 Bytes
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
clc
close all
clear all
r1=input('enter radius of region of positive reinforcement : ')
r2=input('enter radius of region of inter connections : ')
c1=input('enter constant c1 : ')
c2=input('enter constant c2 : ')
n=input('enter the length of external signal : ')
for i=1:n
x(i)=input('enter neuron value : ');
end
x_old=x;
k=1;
s1=0;
s2=0;
s3=0;
ch=0;
while(ch==0)
while(k<=n)
s1=0;
s2=0;s3=0;
for i=-r1 : r1
if(k+i>0 && i+k<=n)
s1=s1+x_old(i+k);
end
end
for i=-r2:(-r1-1)
if(k+i>0 && i+k<=n)
s2=s2+x_old(i+k);
end
end
for i=(r1+1):r2
if(i+k>0 && i+k<=n)
s3=s3+x_old(i+k);
end
end
y(k)=(c1*s1 )+ (c2*s2)+(c2*s3);
if(y(k)<0)
y(k)=0;
end
k=k+1;
end
ch=input('press 0 to continue or 1 to stop');
if(ch==0)
x_old=y;
k=1;
end
end
y