MATLAB: How to find first two largest peaks with sample location two peaks Please let me know, how to find its two highest peaks along with its samples information too. Best Answer d = rand(100,1); % assumed data[vals,loc] = maxk(d,2); % first two peaks(mnaximum values) sample values and locationsplot(d); hold on; % plot original samplesplot(loc,vals,'rv', 'MarkerFaceColor', 'r'); % plot peak values Related SolutionsMATLAB: Correlation between two row matrices Like that, each value of "a" is correlated to each value of "b", but applying the formula of the correlation, the correlation of two single numbers is NaN. To compute the correlation correctly, traspose the input vectorsresult = corr(a', b'); MATLAB: How can a draw a line between two points Assuming that x, average, and average_2 are all row vectorsaxes;hold on;plot(x, average,'o', 'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'b'); % Blue pointsplot(x, average_2,'o', 'MarkerEdgeColor', 'r', 'MarkerFaceColor', 'r'); % Red pointsplot([x;x], [average; average_2], '-k');If the data are column vectors you'll have to transpose the arrays. Related QuestionDoes a cell vector contains only NaNSubtract two matrices each with NaN values in different cellsCombining multiple plot statements.
Best Answer