一维数据滤波并求极大值

立体匹配代码准备

关键函数:

滤波medfilt1(x,n),n:滤波窗口size

findpeaks(x),返回极大值

x=[0:0.1:2*pi];
y=randn(1,length(x));
plot(x,y);
[peaks,index]=findpeaks(y);
size(peaks)
z=medfilt1(y,5);
hold on;
plot(x,z,'r');
[peaks2,index2]=findpeaks(z);
size(peaks2)

结果:

ans =


     1    17

ans =


     1     5






你可能感兴趣的:(一维数据滤波并求极大值)