Answer:
function n = mydetecttop(f, a, t)
n = a;
value1 = f(n);
i1 = 4;
while(true)
n = a + i1*t;
value2 = f(n);
if(value2 < value1)
break
end
value1 = value2;
i1 = i1 + 4;
end
end
function t = atc(n)
if(n<25)
t = n + 1;
else
t = 0 - n;
end
end
f = @atc;
n = mydetecttop(f, 1, 2)
Explanation: