Local max/min of Mathematica data sets.

In summary, the conversation discusses ways to find the local maxima and expected zeros of a set of points in Mathematica. The suggested methods involve using peakQ and crossQ functions to identify peaks and zeros, along with the use of Partition and Map functions. The speaker also recommends testing the methods on sample data and understanding how they work for future use.
  • #1
wil3
179
1
Is there a way in Mathematica to find the local maxima of a set of points? I have a fairly fine data set, and I can clearly see several peaks in it that I would like to know the numerical value of (as in, the highest point- I don't need a spline approximation or anything too fancy like that). I have already smoothed the set, so I'd rather not fit polynomials if possible.

Additionally, is there a way to find the expected zeros of a set? Let's say that I have two points in order, and somewhere between them the measured response value drops to negative. I know I can find this manually, but there are enough zeroes that I would prefer not to. I am not too picky regarding whether the guessed zero is based on a linear connection between the two points or some sort of exotic polynomial or spline.

Thanks very much.
 
Physics news on Phys.org
  • #2
Suppose you have
points={{xa,ya},{xb,yb},{xc,yc}...}

peakQ[{{x1_,y1_},{x2_,y2_},{x3_,y3_}}]:=Abs[y1]<Abs[y2]&&Abs[y2]>Abs[y3];
peaks=Map[#[[2]]&,Select[Partition[points,3,1],peakQ[#]&]]

Then

crossQ[{{x1_,y1_},{x2_,y2_}}]:=Sign[y1]!=Sign[y2];
zero[{{x1_,y1_},{x2_,y2_}}]:=x1+(x2-x1)*Abs[y1]/Abs[y2+y1];
zeros=Map[zero[#]&,Select[Partition[points,2,1],crossQ[#]&]]

Test these carefully on sample data to make certain I haven't made any mistakes.

Then study how and why these work so that you can use these methods yourself in the future.
 
  • #3
Sorry about the delay in replying. That worked perfectly, like your suggestions always do. Thanks very much for your help.
 

Related to Local max/min of Mathematica data sets.

1. What is a local max/min in a Mathematica data set?

A local max/min in a Mathematica data set is a data point that is the highest/lowest value in a small range of neighboring data points. It is not necessarily the overall highest/lowest value in the entire data set.

2. How can I find the local max/min in a Mathematica data set?

You can use the built-in functions "Max" and "Min" in Mathematica to find the overall highest and lowest values in a data set. To find the local max/min, you can use the function "FindPeaks" or "FindExtrema" which will return a list of local max/min points and their corresponding values.

3. Can there be more than one local max/min in a Mathematica data set?

Yes, there can be multiple local max/min points in a data set. This is because a data set can have multiple peaks and valleys, each of which can have its own local max/min point.

4. How do I determine the significance of a local max/min in a Mathematica data set?

The significance of a local max/min in a data set can be determined by looking at the size of the range of neighboring data points. If the range is small, then the local max/min may not have much significance. However, if the range is large and the local max/min is significantly higher/lower than the surrounding data points, then it may have more significance.

5. Can I use the local max/min points to make predictions about the data set?

Local max/min points can give insights into the trends and patterns of a data set, but they should not be solely relied upon for making predictions. Other factors, such as the overall shape of the data set and the size of the data range, should also be taken into consideration.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
3K
Replies
4
Views
2K
Back
Top