|
Min and max functions will only give you a global max/min, which will be subject to experimental errors and spikes.
plot your data as a time seires. Is it smooth (i.e. you can clearly see where your local minima should be), or is it a little spiky?
If spiky, I'd suggest filtering it (either low-pass filtering, which is probably easier, or check out Michael Kleder's tutorial on the Kalman Filter).
Next, type in search terms like 'minimise' 'local minima' and global minima... there are hundreds of pieces of code floating aroud, many on the File Exchange, which find local minima of functions. Root through them, you'll probably get a better idea of what you need as you go.
Other than that, I'd probably just quickly write a gradient-based minimiser (or there must be one somewhere on the FEx) and start it off at a number of different points along the line to get all the local minima.
Good luck!
"Pivo " <pivo_pijem.remove.this@hotmail.com> wrote in message <h5q4h7$pce$1@fred.mathworks.com>...
> Hey!
>
> For testing purposes I have been working with function f(x) = x^3 - 2*x^2 + 1 and successfully found the solution.
>
> But...
>
> Here is my problem.
> I am reading a data (temperature) from external device (through serial port). Reading interval is 500ms (0.5s). After 1000 samples, I need to find the local and global extremes of those data.
>
> I don't know how to start from here. I don't know what the function looks like.
> Since I know the points, I could do Lagrange interpolation (this is the only one I know from school), but I would rather ask for your opinion...
>
> I don't ask for solution, although I would appreciate it.
> I am only asking, what would be the right approach (links, keywords,...)
>
> Thanks
|