Finding Maximum Peaks in a Program Plot

Click For Summary

Discussion Overview

The discussion revolves around the challenge of identifying maximum peaks in a plotted graph of time versus current. Participants explore various methods to detect these peaks, considering the complexities introduced by the data's characteristics and fluctuations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant seeks assistance in finding maximum peaks after applying a threshold to their current data.
  • Another participant suggests sorting the values of current to aid in peak identification.
  • A participant expresses the need to identify maximum values for multiple peaks and seeks advice on plotting only these maximum values.
  • One suggestion involves tracking maximum current values while traversing the voltage data and declaring peaks based on current dropping below a certain threshold.
  • Another participant raises concerns about setting a threshold due to large fluctuations between peaks and proposes calculating average current values for transitions instead.
  • A technical issue is noted regarding the inability to find corresponding values in the original time array when using stored transition data, leading to a matrix dimension error.
  • One participant questions the visibility of peaks below a certain threshold in the provided scatter plot and suggests storing all relevant information during transition detection.

Areas of Agreement / Disagreement

Participants express differing views on how to define and detect peaks, with no consensus on a single method or threshold. The discussion remains unresolved as various approaches are proposed and debated.

Contextual Notes

Participants note the ill-defined nature of peaks and the challenges posed by fluctuations in the data, which complicate the identification process. There are unresolved issues related to the mathematical steps required to correlate transition data with the original time array.

Who May Find This Useful

Individuals interested in data analysis, peak detection in experimental data, or those working with time-series plots in physics or engineering contexts may find this discussion relevant.

rai_88
Messages
4
Reaction score
0
Hi there. I am having some problems trying to find maximum peaks in my program. I plotted out my time vs. current graph. I need to find the maximum peaks. So i started off by setting a threshold of 0.05. After finding values which has a threshold of above 0.05, i plotted them.

>>ind=current>0.05;
>>ttime=time(ind);
>>tcurrent=current(ind);
>>plot(ttime,tcurrent,'.');axis([6 6.025 0.05 0.3]);

Now how can i find the all the maximum peaks? Could anyone help me out here? I really appreciate your help. Thank you.
 
Physics news on Phys.org
Can you sort the values on tcurrent?
 
Thank you for your reply. Sort the values? But i have multiple peaks. Attached is the figure for my current vs. voltage plot. So for every peak, i need to find the maximum value. After finding all the maximum values for every peak, i need to plot just the maximum values. Any advice?
 

Attachments

  • currentVsvoltage.jpg
    currentVsvoltage.jpg
    15.8 KB · Views: 409
Ah. I see the problem. The peaks are somewhat ill-defined, so there may be some curve fitting involved, and they're not exactly evenly spaced, so it's a bit nasty.

You could "walk" though the voltage values and keep track of maximum current value. Each time the current value drops below 0.2 you declare the last maximum a "peak", and start looking for another peak when the values begin to exceed 0.2 again. This will find the peaks, if somewhat crudely. Someone with a lot of time on there hands might engineer a curve fit for the neighborhood of each peak.
 
Well, that is a good suggestion. But i just went through all the peaks. Some of the peaks are below 0.2. So it is hard to set a threshold because the fluctuation is large between the peaks. I was wondering, what if for every transition that happens, i find the start and end of the transition. Then i compute the average current and just use that as the max peak. So to say, since i can't find the max peak, i just find the average peak. Currently, i manage to find the start and end time for every transition. I stored the values into array 'data'. But how can i use the value in data to find back the time in the original array 'time' so i can find the corresponding current value? It gives me the following error:

>> find(time==data(:,1));
? Error using ==> eq
Matrix dimensions must agree.

I cannot find the values when the number of elements for both matrixes is not the same?
 
Hmm. Looking at your scatter plot I didn't notice any peaks below 0.2.

What prevents you from pulling out and storing all the information (voltage, current, time) as you find the transitions?
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 22 ·
Replies
22
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K