声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3604|回复: 10

[HHT] 求完整的EMD-HHT工具箱?

[复制链接]
发表于 2010-12-1 14:59 | 显示全部楼层 |阅读模式

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

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

x
哪位同志有完整的正确的EMD-HHT的MATLAB工具箱,我自己在很多地方下载了一些,但是作出来的效果和某篇论文中的效果不同,自己对工具箱中的函数也做了简单的更改还是效果不是很理想。
基本上EMD-HHT分解用到了,这几个函数,emd(),emd_visu(),hhspecturm(),toimage(),disp_hhs().还有下载到一个plot-hht的工具箱,基本上还是有些问题的。但是发现的问题是下载的几个emd工具箱中toimage(),disp_hhs()函数的编写内容也不是一样的,效果基本上是一样的,但是我不太会修改。而且我希望disp_hhs画出的谱不是dB谱,而是幅值谱,该了半天也感觉不对尽。哪位有对这些函数修改好的正确的能给发一下吗?谢谢了

本帖被以下淘专辑推荐:

回复
分享到:

使用道具 举报

发表于 2010-12-1 15:48 | 显示全部楼层
我最近也在做这方面的东西,请问你的toimage函数是什么格式的?可以[E,tt1]=toimage(A,fa,tt,length(tt));这样格式调用吗?
 楼主| 发表于 2010-12-1 16:20 | 显示全部楼层
function [im,tt] = toimage(A,f,t,splx,sply)是这样的。之前的一个和你的一样,不过发现这个还是有问题,里边的程序我还是没看懂。这个toimage到底是做了什么
发表于 2010-12-7 21:03 | 显示全部楼层
[im,tt]=toimage(A,f,tt,length(tt));
disp_hhs(im,[],fs);
%TOIMAGE  transforms a spectrum made of 1D functions in an 2D image
%
% [im,tt,ff] = TOIMAGE(A,f,t,splx,sply) transforms a spectrum made
% of 1D functions (e.g., output of "hhspectrum") in an 2D image
%
% inputs :   - A    : amplitudes of modes (1 mode per row of A)
%            - f    : instantaneous frequencies
%            - t    : time instants
%            - splx : number of columns of the output im (time resolution).
%                     If different from length(t), works only for uniform
%                     sampling.
%            - sply : number of rows of the output im (frequency resolution).
% outputs :  - im   : 2D image of the spectrum
%            - tt   : time instants in the image
%            - ff   : centers of the frequency bins
%
% Examples : [im,tt,ff] = toimage(A,f);[im,tt] = toimage(A,f,t);[im,tt,ff] = toimage(A,f,sply);
%            [im,tt,ff] = toimage(A,f,splx,sply);[im,tt,ff] = toimage(A,f,t,splx,sply);
%
%
% See also
%  emd, hhspectrum, disp_hhs
%
% G. Rilling, last modification 3.2007
% gabriel.rilling@ens-lyon.fr

function [im,tt,ff] = toimage(A,f,varargin)


DEFSPL = 400;

error(nargchk(2,5,nargin));

switch nargin
  case 2
    t = 1:size(A,2);
    sply = DEFSPL;
    splx = length(t);
  case 3
    if isscalar(varargin{1})
      t = 1:size(A,2);
      splx = length(t);
      sply = varargin{1};
    else
      t = varargin{1};
      splx = length(t);
      sply = DEFSPL;
    end
  case 4
    if isscalar(varargin{1})
      t = 1:size(A,2);
      sply = varargin{1};
      splx = varargin{2};
    else
      t = varargin{1};
      sply = varargin{2};
      splx = length(t);
    end
  case 5
    t = varargin{1};
    splx = varargin{2};
    sply = varargin{3};
end
if isvector(A)
  A = A(:)';
  f = f(:)';
end


if issparse(A) || ~isreal(A) || length(size(A)) > 2
  error('A argument must be a real matrix')
end
if issparse(f) || ~isreal(f) || length(size(f)) > 2
  error('f argument must be a real matrix')
end
if any(size(f)~=size(A))
  error('A and f matrices must have the same size')
