如何使findpeak函数检测负峰而不是正峰 [英] How to make findpeak function detect the negative peaks not the positive ones

查看:179
本文介绍了如何使findpeak函数检测负峰而不是正峰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使findpeak函数检测负峰而不是正峰,它检测下图所示的红色峰,而我需要检测蓝色峰..任何想法?

I am wondering how can I make findpeak function detect the negative peaks not the positive ones, it detects the red peaks shown in the figure below and I need to detect the blue ones .. any ideas??

非常感谢.

推荐答案

如上所述,您必须使用-data.

As mentioned, you have to use -data.

这里是一个例子,

x = 0 : 1e-3 : 5*pi;
t = (0 : length(x)-1)*1e-3;
y = sin(x);
[p l] = findpeaks(y);
plot(t,y);hold on
plot(t(l),p,'ko','MarkerFaceColor','g');
[pn ln] = findpeaks(-y);
plot(t(ln),-pn,'ko','MarkerFaceColor','r');

给予

这篇关于如何使findpeak函数检测负峰而不是正峰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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