I am trying to make my life easier- I have something like 380 sets of data that I really don't want to find the peaks of by hand, so I am trying to write a bit of code to automate this process. Here is what I have so far:
C3ax= [List of x values, a 1X1600 double vector]
C3ay= [Corresponding list of y values, a 1X1600 double vector]
%(I have about 84 of these vector pairs, from (C3ax, C3ay) to (G12ax,G12ay))
%I am searching for peaks only in a certain range, thus the (1:200) %I realize that if I change the starting location from "1" in the above line, I also have to add that value to loc in the second line
So this returns values of ans =
Which is correct, and sort of what I want (specifically only the 51.5625 value). So here are my questions:
1) Is there a way to tell the find peaks function that I only want the highest peak? I would specifically like it to return only the 51.5625,2.5302 pair, but I don't know the values I would be looking for until I find them (i.e, I can't set the max height to look for because I don't know what it is a priori).
2)I would like to be able to run this in a loop so that it does C3a through C12a, then D3a through D12a, etc, but I am not great at doing loops with string terms- ideally I could do for n=1:12 and have the names be C'n'a, but I don't know how to write that so that Matlab understands. Any advice? I tried this:
But that just returned a number for YVal and XVal instead of bringing in the entire vector.
Eventually I would like to have all of the XVal terms averaged for each letter trial, but I don't think I am far enough along to get into that yet. Thanks for the help!!!