Hello,
My task is to write a script that will find the time when a parabolic function (height, a function of time) reaches its max.
clear allt=0;for time=0:0.5:30; if height(time)>=height(time-0.5) t=t+0.5; endenddisp(t)
height(time-0.5) wouldn't execute so here is my second code
clear allt=0;for time=0:0.5:30; e=0.5:0.5:29; time2=[0 e]; while height(time)>height(time2) t=t+0.5; endenddisp(t)
this code does not work either. How can i utilize max( ) function in here? And what is the best way to do this kind of loop?
Thanks!
Best Answer