求助:找包络线的方法
大家帮我看下这样的曲线如何求包络线,换句话说,对于任意曲线如何找到包络线,谢谢。 如果周期已知的话, 不知是否可以按照周期分段找出最大值与最小值. 1、先分别找到极大值和极小值(利用diff函数和极值点的特点)2、用曲线拟合函数拟合所有极大值点即为上包络线,拟合所有极小值点即为下包络线 hustxyong 发表于 2012-4-20 15:20 static/image/common/back.gif
1、先分别找到极大值和极小值(利用diff函数和极值点的特点)
2、用曲线拟合函数拟合所有极大值点即为上包 ...
用什么曲线拟合呢?(高次多项式?)
我的这个曲线是用数值计算得出来的,没法用diff函数来球,极值得一个个的找。 眉间尺 发表于 2012-4-20 12:25 static/image/common/back.gif
如果周期已知的话, 不知是否可以按照周期分段找出最大值与最小值.
这是个非周期运动。 可以参考EMD分解中使用三次样条拟合上下包络
,具体看看EMD分解,可能给你一些思路 Ref: 6.一种有效的包络线算法 http://forum.vibunion.com/thread-32967-1-1.html
求画出振荡的包络线图 http://forum.vibunion.com/thread-28736-1-1.html
http://www.mathworks.com/matlabcentral/fileexchange/24902-envelope
求非线性曲线波峰和波谷的坐标 http://forum.vibunion.com/thread-95495-1-1.html
Detect zero level crossing of signals http://www.mathworks.com/matlabcentral/fileexchange/2432
这个以前做过一次,一个个找极值是不需要的,用个for函数就解决了,在cftool中可以自己试下有多种方法的 本帖最后由 yizhendong 于 2012-4-24 19:27 编辑
我用matlab二次开发的envelope函数,得到的包络线如下。估计envelope的精度有限,所以包络线并不正确。
本帖最后由 fzwxjtu 于 2012-4-24 22:23 编辑
EMD中的包络方法还是比较理想的,下面是我仿真做的代码,楼主可以试试能用不?其实用Hilbert包络同样可以解调的,效果没这个好,就不贴了。clear;
fs=12800;
t=0:1/fs:10-1/fs;t=t';
f1=5;f2=100;
x=cos(2*pi*f1*t).*sin(2*pi*f2*t);
n=length(x);
s=x;
t=0:length(s)-1;
s1=s;
sd=1;
if(sd>0.3)
jd=find(diff(sign(diff(s1)))==-2)+1;%找h1极大值的位置
jx=find(diff(sign(diff(s1)))==2)+1; %找h1极小值的位置
ah=length(jd);
al=length(jx);
jdz(ah)=0;
for i=1:ah
bh=jd(i);
jdz(i)=s1(bh);
end %找出h1极大值对应函数值
jxz(al)=0;
for i=1:al
bl=jx(i);
jxz(i)=s1(bl);
end %找出h1极小值对应函数值
jsbl=spline(jd,jdz,t);%极大值拟和的上包络
jxbl=spline(jx,jxz,t);%极小值拟和的下包络
m1=(jsbl+jxbl)/2; %上下包络均值
m1=m1';
h1=s1-m1;
sd=sum(((s1-h1)./h1).^2);
end
figure(1)
plot(x);
hold on;
plot(jsbl,'r');
title('采用EMD中的包络方法');下面是效果图,红线是包络线。
用matlab二次开发的envelope函数
什麼意思? 那个函数? 试着将楼主的图片还原成了数据, 大家方便的话先在自己的机器上试试包络生成程序:
findenv.rar中含有存储下列数据的各种类型文件:
=================
0.091954023 -4.857142857
0.137931034 -5.80952381
0.183908046 -0.857142857
0.229885057 6.285714286
0.275862069 9.714285714
0.32183908 6.666666667
0.367816092 1.619047619
0.413793103 -1.238095238
0.459770115 -2.19047619
0.505747126 -5.142857143
0.551724138 -10.38095238
0.597701149 -12
0.643678161 -4.952380952
0.689655172 5.619047619
0.735632184 13.14285714
0.781609195 14.0952381
0.827586207 9.904761905
0.873563218 3.523809524
0.91954023 -3.619047619
0.965517241 -12.0952381
1.011494253 -20.76190476
1.057471264 -23.52380952
1.103448276 -14.66666667
1.149425287 0.095238095
1.195402299 13.23809524
1.24137931 20.85714286
1.287356322 21.71428571
1.333333333 16.47619048
1.379310345 5.238095238
1.425287356 -10
1.471264368 -24.28571429
1.517241379 -32
1.563218391 -27.33333333
1.609195402 -15.52380952
1.655172414 -2.761904762
1.701149425 8.095238095
1.747126437 16.0952381
1.793103448 19.61904762
1.83908046 16
1.885057471 6.761904762
1.931034483 -6.285714286
1.977011494 -15.9047619
2.022988506 -16.57142857
2.068965517 -11.14285714
2.114942529 -4.952380952
2.16091954 0.19047619
2.206896552 5.523809524
2.252873563 10.47619048
2.298850575 12
2.344827586 7.80952381
2.390804598 0.095238095
2.436781609 -6.857142857
2.482758621 -9.142857143
2.528735632 -7.428571429
2.574712644 -5.904761905
2.620689655 -4.666666667
2.666666667 -1.428571429
2.712643678 4.095238095
2.75862069 8.761904762
2.804597701 8.952380952
2.850574713 4.952380952
2.896551724 -0.19047619
2.942528736 -3.619047619
2.988505747 -5.428571429
3.034482759 -7.428571429
3.08045977 -9.238095238
3.126436782 -6.476190476
3.172413793 0.19047619
3.218390805 7.238095238
3.264367816 10.95238095
3.310344828 9.428571429
3.356321839 5.238095238
3.402298851 0.380952381
3.448275862 -4.761904762
3.494252874 -10.19047619
3.540229885 -13.80952381
3.586206897 -11.52380952
3.632183908 -3.238095238
3.67816092 6.476190476
3.724137931 12.95238095
3.770114943 14.28571429
3.816091954 10.47619048
3.862068966 3.904761905
3.908045977 -4.19047619
3.954022989 -12.85714286
4 -18.76190476
4.045977011 -17.52380952
4.091954023 -8.761904762
4.137931034 3.047619048
4.183908046 12.28571429
4.229885057 16.95238095
4.275862069 15.71428571
4.32183908 9.333333333
4.367816092 -0.476190476
4.413793103 -11.42857143
4.459770115 -19.71428571
4.505747126 -20.85714286
4.551724138 -14.57142857
4.597701149 -4.285714286
4.643678161 6.285714286
4.689655172 14
4.735632184 17.14285714
4.781609195 13.71428571
4.827586207 5.523809524
4.873563218 -5.238095238
4.91954023 -14.57142857
4.965517241 -18.0952381
5.011494253 -14
5.057471264 -6.666666667
5.103448276 1.238095238
5.149425287 8.285714286
5.195402299 12.95238095
5.24137931 13.04761905
5.287356322 8
5.333333333 -0.666666667
5.379310345 -8.857142857
5.425287356 -12.95238095
5.471264368 -11.33333333
5.517241379 -7.047619048
5.563218391 -2.095238095
5.609195402 3.142857143
5.655172414 8
5.701149425 10.76190476
5.747126437 8.761904762
5.793103448 2.952380952
5.83908046 -3.904761905
5.885057471 -8
5.931034483 -8.571428571
5.977011494 -7.333333333
6.022988506 -5.142857143
6.068965517 -1.619047619
6.114942529 3.333333333
6.16091954 7.714285714
6.206896552 8.952380952
6.252873563 6
6.298850575 0.857142857
6.344827586 -3.523809524
6.390804598 -6
6.436781609 -7.523809524
6.482758621 -7.80952381
6.528735632 -5.333333333
6.574712644 -0.285714286
6.620689655 5.333333333
6.666666667 8.761904762
6.712643678 8.19047619
6.75862069 4.761904762
6.804597701 0.19047619
6.850574713 -4.19047619
6.896551724 -7.714285714
6.942528736 -9.904761905
6.988505747 -8.380952381
7.034482759 -3.238095238
7.08045977 3.333333333
7.126436782 8.380952381
7.172413793 10
7.218390805 7.619047619
7.264367816 3.333333333
7.310344828 -1.904761905
7.356321839 -7.428571429
7.402298851 -11.33333333
7.448275862 -11.04761905
7.494252874 -6.095238095
7.540229885 1.333333333
7.586206897 7.523809524
7.632183908 10.66666667
7.67816092 9.80952381
7.724137931 5.904761905
7.770114943 0
7.816091954 -6.476190476
7.862068966 -11.42857143
7.908045977 -12.38095238
7.954022989 -8.095238095
8 -0.857142857
8.045977011 5.904761905
8.091954023 10
8.137931034 10.85714286
8.183908046 7.714285714
8.229885057 1.80952381
8.275862069 -5.047619048
8.32183908 -10.57142857
8.367816092 -12.28571429
8.413793103 -8.857142857
8.459770115 -2.857142857
8.505747126 3.619047619
8.551724138 8.476190476
8.597701149 10.47619048
8.643678161 8.666666667
8.689655172 3.619047619
8.735632184 -3.142857143
8.781609195 -8.761904762
8.827586207 -11.33333333
8.873563218 -8.952380952
8.91954023 -4.285714286
8.965517241 0.952380952
9.011494253 5.714285714
9.057471264 8.666666667
9.103448276 8.380952381
9.149425287 5.142857143
9.195402299 -0.571428571
9.24137931 -6.19047619
9.287356322 -8.952380952
9.333333333 -8.285714286
9.379310345 -5.428571429
9.425287356 -1.428571429
9.471264368 2.666666667
9.517241379 6.19047619
9.563218391 7.80952381
9.609195402 5.904761905
9.655172414 1.714285714
9.701149425 -3.142857143
9.747126437 -6.380952381
9.793103448 -7.047619048
9.83908046 -6
9.885057471 -3.523809524
9.931034483 -0.095238095
9.977011494 3.619047619
10.02298851 6.285714286
10.06896552 6.095238095
10.11494253 3.428571429
10.16091954 -0.380952381
10.20689655 -3.714285714
10.25287356 -5.619047619
10.29885057 -5.904761905
10.34482759 -4.952380952
10.3908046 -2.285714286
10.43678161 1.428571429
10.48275862 4.857142857
10.52873563 6.285714286
10.57471264 4.666666667
10.62068966 1.619047619
10.66666667 -1.523809524
10.71264368 -4.095238095
10.75862069 -5.714285714
10.8045977 -5.904761905
10.85057471 -4.095238095
10.89655172 -0.571428571
10.94252874 3.238095238
10.98850575 5.428571429
11.03448276 5.238095238
11.08045977 3.142857143
11.12643678 0.19047619
11.17241379 -2.666666667
11.2183908 -5.142857143
11.26436782 -6.285714286
11.31034483 -5.047619048
11.35632184 -2
11.40229885 1.80952381
11.44827586 4.571428571
11.49425287 5.333333333
11.54022989 4.095238095
11.5862069 1.619047619
11.63218391 -1.428571429
11.67816092 -4.19047619
11.72413793 -5.904761905
11.77011494 -5.333333333
11.81609195 -2.857142857
11.86206897 0.476190476
11.90804598 3.333333333
11.95402299 4.761904762
12 4.285714286
12.04597701 2.571428571
12.09195402 -0.285714286
12.13793103 -3.333333333
12.18390805 -5.238095238
12.22988506 -5.142857143
12.27586207 -3.333333333
12.32183908 -0.476190476
12.36781609 2.19047619
12.4137931 3.80952381
12.45977011 3.904761905
12.50574713 2.857142857
12.55172414 0.571428571
12.59770115 -2.285714286
12.64367816 -4.380952381
12.68965517 -4.857142857
12.73563218 -3.428571429
12.7816092 -1.047619048
12.82758621 1.238095238
12.87356322 2.857142857
12.91954023 3.428571429
12.96551724 2.857142857
13.01149425 1.047619048
13.05747126 -1.333333333
13.10344828 -3.333333333
13.14942529 -4
13.1954023 -3.047619048
13.24137931 -1.333333333
13.28735632 0.571428571
13.33333333 2
13.37931034 2.666666667
13.42528736 2.412698413
13.47126437 1.142857143
13.51724138 -0.761904762
13.56321839 -2.476190476
13.6091954 -3.047619048
13.65517241 -2.571428571
13.70114943 -1.428571429
13.74712644 -0.19047619
13.79310345 1.142857143
13.83908046 2.095238095
13.88505747 2.095238095
13.93103448 1.142857143
13.97701149 -0.476190476
14.02298851 -1.80952381
14.06896552 -2.476190476
14.11494253 -2
14.16091954 -1.238095238
14.20689655 -0.380952381
14.25287356 0.571428571
14.29885057 1.428571429
14.34482759 1.523809524
14.3908046 0.857142857
14.43678161 -0.380952381
14.48275862 -1.428571429
14.52873563 -1.714285714
14.57471264 -1.523809524
14.62068966 -1.047619048
14.66666667 -0.285714286
14.71264368 0.380952381
14.75862069 0.952380952
14.8045977 0.952380952
14.85057471 0.380952381
14.89655172 -0.476190476
14.94252874 -0.952380952
14.98850575 -1.238095238
15.03448276 -0.952380952
15.08045977 -0.761904762
15.12643678 -0.285714286
15.17241379 0.19047619
15.2183908 0.476190476
15.26436782 0.380952381
15.31034483 -0.095238095
15.35632184 -0.571428571
15.40229885 -0.857142857
15.44827586 -0.761904762
15.49425287 -0.571428571
15.54022989 -0.380952381
15.5862069 -0.095238095
15.63218391 0.19047619
15.67816092 0.19047619
15.72413793 0
15.77011494 -0.380952381
15.81609195 -0.761904762
15.86206897 -0.571428571
15.90804598 -0.380952381
15.95402299 -0.19047619
16 -0.19047619
16.04597701 -0.19047619
16.09195402 0
16.13793103 -0.19047619
16.18390805 -0.380952381
16.22988506 -0.571428571
16.27586207 -0.571428571
16.32183908 -0.380952381
16.36781609 -0.095238095
16.4137931 0
16.45977011 -0.19047619
16.50574713 -0.19047619
16.55172414 -0.19047619
16.59770115 -0.19047619
16.64367816 -0.380952381
16.68965517 -0.571428571
16.73563218 -0.380952381
16.7816092 -0.095238095
16.82758621 0
16.87356322 -0.19047619
16.91954023 -0.380952381
16.96551724 -0.380952381
17.01149425 -0.380952381
17.05747126 -0.19047619
17.10344828 -0.380952381
17.14942529 -0.380952381
17.1954023 -0.19047619
17.24137931 0
17.28735632 -0.19047619
17.33333333 -0.380952381
17.37931034 -0.571428571
17.42528736 -0.380952381
17.47126437 -0.19047619
17.51724138 -0.19047619
17.56321839 -0.380952381
17.6091954 -0.380952381
17.65517241 -0.380952381
17.70114943 -0.19047619
17.74712644 -0.19047619
17.79310345 -0.380952381
17.83908046 -0.380952381
17.88505747 -0.19047619
17.93103448 -0.19047619
17.97701149 -0.19047619
18.02298851 -0.380952381
18.06896552 -0.380952381
18.11494253 -0.380952381
18.16091954 -0.19047619
18.20689655 -0.19047619
18.25287356 -0.380952381
18.29885057 -0.380952381
18.34482759 -0.19047619
18.3908046 -0.19047619
18.43678161 -0.19047619
18.48275862 -0.380952381
18.52873563 -0.380952381
18.57471264 -0.19047619
18.62068966 -0.19047619
18.66666667 -0.19047619
18.71264368 -0.380952381
18.75862069 -0.380952381
18.8045977 -0.19047619
18.85057471 -0.19047619
18.89655172 -0.380952381
18.94252874 -0.380952381
18.98850575 -0.380952381
19.03448276 -0.19047619
19.08045977 -0.19047619
19.12643678 -0.380952381
19.17241379 -0.380952381
19.2183908 -0.380952381
19.26436782 -0.19047619
19.31034483 -0.19047619
19.35632184 -0.380952381
19.40229885 -0.380952381
19.44827586 -0.19047619
19.49425287 -0.19047619
19.54022989 -0.19047619
19.5862069 -0.380952381
19.63218391 -0.380952381
19.67816092 -0.19047619
19.72413793 -0.19047619
19.77011494 -0.19047619
19.81609195 -0.380952381
19.86206897 -0.380952381
19.90804598 -0.19047619
19.95402299 -0.19047619
20 -0.19047619
本帖最后由 fzwxjtu 于 2012-4-25 09:46 编辑
三次样条插值龙格现象严重
分段线性插值效果比较好,但是不光滑
使用7F,一种有效的包络线算法 http://forum.vibunion.com/thread-32967-1-1.html; 12F的资料
load findenv
x=D1(:,1); y=D1(:,2); plot(x,y)
= envelope(x,y,'linear');
hold on; plot(x,,'r');
页:
[1]
2