使用MATLAB查找图中最大峰的位置 [英] Finding the location of maximum peaks in a plot with MATLAB

查看:501
本文介绍了使用MATLAB查找图中最大峰的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这样的F矩阵:

Suppose I have the F matrix like this:

F =
0, 0, 106, 10, 14, 20, 20, 23, 27, 26, 28, 28, 28, 23
       |                        |           |
     peak                     peak         peak 

我正在使用命令plot(F).我想获取数据中峰的索引.

I'm using the command plot(F). I want to get the indexes of the peaks in the data.

这是我到目前为止的代码,它不起作用:

This is the code I have so far, it does not work:

[max_x,index_x]=max(x);
e=index_x;
for i=1:11
    index_x(i)=e;
    e=e+16;
end

matlab中是否有内置函数可以帮我做到这一点?

Is there a builtin function in matlab that will do this for me?

推荐答案

使用 findpeaks 函数(信号处理工具箱).

Use the findpeaks function (Signal Processing Toolbox).

[peakVal,peakLoc]= findpeaks(x);

这篇关于使用MATLAB查找图中最大峰的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