cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Maxima and Minima

JohnRudnicki
14-Alexandrite

Maxima and Minima

I have a series of plots similar to the one below with multiple peaks and troughs. I want to get the values of the peaks and troughs and their x coordinate. The only way I can think to do it is to use max to find the value of the biggest peak, remove that section of data, find the next and so on. This is tedious and I have many to do. There must be a better way. Can someone show me what it is. Worksheet is attached. 

 

JohnRudnicki_0-1591814111040.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

HI,

 

If you do not have the data extension pack you can resolve the minimum and maximum.

 

Sheet is enclosed.

 

Regards

Terry

View solution in original post

10 REPLIES 10

mn.png

mx.png

Thanks for your reply, Valery. Probably my question was not clear. In addition to the value and position of the highest peak (and lowest trough), I want to get the maximum and minimum values of all the peaks and troughs (i.e., four of each in the example shown). 

The better way is to use the FindPeaks function in Maple or the findpeaks function in Matlab.

Nothing in Mathcad will help you do that easily.

Well, the slope changes sign at each max or min.  So if you calculate local slopes or derivatives you could step through and look for sign changes.  This wouldn't work well with noisy data, but if your data is well behaved you might get ok results.

 How about using Mathcads "localmax" function (from Data Analysis Extension Pack)?

Werner_E_3-1591841362898.png

 

 

 

 

JohnRudnicki
14-Alexandrite
(To:Werner_E)

Nice. Unfortunately, I do not have the Data Analysis Extension Pack.


@JohnRudnicki wrote:

Nice. Unfortunately, I do not have the Data Analysis Extension Pack.


As far as I know the DAEP is part of every Mathcad distribution since MC14, apart from some single user edu licences, where the pack and its help is also installed during installation but the license for it is missing. In Prime its integrated anyway. Did you give it a try?

But in case you are using an older version of MC (from the pic you posted it looked like MC14 or MC15 anyway) or have a version without a license for the DAEP, its not hard to recode those functions. You will find examples how to do here in the forum, as an example

https://community.ptc.com/t5/PTC-Mathcad/Improve-localmax-results/m-p/546078/highlight/true#M179863

or

https://community.ptc.com/t5/PTC-Mathcad/Gaussian-fit-to-several-peaks/m-p/147888/highlight/true#M58106

 

Some functions from this package:

 

Pic_1.png

HI,

 

If you do not have the data extension pack you can resolve the minimum and maximum.

 

Sheet is enclosed.

 

Regards

Terry

Clever. Thanks.

Top Tags