How to get number of peaks and locs from different graphs that are plotted using a single for loop?

3 views (last 30 days)
for k=1:length(x)
grid on;
ylim([0 2]);
This code giving me different plots. For each of the plot I am getting different peaks. How can individually calculate no of peaks and locs for each of the plot?

Answers (1)

KSSV on 16 Jul 2018
Have a look on functions max and findpeaks.
Zara Khan
Zara Khan on 16 Jul 2018
Error using findpeaks Expected Y to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was logical.
Error in findpeaks>parse_inputs (line 189) validateattributes(Yin,{'numeric'},{'nonempty','real','vector'},...
Error in findpeaks (line 131) [y,yIsRow,x,xIsRow,minH,minP,minW,maxW,minD,minT,maxN,sortDir,annotate,refW] ...
Error in ci_1 (line 33) [pks,locs] = findpeaks(profile);
This is the error I am getting . converting profile to double before using findpeaks still getting the same error

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!