声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2041|回复: 9

[HHT] 瞬时频率谱到底怎么回事

[复制链接]
发表于 2007-6-27 18:11 | 显示全部楼层 |阅读模式

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

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

x
function [imf,f] = hht

f1=1000;
f2=2000;
ts=1/5000;
k=1;
i=0:ts:k;
ii=length(i);                                 %采样点数

y=sin(2*pi*i*f1)+sin(2*pi*i*f2);

[imf,residue] = emd(y)
imf=[imf;residue];

[m,t]=size(imf);

ft=(-(ii)/2:(ii)/2-1)/(ii*ts);

figure(1)
for i=1:m
    [A,f(i,:),tt] = hhspectrum(imf(i,:),1:ii);
    subplot(m,1,i)
    plot(f(i,:))
end

figure(2)
for i=1:m
    [ff(i,:)] = abs(fftshift(fft(imf(i,:),ii)));
    subplot(m,1,i)
    plot(ft,ff(i,:))
end

EMD和hhspectrum用的是法国人的源程序。
结果见下图

[ 本帖最后由 JulianChin 于 2007-6-27 18:33 编辑 ]
回复
分享到:

使用道具 举报

 楼主| 发表于 2007-6-27 18:16 | 显示全部楼层
三个IMF的双边付立叶谱

[ 本帖最后由 JulianChin 于 2007-6-27 18:23 编辑 ]
fft.jpg
 楼主| 发表于 2007-6-27 18:24 | 显示全部楼层
三个IMF的希尔伯特谱,一片大乱
hht.jpg
发表于 2007-6-27 19:09 | 显示全部楼层

回复 #3 JulianChin 的帖子

请问你用EMD做什么?
 楼主| 发表于 2007-6-27 19:26 | 显示全部楼层

回复 #4 zhangnan3509 的帖子

y=sin(2*pi*i*f1)+sin(2*pi*i*f2);

[imf,residue] = emd(y)
imf=[imf;residue];
法国人的程序
发表于 2007-6-27 19:53 | 显示全部楼层

回复 #5 JulianChin 的帖子

谢谢你使我知道了这是法国人的程序,但是我用法国人的程序分解了一下,发现和你的很不一样。第二幅的频率是归一化频率,乘采样频率20000就能得出来1000和2000

[ 本帖最后由 zhangnan3509 于 2007-6-27 19:56 编辑 ]
1.bmp
2.bmp

评分

1

查看全部评分

 楼主| 发表于 2007-6-27 22:25 | 显示全部楼层

回复 #6 zhangnan3509 的帖子

多谢:没有Matlab7.0,不能用toimage,还想做边际谱,有没有办法,或者能下载到accumarray.m

[ 本帖最后由 JulianChin 于 2007-6-27 22:26 编辑 ]
发表于 2007-6-27 22:30 | 显示全部楼层

回复 #7 JulianChin 的帖子

function [varargout] = accumarray(varargin)
%  ACCUMARRAY Construct an array by accumulation.
%   A = ACCUMARRAY(SUBS,VAL) creates an array A by accumulating elements of the
%   vector VAL using the subscripts in SUBS.  Each row of the M-by-N matrix
%   SUBS defines an N-dimensional subscript into the output A.  Each element of
%   VAL has a corresponding row in SUBS.  ACCUMARRAY collects all elements of
%   VAL that correspond to identical subscripts in SUBS, sums those values, and
%   stores the result in the element of A corresponding to the subscript.
%   Elements of A that are not referred to by any row of SUBS contain zero.
%
%   SUBS must contain positive integers.  If SUBS is a nonempty matrix with N>1
%   columns, then A is a N-dimensional array of size MAX(SUBS,[],1).  If SUBS is
%   empty with N>1 columns, then A is an N-dimensional empty array with size
%   0-by-0-by-...-by-0.  SUBS may also be a column vector, and A is then also a
%   column vector.  In this case, A has length MAX(SUBS,[],1) when SUBS is
%   nonempty, or length zero when SUBS is empty.
%
%   SUBS may also be a cell vector with one or more elements, each a vector of
%   positive integers.  All of the vectors must have the same length.  In this
%   case, SUBS is treated as if the vectors formed columns of a subscript matrix.
%
%   VAL must be a numeric, logical, or character vector with the same length
%   as the number of rows in SUBS.  VAL may also be a scalar whose value is
%   repeated for all the rows of SUBS.
%
%   ACCUMARRAY sums values from VAL using the default behavior of SUM.
%
%   A = ACCUMARRAY(SUBS,VAL,SZ) creates an array A with size SZ, where SZ is a
%   vector of positive integers.  If SUBS is nonempty with N>1 columns, then SZ
%   must have N elements, where ALL(SZ >= MAX(SUBS,[],1)).  If SUBS is a nonempty
%   column vector, then SZ must be [M 1] where M >= MAX(SUBS).  Specify SZ as
%   [] for the default behavior.
%
%   A = ACCUMARRAY(SUBS,VAL,SZ,FUN) applies the function FUN to each subset of
%   elements of VAL.  FUN is a function that accepts a column vector and returns
%   a numeric, logical, or char scalar, or a scalar cell.  A has the same class
%   as the values returned by FUN.  FUN is @SUM by default.  Specify FUN as []
%   for the default behavior.
%
%   Note: If the subscripts in SUBS are not sorted, FUN should not depend on the
%   order of the values in its input data.
%
%   A = ACCUMARRAY(SUBS,VAL,SZ,FUN,FILLVAL) puts the scalar value FILLVAL in
%   elements of A that are not referred to by any row of SUBS.  For example, if
%   SUBS is empty, then A is REPMAT(FILLVAL,SZ).  FILLVAL and the values returned
%   by FUN must have the same class.
%
%   A = ACCUMARRAY(SUBS,VAL,SZ,FUN,FILLVAL,ISSPARSE) creates an array A that is
%   sparse if the logical scalar ISSPARSE is true, or full if ISSPARSE is false.
%   A is full by default.  FILLVAL must be zero or [] if ISSPARSE is true.  VAL
%   and the output of FUN must be double if ISSPARSE is true.
%
%   Examples:
%
%   Create a 5-by-1 vector, summing values for repeated 1-D subscripts:
%      subs = [1; 2; 4; 2; 4];
%      A = accumarray(subs, 101:105)
%
%   Create a 2-by-3-by-2 array, summing values for repeated 3-D subscripts:
%      subs = [1 1 1; 2 1 2; 2 3 2; 2 1 2; 2 3 2];
%      A = accumarray(subs, 101:105)
%
%   Create a 2-by-3-by-2 array, summing values natively:
%      subs = [1 1 1; 2 1 2; 2 3 2; 2 1 2; 2 3 2];
%      A = accumarray(subs, int8(101:105), [], @(x) sum(x,'native'))
%      class(A)
%
%   Create an array using MAX, and fill empty elements with NaN:
%      subs = [1 1; 2 1; 2 3; 2 1; 2 3];
%      A = accumarray(subs, 101:105, [2 4], @max, NaN)
%
%   Create a sparse matrix using PROD:
%      subs = [1 1; 2 1; 2 3; 2 1; 2 3];
%      A = accumarray(subs, 101:105, [2 4], @prod, 0, true)
%
%   Count the number of subscripts for each bin:
%      subs = [1 1; 2 1; 2 3; 2 1; 2 3];
%      A = accumarray(subs, 1, [2 4])
%
%   Create a logical array indicating bins with two or more values:
%      subs = [1 1; 2 1; 2 3; 2 1; 2 3];
%      A = accumarray(subs, 101:105, [2 4], @(x) length(x)>1)
%
%   Group values in a cell array:
%      subs = [1 1; 2 1; 2 3; 2 1; 2 3];
%      A = accumarray(subs, 101:105, [2 4], @(x) {x})
%      A{2}
%
%   See also FULL, SPARSE, SUM, FUNCTION_HANDLE.

%   Copyright 1984-2005 The MathWorks, Inc.
%   $Revision: 1.1.6.7 $  $Date: 2005/06/21 19:28:18 $
%   Built-in function.

if nargout == 0
  builtin('accumarray', varargin{:});
else
  [varargout{1:nargout}] = builtin('accumarray', varargin{:});
end
 楼主| 发表于 2007-6-28 00:15 | 显示全部楼层
原帖由 zhangnan3509 于 2007-6-27 22:30 发表
function [varargout] = accumarray(varargin)
%  ACCUMARRAY Construct an array by accumulation.
%   A = ACCUMARRAY(SUBS,VAL) creates an array A by accumulating elements of the
%   vector VAL usi ...

:@) 多谢
 楼主| 发表于 2007-6-28 00:24 | 显示全部楼层

回复 #8 zhangnan3509 的帖子

呵呵,真不好意思,看来没有7.0的话怎么也用不了toimage
看来得找其他的边际谱程序了
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-12-4 11:07 , Processed in 0.059169 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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