資源簡介
絕對實用的EMD模態分解算法 可手動調試 網上的下的其他程序都很難懂 但這個絕對簡單
代碼片段和文件信息
t=0:0.1:8;
x1=sin(pi*t)+cos(2*pi*t);
x=x1;
sd=1;
sd1=1;
sd2=1;
for?n=1:29
????if(sd>0.3)
%?找到極大值的位置和極大值
max_location=find(diff(sign(diff(x)))==-2)+1;
max_array=x(max_location);
T_max=t(max_location);
%?找到極小值的位置和極小值
min_location=find(diff(sign(diff(x)))==2)+1;
min_array=x(min_location);
T_min=t(min_location);
%?三次樣條擬和極大值得到上包絡線xmax?
xmax=spline(T_maxmax_arrayt);
xmin=spline(T_minmin_arrayt);
m=(xmax+xmin)/2;?%上下包絡均值
h=x-m;
sd=sum(((x-h)./x).^2);
x=h;
????end
end
c=h;
figure;
subplot(231);
plot(tx1);
axis([0?8?-2?2]);
subplot(232);
plot(tc);
%第二次
r1=x1-c;
for?n1=1:54
??if(sd1>0.3)
%?找到極大值的位置和極大值
max_location1=find(diff(sign(diff(r1)))==-2)+1;
max_array1=r1(max_location1);
T_max1=t(max_location1);
%?找到極小值的位置和極小值
min_location1=find(diff(sign(diff(r1)))==2)+1;
min_array1=r1(min_location1);
T_min1=t(min_
評論
共有 條評論