Skip to main content
4-Participant
May 23, 2024
Question

finding centroids of peaks in a 2D array

  • May 23, 2024
  • 2 replies
  • 1634 views

I have 2D arrays with multiple peaks in the array.  I need to extract the centroids of each peak.  I have MCAD14 with all the extensions but am not seeing any function that will help with that, but trying to avoid writing the whole matrix search algorithm myself.

 

I'd like the array positions of the centroids of the peaks shown in this plot as the red peaks.

ptc1398121_0-1716430536441.png

Any ideas that make this simple?

Thanks.

 

2 replies

ttokoro
21-Topaz I
21-Topaz I
May 23, 2024

Even Prime can do it by localmax function, real mathcad can do it.

image.pngimage.pngimage.pngimage.png

t.t.
4-Participant
May 25, 2024

That's a very good recommendation.  Unfortunately my data has a large maximum uniform value 'table' so localmax doesn't seem to be able to deal with that.  I could back off the gain on my data so the peaks are not saturated values, but then the shape of my data is more like the cone of a volcano with a central depression.  I may just have to write an algorithm myself for this.

Community Moderator
May 30, 2024

Hello @ptc-1398121

 

It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution. Or if you found a solution by yourselves, please document it in your topic and mark it as accepted solution. This should surely help other users who may have a similar question.

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.