Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9216633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:27:35+00:00 2026-06-18T02:27:35+00:00

I would like to find more than one maximum value from an array using

  • 0

I would like to find more than one maximum value from an array using Matlab.

Here is my code that returns only one max and its position:

[peak, pos] = max(abs(coeffs));

Problem is that I want to detect more than one max in the array. In fact, I would need to detect the first two peaks and their positions in the following array:

>> abs(coeffs())

ans =

    0.5442
    0.5465
    0.5545
    0.5674
    0.5862
    0.6115
    0.6438
    0.6836
    0.7333
    0.7941
    0.8689
    0.9608
    1.0751
    1.2188
    1.4027
    1.6441
    1.9701
    2.4299
    3.1178
    4.2428
    6.3792
   11.8611
   53.7537
   24.9119
   10.8982
    7.3470
    5.7768
    4.9340
    4.4489
    4.1772
    4.0564
    4.0622
    4.1949
    4.4801
    4.9825
    5.8496
    7.4614
   11.1087
   25.6071
   53.2831
   12.0029
    6.4743
    4.3096
    3.1648
    2.4631
    1.9918
    1.6558
    1.4054
    1.2129
    1.0608
    0.9379
    0.8371
    0.7532
    0.6827
    0.6224
    0.5702
    0.5255
    0.4861
    0.4517
    0.4212
    0.3941
    0.3698
    0.3481
    0.3282
    0.3105
    0.2946
    0.2796
    0.2665
    0.2541
    0.2429
    0.2326
    0.2230
    0.2141
    0.2057
    0.1986
    0.1914
    0.1848
    0.1787
    0.1729
    0.1677
    0.1627
    0.1579
    0.1537
    0.1494
    0.1456
    0.1420
    0.1385
    0.1353
    0.1323
    0.1293
    0.1267
    0.1239
    0.1216
    0.1192
    0.1172
    0.1151
    0.1132
    0.1113
    0.1096
    0.1080
    0.1064
    0.1048
    0.1038
    0.1024
    0.1011
    0.1000
    0.0987
    0.0978
    0.0967
    0.0961
    0.0951
    0.0943
    0.0936
    0.0930
    0.0924
    0.0917
    0.0913
    0.0908
    0.0902
    0.0899
    0.0894
    0.0892
    0.0889
    0.0888
    0.0885
    0.0883
    0.0882
    0.0883
    0.0882
    0.0883
    0.0882
    0.0883
    0.0885
    0.0888
    0.0889
    0.0892
    0.0894
    0.0899
    0.0902
    0.0908
    0.0913
    0.0917
    0.0924
    0.0930
    0.0936
    0.0943
    0.0951
    0.0961
    0.0967
    0.0978
    0.0987
    0.1000
    0.1011
    0.1024
    0.1038
    0.1048
    0.1064
    0.1080
    0.1096
    0.1113
    0.1132
    0.1151
    0.1172
    0.1192
    0.1216
    0.1239
    0.1267
    0.1293
    0.1323
    0.1353
    0.1385
    0.1420
    0.1456
    0.1494
    0.1537
    0.1579
    0.1627
    0.1677
    0.1729
    0.1787
    0.1848
    0.1914
    0.1986
    0.2057
    0.2141
    0.2230
    0.2326
    0.2429
    0.2541
    0.2665
    0.2796
    0.2946
    0.3105
    0.3282
    0.3481
    0.3698
    0.3941
    0.4212
    0.4517
    0.4861
    0.5255
    0.5702
    0.6224
    0.6827
    0.7532
    0.8371
    0.9379
    1.0608
    1.2129
    1.4054
    1.6558
    1.9918
    2.4631
    3.1648
    4.3096
    6.4743
   12.0029
   53.2831
   25.6071
   11.1087
    7.4614
    5.8496
    4.9825
    4.4801
    4.1949
    4.0622
    4.0564
    4.1772
    4.4489
    4.9340
    5.7768
    7.3470
   10.8982
   24.9119
   53.7537
   11.8611
    6.3792
    4.2428
    3.1178
    2.4299
    1.9701
    1.6441
    1.4027
    1.2188
    1.0751
    0.9608
    0.8689
    0.7941
    0.7333
    0.6836
    0.6438
    0.6115
    0.5862
    0.5674
    0.5545
    0.5465

The reason I need only the two first max values is that the two last ones are reflections of the two first ones as a result of a fast fourier transform.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:27:36+00:00Added an answer on June 18, 2026 at 2:27 am

    you can use many peak finding tools to do that. Here’s some of them:

    Findpeaks

    The function [pks,locs] = findpeaks(data) returns local maxima or peaks, pks, in the input data at locations locs (sorted from first to last found). Data requires a row or column vector with real-valued elements with a minimum length of three. findpeaks compares each element of data to its neighboring values. If an element of data is larger than both of its neighbors or equals Inf, the element is a local peak. If there are no local maxima, pks is an empty vector.

    For example:

    [pks,locs] = findpeaks(abs(coeffs))
    plot(abs(coeffs)); hold on
    plot(locs(1:2),pks(1:2),'ro'); 
    

    enter image description here

    1D Non-derivative Peak Finder – a FEX tool that finds peaks without taking first or second derivatives, rather it uses local slope features in a given data set.

    PeakFinder – another peak finder from the FEX by nate yoder.

    and there are plenty more of these in the FEX…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to find the index/indices that hold the maximum value in an
I would like to find a way to store multiple addresses for one subject
I would like to find an API like Apache Commons that will easily and
I would like to know how to programmatically find and the Y axis maximum
The problem I'm having is that there are more than one result in a
Hello I have a multi choice listview. I would like to add more than
I know this question has been asked, but I can't find more than one
I would like to test a process that queries across multiple schemas using PHPUnit's
Find the first n taxicab numbers. Given a value n . I would like
Is there a way I can find out if there are more than one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.