Find peak and plot graph from peak

 采纳的回答

I am not certain what you want to do.
If you want to get the peaks and their indices, request those outputs:
[pks,locs] = findpeaks(pure_brain(:,2)); % Get Peaks (‘pks’) and Peak Indices (‘locs’)
I have no idea what is in your data file, however if you want to plot them and indicate them, try this:
x = 1:size(pure_brain,1);
figure
plot(x, pure_brain(:,2))
hold on
plot(x(locs), pure_brain(locs,2), '^r')
hold off
grid
.

5 个评论

I want to have a dot at peak and hide graph how can I do it ?
Try this:
figure
plot(x(locs), pure_brain(locs,2), '.r')
grid
That will plot a red dot at the top of each peak findpeaks returns, and will not plot the line plot of the original data (that were plotted in the code I originally posted).
Its run nothing or waht should I write before this code
Oh I got it Thx u so much
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with Signal Processing Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by