-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAcalculate3.m
73 lines (73 loc) · 2.33 KB
/
Acalculate3.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
function [place,placeAdd]=calculate3(place,N,l1,l2,seq)
s=1;
for i=1:N,
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if seq==1
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
if s
placeAdd=place;
s=0;
end
placeAdd(i)=place(i);
place(i)=2*l1-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)>=(l1+l2)
place(i)=2*(l1+l2)-place(i);
end
end
end
if placeAdd(i)<=0
placeAdd(i)=-placeAdd(i);
end
end
end
end
elseif seq==2
if place(i)<0
place(i)=-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)<l1
place(i)=2*l1-place(i);
end
end
end
end
end
end
elseif seq==3
if place(i)<0
place(i)=-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)>=(l1+l2)
place(i)=(l1+l2)-(place(i)-l1-l2);
if place(i)<l1
place(i)=2*l1-place(i);
if place(i)<l1
place(i)=2*l1-place(i);
end
end
end
end
end
end
end
end
end