How to establish the maximum value between sample points?

Started by
9 comments, last by 51mon 14 years, 11 months ago
Hi I read values from an input device. Values following a kind of wave pattern but it's impossible to establish a function of the pattern. The frequency which the values are red is a little low for my purpose. What method can I use to estimate the maximum value between two sample points? I would be very pleased for good answers, thanks :)
Advertisement
When you say value, what do you mean? Frequency? Magnitude? Phase difference?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Quote:Original post by MikeTacular
When you say value, what do you mean? Frequency? Magnitude? Phase difference?


Ohh, sorry. I mean sample values. Like singular points on a graph. How to find the maximum value between them? If I read value x0 at time t0 and value x1 at t1. Now I want to estimate the maximum value between t0 and t1. Usually it's either one of the end points except from when the curve reach a critical point.
you mean run a curve through control points and find the maximum of the curve?

It all depends and what sort of curve you want to run through the control points , but in general, you have an equation for the curve, and finding the maximum or minimum is no different than for any other equation. You can find the local extremums (take the derivative of your parametric equation, and solve f'(t)=0), and find the global maxima of those.

Everything is better with Metal.

Quote:Original post by oliii
you mean run a curve through control points and find the maximum of the curve?

It all depends and what sort of curve you want to run through the control points , but in general, you have an equation for the curve, and finding the maximum or minimum is no different than for any other equation. You can find the local extremums (take the derivative of your parametric equation, and solve f'(t)=0), and find the global maxima of those.


Well in this case the equation does not exist so I can't do that.
If they are two discrete points like that with no known relationship, you're pretty much screwed. You can't find the maximum value (and probably can't even estimate it either) with that little of information.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Quote:Original post by MikeTacular
If they are two discrete points like that with no known relationship, you're pretty much screwed. You can't find the maximum value (and probably can't even estimate it either) with that little of information.


But if I got a whole bunch of points in the past. Some kind of signal processing or similiar?
If you are sampling below the nyquist rate, and you can't make certain assumptions about your signal, then you will lose information. You state that you will sample "Values following a kind of wave pattern but it's impossible to establish a function of the pattern." Could you elaborate on this a bit more? If you sample x_i and x_(i+1) at t_i and t_(i+1) respectively, and x_i = x_(i+1), what assumptions can you safely make about the intermediate signal. Is it possible that no input has been received? If the signal is wavelike, is it possible that one "oscillation" of the wave has occurred and that is why you've sampled the same value twice? If you can't even delineate between these types of cases, you don't have a sufficiently strong prior on the signal and have no hope of estimating how it varies between samples.
I think gfxnomad nailed it. The best you can do is assume that your signal has no components above the Nyquist frequency and use the Whittaker-Shannon interpolation formula to describe the function in full. Now you can find the extremes by finding the zeros of the derivative.

Quote:Original post by 51mon
Quote:Original post by MikeTacular
If they are two discrete points like that with no known relationship, you're pretty much screwed. You can't find the maximum value (and probably can't even estimate it either) with that little of information.


But if I got a whole bunch of points in the past. Some kind of signal processing or similiar?


That's what I mean. You need to fit a curve around your point, and given the curve (most likely a simple polynomial), you can take the derivative of that curve equation and work out local extremums.

You probably do not need to go to such extremes as statistical analysis, I'd use for example a Catmul-Rom spline, and work from there. It's sort of giving you the points in between the samples that fits a curve-like motion if you will, basically a non-linear interpolation.

To make it simpler, given the parametric equation, you can then work out intermediate points, and given a sub-sampling interval, you can make up intermediate points, and take the max. That will give you a good approximation of the actual extremums, the accuracy depends on the sub-sampling interval you choose.

but for that, you'll need at least a few points to deduce the local curvatures (catmull-rom needs at least four sample points), aka the 'wave like' motion. It's what's used for example in network games to interpolate smoothly the position of players (this is a 3D case, you only need a 2D case).

Note that fitting a curve around a set of points can give you spikes if your samples are for example too close together.

In short, it's some form of interpolation.

Everything is better with Metal.

This topic is closed to new replies.

Advertisement