end
if issparse(t) || ~isreal(t) || ~isvector(t) || length(t)~=size(A,2)
  error('t argument must be a vector and its length must be the number of columns in A and f inputs')
end
if ~isscalar(splx) || ~isreal(splx) || splx ~= floor(splx) || splx <= 0
  error('splx argument must be a positive integer')
end
if ~isscalar(sply) || ~isreal(sply) || sply ~= floor(sply) || sply <= 0
  error('splx argument must be a positive integer')
end

if any(diff(diff(t))) && splx ~= length(t)
  warning('toimage:nonuniformtimeinsants','When splx differs from length(t), the function only works for equally spaced time instants. You may consider reformating your data (using e.g. interpolation) before using toimage.')
end

f = min(f,0.5);
f = max(f,0);

indf = round(2*f*(sply-1)+1);
indt = repmat(round(linspace(1,length(t),splx)),size(A,1),1);
im = accumarray([indf(:),indt(:)],A(:),[sply,splx]);

indt = indt(1,:);
tt = t(indt);
ff = (0:sply-1)*0.5/sply+1/(4*sply);

%DISP_HHS  display Hilbert-Huang spectrum
%
% DISP_HHS(im,t,inf)
% displays in a new figure the spectrum contained in matrix "im"
% (amplitudes in dB).
%
% inputs:  - im: image matrix (e.g., output of "toimage")
%          - t (optional): time instants (e.g., output of "toimage")
%          - inf (optional): -dynamic range in dB (wrt max)
%            default: inf = -20
%          - fs: sampling frequency
%
% use:  disp_hhs(im) ; disp_hhs(im,t) ; disp_hhs(im,inf)
%       disp_hhs(im,t,inf) ; disp_hhs(im,inf,fs) ; disp_hhs(im,[],fs)
%       disp_hhs(im,t,[],fs) ; disp_hhs(im,t,inf,fs)
%
%
% See also
%  emd, hhspectrum, toimage
%
% G. Rilling, last modification 3.2007
% gabriel.rilling@ens-lyon.fr

function disp_hhs(varargin)

error(nargchk(1,3,nargin));
fs = 0;
inf = -20;
im = varargin{1};
t = 1:size(im,2);
switch nargin
  case 1
    %raf
  case 2
    if isscalar(varargin{2})
      inf = varargin{2};
    else
      t = varargin{2};
    end
  case 3
    if isvector(varargin{2})
      t = varargin{2};
      inf = varargin{3};
    else
      inf = varargin{2};
      fs = varargin{3};
    end
  case 4
    t = varargin{2};
    inf = varargin{3};
    fs = varargin{4};
end

if isempty(inf)
  inf = -20;
end

if inf > 0
  inf = -inf;
elseif inf == 0
  error('inf must be nonzero')
end

M=max(max(im));

warning off
im = 10*log10(im/M);
warning on

figure

if fs == 0
  imagesc(t,[0,0.5],im,[inf,0]);
  ylabel('normalized frequency')
else
  imagesc(t,[0,0.5*fs],im,[inf,0]);
  ylabel('频率')
end
set(gca,'YDir','normal')
xlabel('采样点')
title('Hilbert-Huang spectrum')

end
发表于 2010-12-7 21:04 | 显示全部楼层
你试试这两个程序能用吗 在我这里好用 具体的作用你可以看看那个注释 大家多交流
发表于 2011-4-9 10:09 | 显示全部楼层
关注此问题
发表于 2011-4-9 17:17 | 显示全部楼层
xieixe louzhu
发表于 2011-4-10 11:42 | 显示全部楼层
谢谢楼主!
发表于 2011-9-7 21:15 | 显示全部楼层
我也要找个完整的hht工具箱,谁有共享一下啊
发表于 2011-9-8 12:10 | 显示全部楼层
回复 9 # cartoonyjw 的帖子

我也想找啊。求助啊 啊。
发表于 2013-1-22 23:11 | 显示全部楼层
求完整的HHT工具箱啊
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-13 16:29 , Processed in 0.054130 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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