声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1419|回复: 4

[HHT] EMD分解问题,急~~~~~

[复制链接]
发表于 2012-5-15 09:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
本帖最后由 0208106224 于 2012-5-15 10:45 编辑

下面这段程序我仿真出来是一组数据,现在我想让他呈现出emd图的形式要怎么弄?在后面我试着添加plot那些语句照样不行;各位大侠帮帮忙啊:'( 在emd分解后又如何去实现信号的去噪了???
% EMD:  Emprical mode decomposition
%
% imf = emd(x,n)
%
% x   - input signal (must be a column vector)
% n   - number of intrinsic mode functions
%
% imf - Matrix of intrinsic mode functions (each as a row)
%
% See:  Huang et al, Royal Society Proceedings on Math, Physical,
%       and Engineering Sciences, vol. 454, no. 1971, pp. 903-995,
%       8 March 1998
%
% Author: Ivan Magrin-Chagnolleau  <ivan@ieee.org>
%
function imf = emd(x,n);
load noissin;
x=noissin;
c = x(:)'; % copy of the input signal (as a row vector)
N = length(x);
%-------------------------------------------------------------------------
% loop to decompose the input signal into n successive IMFs
imf = []; % Matrix which will contain the successive IMF, and the residue
n=size(c);
for t=1:n % loop on successive IMFs
   
   %-------------------------------------------------------------------------
   % inner loop to find each imf
   
   h = c; % at the beginning of the sifting process, h is the signal
   SD = 1; % Standard deviation which will be used to stop the sifting process
   
   while SD > 0.3 % while the standard deviation is higher than 0.3 (typical value)
      
      % find local max/min points
      d = diff(h); % approximate derivative
      maxmin = []; % to store the optima (min and max without distinction so far)
      for i=1:N-2
         if d(i)==0                        % we are on a zero
            if sign(d(i-1))~=sign(d(i+1))  % it is a maximum
               maxmin = [maxmin, i];
            end
         elseif sign(d(i))~=sign(d(i+1))   % we are straddling a zero so
            maxmin = [maxmin, i+1];        % define zero as at i+1 (not i)
         end
      end
      
      if size(maxmin,2) < 2 % then it is the residue
         break
      end
      
      % divide maxmin into maxes and mins
      if maxmin(1)>maxmin(2)              % first one is a max not a min
         maxes = maxmin(1:2:length(maxmin));
         mins  = maxmin(2:2:length(maxmin));
      else                                % is the other way around
         maxes = maxmin(2:2:length(maxmin));
         mins  = maxmin(1:2:length(maxmin));
      end
      
      % make endpoints both maxes and mins
      maxes = [1 maxes N];
      mins  = [1 mins  N];
      
      
      %-------------------------------------------------------------------------
      % spline interpolate to get max and min envelopes; form imf
      maxenv = spline(maxes,h(maxes),1:N);
      minenv = spline(mins, h(mins),1:N);
      
      m = (maxenv + minenv)/2; % mean of max and min enveloppes
      prevh = h; % copy of the previous value of h before modifying it
      h = h - m; % substract mean to h
      
      % calculate standard deviation
      eps = 0.0000001; % to avoid zero values
      SD = sum ( ((prevh - h).^2) ./ (prevh.^2 + eps) );
      
   end
   
   imf = [imf; h]; % store the extracted IMF in the matrix imf
   % if size(maxmin,2)<2, then h is the residue
     
   % stop criterion of the algo. if we reach the end before n
   if size(maxmin,2) < 2
      break
   end
   
   c = c - h; % substract the extracted IMF from the signal
   
end
return

本帖被以下淘专辑推荐:

回复
分享到:

使用道具 举报

 楼主| 发表于 2012-5-15 10:19 | 显示全部楼层
没人帮忙吗
发表于 2012-5-21 18:47 | 显示全部楼层
俺也不会,俺也想知道
发表于 2012-5-27 14:13 | 显示全部楼层
一样不会,刚开始接触,工具箱怎么弄,还不明白呢
发表于 2013-4-7 13:37 | 显示全部楼层
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-25 13:36 , Processed in 0.076531 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表