我希望在plot figure in Matlab中识别数据中的局部最小值
发布于 2017-01-24 09:12:58
根据您的描述,我假设您实际上已经将数据数字化,并且通过图像处理将图形转换为数字数据不是问题的一部分。请在以后尝试更具体和完整地提出您的问题:)。
基本上,您只想先平滑您的数据。下面的快速代码应该能让您真正接近所需的内容。
x = 0:0.1:10;
y = 3*sin(x) + rand(size(x));
y_filtered = smooth(y);
figure
[min, idx] = findpeaks(-y_filtered); %findpeaks finds maxima, so invert it
hold on
plot(x,y)
plot(x,y_filtered)
plot(x(idx),y_filtered(idx),'bo')
尝试使用smooth()
的参数,或者进行自己的过滤(例如,使用傅立叶变换或诸如此类的方法)。
https://stackoverflow.com/questions/41823307
复制