瞬时频率谱到底怎么回事
function = hhtf1=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);
= emd(y)
imf=;
=size(imf);
ft=(-(ii)/2:(ii)/2-1)/(ii*ts);
figure(1)
for i=1:m
= hhspectrum(imf(i,:),1:ii);
subplot(m,1,i)
plot(f(i,:))
end
figure(2)
for i=1:m
= abs(fftshift(fft(imf(i,:),ii)));
subplot(m,1,i)
plot(ft,ff(i,:))
end
EMD和hhspectrum用的是法国人的源程序。
结果见下图
[ 本帖最后由 JulianChin 于 2007-6-27 18:33 编辑 ] 三个IMF的双边付立叶谱
[ 本帖最后由 JulianChin 于 2007-6-27 18:23 编辑 ] 三个IMF的希尔伯特谱,一片大乱
回复 #3 JulianChin 的帖子
请问你用EMD做什么?回复 #4 zhangnan3509 的帖子
y=sin(2*pi*i*f1)+sin(2*pi*i*f2);= emd(y)
imf=;
法国人的程序
回复 #5 JulianChin 的帖子
谢谢你使我知道了这是法国人的程序,但是我用法国人的程序分解了一下,发现和你的很不一样。第二幅的频率是归一化频率,乘采样频率20000就能得出来1000和2000[ 本帖最后由 zhangnan3509 于 2007-6-27 19:56 编辑 ]
回复 #6 zhangnan3509 的帖子
多谢:没有Matlab7.0,不能用toimage,还想做边际谱,有没有办法,或者能下载到accumarray.m[ 本帖最后由 JulianChin 于 2007-6-27 22:26 编辑 ]
回复 #7 JulianChin 的帖子
function = 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 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 = ;
% A = accumarray(subs, 101:105)
%
% Create a 2-by-3-by-2 array, summing values for repeated 3-D subscripts:
% subs = ;
% A = accumarray(subs, 101:105)
%
% Create a 2-by-3-by-2 array, summing values natively:
% subs = ;
% A = accumarray(subs, int8(101:105), [], @(x) sum(x,'native'))
% class(A)
%
% Create an array using MAX, and fill empty elements with NaN:
% subs = ;
% A = accumarray(subs, 101:105, , @max, NaN)
%
% Create a sparse matrix using PROD:
% subs = ;
% A = accumarray(subs, 101:105, , @prod, 0, true)
%
% Count the number of subscripts for each bin:
% subs = ;
% A = accumarray(subs, 1, )
%
% Create a logical array indicating bins with two or more values:
% subs = ;
% A = accumarray(subs, 101:105, , @(x) length(x)>1)
%
% Group values in a cell array:
% subs = ;
% A = accumarray(subs, 101:105, , @(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
= builtin('accumarray', varargin{:});
end 原帖由 zhangnan3509 于 2007-6-27 22:30 发表 http://www.chinavib.com/forum/images/common/back.gif
function = accumarray(varargin)
%ACCUMARRAY Construct an array by accumulation.
% A = ACCUMARRAY(SUBS,VAL) creates an array A by accumulating elements of the
% vector VAL usi ...
:@) 多谢
回复 #8 zhangnan3509 的帖子
呵呵,真不好意思,看来没有7.0的话怎么也用不了toimage看来得找其他的边际谱程序了
页:
[1]