0
Find maximums and minimums of an approximation of a funtion given by a serie of points

If you have an approximation of a function given by a serie of points on a vector, how to find it's maximums and minimums?

Maximums and minimums can be found with the roots of the derivative of the function. This could be done with the diff(y) function. Is there an easy way to get the indexes of the zeroes of diff(y)? And interpolated indexes?

Thanks for your help.


Scilab 28-06-21, 12:07 p.m. patufet99
0

What I have found so far is this:

diff(y) // approximative derivative of y
diff(y)<0 // negative y'=T, positive y'=F
diff(diff(y)<0) // sign change of y' =1 or -1, otherwise 0
find(diff(diff(y)<0)) //return indexes of sign change of y'

The indexes are not interpolated with that solution. Diff making the difference of contiguous values, the size of the vector is decreased by one. As this function is applied twice, the index position may be wrong by up to a couple of indexes I guess.

28-06-21, 11:38 p.m. patufet99


0
I am of the same opinion that this process was repeated twice resulting in the halving. diff(y) // approximative derivative of y
diff(y)<0 // negative y'=T, positive y'=F
diff(diff(y)<0) // sign change of y' =1 or -1, otherwise 0
find(diff(diff(y)<0)) //return indexes of sign change of y' <mapquest driving directions>
01-07-21, 3:04 p.m. alucca


Log-in to answer to this question.