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: