声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

楼主: qqzhouqianziyi

[HHT] 部分hlbert程序解读(toimage函数)

  [复制链接]
发表于 2011-3-21 15:15 | 显示全部楼层
本帖最后由 chenlu1986 于 2011-3-21 15:17 编辑

检查了程序没有问题,图形可以出来。
你的原因可能是没有使用EMD工具箱,你的程序里面的几个函数EMD工具箱里面都有。我把我用的工具箱发上,你安装一下然后使用,没有问题。我用的matlab是MATLAB R2006b,比你的低版本都可以的。

压缩包太大,上传不了。你自己去下一个工具箱。很容易找到的。
回复 支持 反对
分享到:

使用道具 举报

 楼主| 发表于 2011-3-22 15:34 | 显示全部楼层
回复 15 # chenlu1986 的帖子

你好 你知道怎么安装那个工具箱么  我装个半天 好像不对  程序还是运行不出来 能不能把那个工具箱的安装步骤和 libsvm给我一下啊 谢谢了
 楼主| 发表于 2011-3-22 16:05 | 显示全部楼层
回复 16 # chenlu1986 的帖子

应该不是EMD工具箱的问题吧?我把程序单步运行了一下  EMD分解 瞬时相位瞬时频率都能求出来  单步运行hhspectrum toimage和disp_hhs的源程序都有  只是感觉运行出的结果不对
发表于 2011-3-22 18:31 | 显示全部楼层
package_emd.rar (92.72 KB, 下载次数: 50)
还是建议你使用EMD工具箱。

发表于 2011-3-23 07:56 | 显示全部楼层
好像挺复杂的样子,H谱和边际谱我一直没敢碰,怕做不出来...
 楼主| 发表于 2011-3-23 15:52 | 显示全部楼层
本帖最后由 qqzhouqianziyi 于 2011-3-23 16:10 编辑

回复 19 # chenlu1986 的帖子

你好 你说的这个EMD工具箱我有 用的就是这个  而且上面 像hhspectrum, disp_hhs,  toimage等都没有 我也都给加上了  还有 你说的那个libsvm工具箱我也装上了 就是运行不出来啊   我运行的bjp的结果 是1X400的矩阵 前面399个都是0  最后一个是1.9952   这结果就不对啊
发表于 2011-3-23 16:18 | 显示全部楼层
本帖最后由 chenlu1986 于 2011-3-23 16:21 编辑

回复 21 # qqzhouqianziyi 的帖子

抱歉啊,昨天好像写错了,EMD分解用上面附件中的工具箱即可,libsvm是支持向量机的工具箱这里用不上。

你上面说边际谱出错时运行13楼我贴的那个程序吗?你先试试我的那个,看能出现结果不,如果一摸一样的程序你不出现结果的话就是你工具箱的使用等方面可能出问题啦。
加油
 楼主| 发表于 2011-3-23 16:21 | 显示全部楼层
回复 22 # chenlu1986 的帖子

呵呵 没关系 你也是好心帮我么  那你还能帮我想想究竟是哪的问题么  我怎么试都不行啊
发表于 2011-3-23 16:29 | 显示全部楼层
你好,我前六幅图能出来,但是后面的出不来,提示 Error using ==> toimage,Too many output arguments.    [E,t,cenf]=toimage(A,f);这2个错误,是什么情况呢
发表于 2011-3-23 16:32 | 显示全部楼层
你指的是边际谱的幅值不是1对吧,其实边际谱的幅值并不真的是信号的幅值,受一些因素的影响(论坛里有有讲的,你多看看本论坛里相关的帖子,会很有收获的。)。
还有如果幅值错的离谱的话,那你就检查一下求边际谱的程序,我当时学写的时候也是仿照论坛里“破凰”网友的,自己再理解一下。
发表于 2011-3-23 16:40 | 显示全部楼层
[A,f,tt] = hhspectrum(ximf);
[E,t,Cenf]=toimage(A,f);
这2句到底哪个才是Hilbert 谱呢,晕了,还是有一个是边际谱
 楼主| 发表于 2011-3-23 17:04 | 显示全部楼层
回复 13 # chenlu1986 的帖子

我的意思是说  像你给的那个程序  做出的边际谱图  大概频率在20  和60的时候有对应得幅值 而我那个就一个幅值  对应的频率差不多到500了 这个图形是错的吧
 楼主| 发表于 2011-3-23 17:06 | 显示全部楼层
本帖最后由 qqzhouqianziyi 于 2011-3-23 17:08 编辑

回复 24 # lk677976 的帖子

你那个toimage函数是不是调用不正确啊  我运行的没有显示错误 就是图形不对
[A,f,tt] = hhspectrum(ximf);
[E,t,Cenf]=toimage(A,f);
这两句话我也不是特别的明白 所以到现在也没做出来
发表于 2011-3-24 10:29 | 显示全部楼层
回复 28 # qqzhouqianziyi 的帖子

我那运行的错误提示是:Error using ==> toimage,Too many output arguments.    [E,t,cenf]=toimage(A,f);是什么情况呢 ,能加下QQ吗
 楼主| 发表于 2011-3-24 10:50 | 显示全部楼层
回复 29 # lk677976 的帖子

不好意思  这个我也没研究透呢  我觉得我那问题也是出在这了  虽然没显示错误 但是我感觉运行的结果不对  我用的toimage的程序是下面这个  不知道你用的哪个  先参考一下吧  我也不知道是不是对的
%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);
end
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-19 03:29 , Processed in 0.066829 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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