tet = 90 /180 * 3.14159265; %peel angle
while (1)
F = F + df;
%FF() is the force vector. FF(1) is the horizontal component, FF(2) is the vertical component
FF(1) = F * cos(tet);
FF(2) = F * sin(tet);
%r(i,1:2) is position vector of i th node where 1 < i < n,
%R(i,1:2) is position vector of i th springs end attached to the ground
%l is the length of the first spring
l = (((r(1, 1)-R(1, 1))^2 + (r(1, 2)-R(1, 2))^2)^(0.5));
if (l > l_critical) %if the legnth is higher than l_critical the program ends
'The Adhesive Tape Has Been Removed';
break;
end
for i=1:iteration
%j is the number of the node that is going to be moved to equilibrium position
for j=1:n-1
%line below says: move the node, while its acceleration is higher than 10 ^ -6
while ((r__(1)^2 + r__(2)^2)^(0.5) > 10 ^ -6)
if (j == 1) %first node
%since the force is applied to first node, the first node is different from others.
%f_S(spring_constant, l_initial, r1, r2) is a function that inputs r1 and r2, the position of two ends of the spring,
%initial length and constant of the spring and outputs the force vector
%f is the total force applied to each node which is the sum of the forces from three springs (right + left + down)
f = FF + f_s(kl, dl, r(j, 1:2), r(j-1, 1:2)) + f_s(kh, t, r(j, 1:2), R(j, 1:2));
r__ = f; %acceleration
r_ = r_ + r__ * dt; %velocity
r(j, 1:2) = r(j, 1:2) + r_ * dt; %position
else
f = f_s(kl, dl, r(j, 1:2), r(j+1, 1:2)) + f_s(kl, dl, r(j, 1:2), r(j-1, 1:2)) + f_s(kh, t, r(j, 1:2), R(j, 1:2));
r__ = f;
r_ = r_ + r__ * dt;
%r(j, 1:2) is the position vector of j th node. j th node
%moves in the direction of the applied force until it reaches to the equilibrim position
%this is just a technique to find the equilibrium position of each node.
r(j, 1:2) = r(j, 1:2) + r_ * dt;
end
end
%at this point the j th node is in the equilibrium position, now it goes for the j + 1 th node
end
%at this point all the points are moved to their equilibrium position,
%but after moving j + 1 th node, the j th node will not be in equilibrium position any more
%by repeating the whole process again and again, the system converges and we reach to the ultimate equilibrim state of the system
%this is a numerical calculation technique! Iteration.
end
%at this point we have reached to the ultimate equilibrium state of the
%system, we increase the force and repeat the whole process again
end