Finding Maximum Peaks in a Program Plot

In summary: I could store the information, but it would be a lot of data. And it would be hard to keep track of which peak corresponds to which transition.
  • #1
rai_88
4
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
  • #2
Can you sort the values on tcurrent?
 
  • #3
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: 347
  • #4
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.
 
  • #5
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?
 
  • #6
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?
 

1. What is the purpose of finding maximum peaks in a program plot?

The purpose of finding maximum peaks in a program plot is to identify the highest points or values in the plot, which can provide important insights into the performance and behavior of the program. This information can help in optimizing and improving the program.

2. How do you identify maximum peaks in a program plot?

To identify maximum peaks in a program plot, you can use various techniques such as visual inspection, mathematical algorithms, or software tools. Visual inspection involves looking at the plot and identifying the highest points. Mathematical algorithms, such as finding the first or second derivatives of the plot, can also be used. Software tools, such as MATLAB or Python libraries, can also be used to identify maximum peaks.

3. Can maximum peaks in a program plot vary based on different parameters?

Yes, maximum peaks in a program plot can vary based on different parameters. For example, the maximum peaks may change if the program is run on different hardware or with different input values. This is why it is important to analyze the program plot with different parameters to get a comprehensive understanding of its behavior.

4. What is the significance of the location of maximum peaks in a program plot?

The location of maximum peaks in a program plot can provide valuable information about the performance of the program. For example, if the maximum peaks are clustered in a certain region, it may indicate that there is a bottleneck or issue in that area of the program. This can help in identifying areas for improvement and optimization.

5. Can the maximum peaks in a program plot be used to compare different versions of the same program?

Yes, maximum peaks in a program plot can be used to compare different versions of the same program. By analyzing the maximum peaks in each version, you can determine if there have been any improvements or changes in the performance of the program. This can be useful in evaluating the effectiveness of updates or modifications made to the program.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
995
  • Engineering and Comp Sci Homework Help
Replies
1
Views
985
  • Engineering and Comp Sci Homework Help
Replies
22
Views
2K
Replies
13
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
Replies
32
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
820
Back
Top