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 289959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:57:15+00:00 2026-05-12T05:57:15+00:00

Consider a vector V riddled with noisy elements. What would be the fastest (or

  • 0

Consider a vector V riddled with noisy elements. What would be the fastest (or any) way to find a reasonable maximum element?

For e.g.,

V = [1 2 3 4 100 1000]
rmax = 4;

I was thinking of sorting the elements and finding the second differential {i.e. diff(diff(unique(V)))}.

EDIT: Sorry about the delay.

I can’t post any representative data since it contains 6.15e5 elements. But here’s a plot of the sorted elements.

sorted

By just looking at the plot, a piecewise linear function may work.

Anyway, regarding my previous conjecture about using differentials, here’s a plot of diff(sort(V));

diff vs x

I hope it’s clearer now.

EDIT: Just to be clear, the desired “maximum” value would be the value right before the step in the plot of the sorted elements.

  • 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-05-12T05:57:15+00:00Added an answer on May 12, 2026 at 5:57 am

    NEW ANSWER:

    Based on your plot of the sorted amplitudes, your diff(sort(V)) algorithm would probably work well. You would simply have to pick a threshold for what constitutes “too large” a difference between the sorted values. The first point in your diff(sort(V)) vector that exceeds that threshold is then used to get the threshold to use for V. For example:

    diffThreshold = 2e5;
    sortedVector = sort(V);
    index = find(diff(sortedVector) > diffThreshold,1,'first');
    signalThreshold = sortedVector(index);
    

    Another alternative, if you’re interested in toying with it, is to bin your data using HISTC. You would end up with groups of highly-populated bins at both low and high amplitudes, with sparsely-populated bins in between. It would then be a matter of deciding which bins you count as part of the low-amplitude group (such as the first group of bins that contain at least X counts). For example:

    binEdges = min(V):1e7:max(V);  % Create vector of bin edges
    n = histc(V,binEdges);         % Bin amplitude data
    binThreshold = 100;            % Pick threshold for number of elements in bin
    index = find(n < binThreshold,1,'first');  % Find first bin whose count is low
    signalThreshold = binEdges(index);
    

    OLD ANSWER (for posterity):

    Finding a “reasonable maximum element” is wholly dependent upon your definition of reasonable. There are many ways you could define a point as an outlier, such as simply picking a set of thresholds and ignoring everything outside of what you define as “reasonable”. Assuming your data has a normal-ish distribution, you could probably use a simple data-driven thresholding approach for removing outliers from a vector V using the functions MEAN and STD:

    nDevs = 2;    % The number of standard deviations to use as a threshold
    index = abs(V-mean(V)) <= nDevs*std(V);  % Index of "reasonable" values
    maxValue = max(V(index));              % Maximum of "reasonable" values
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 223k
  • Answers 224k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer From the MSDN page on TypeDescriptor.GetAttributes: In order to return… May 13, 2026 at 12:41 am
  • Editorial Team
    Editorial Team added an answer Finaly I found the solution. It seems that the cookies… May 13, 2026 at 12:41 am
  • Editorial Team
    Editorial Team added an answer Does it take even a minimal effort to read that… May 13, 2026 at 12:41 am

Related Questions

This is a follow-up to my question from yesterday . I have Scott Meyers'
How can I get the same handeling of casting for user-defined types as built
Consider the following code: typedef vector<int> intVec; intVec& operator<<(intVec& dst, const int i) {
Consider following example. #include <iostream> #include <algorithm> #include <vector> #include <boost/bind.hpp> void func(int e,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.