声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 4117|回复: 7

[HHT] 缺少instfreq函数

[复制链接]
发表于 2008-11-14 10:29 | 显示全部楼层 |阅读模式

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

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

x
我运行了一下emd的程序,提示:
??? Undefined function or method 'instfreq' for input arguments of type 'double'.

Error in ==> hhspectrum at 79
  f(i,:)=instfreq(an(i,:)',tt,l)';
回复
分享到:

使用道具 举报

发表于 2008-12-17 21:50 | 显示全部楼层

你要的instfreq

function [freq_inst,fnormhat,t]=instfreq(x,freq_sampling,t,L,trace);
%INSTFREQ Instantaneous frequency estimation.
%        [FNORMHAT,T]=INSTFREQ(X,T,L,TRACE) computes the instantaneous
%        frequency of the analytic signal X at time instant(s) T, using the
%        trapezoidal integration rule.
%        The result FNORMHAT lies between 0.0 and 0.5.
%
%        X : Analytic signal to be analyzed.
%        T : Time instants                (default : 2:length(X)-1).
%   FREQ_SAMPLING : sampling frequency
%        L : If L=1, computes the (normalized) instantaneous frequency
%            of the signal X defined as angle(X(T+1)*conj(X(T-1)) ;
%            if L>1, computes a Maximum Likelihood estimation of the
%            instantaneous frequency of the deterministic part of the signal
%            blurried in a white gaussian noise.
%            L must be an integer               (default : 1).
%        TRACE : if nonzero, the progression of the algorithm is shown
%                                        (default : 0).
%        FNORMHAT : Output (normalized) instantaneous frequency.
%   FREQ_INST: Output actual instantaneous frequency(Hz)(non normalized)
%        T : Time instants.


%
%        ------------------- CONFIDENTIAL PROGRAM --------------------
%        This program can not be used without the authorization of its
%        author(s). For any comment or bug report, please send e-mail to
%        f.auger@ieee.org

if (nargin == 0),                             %与原程序有所修改
error('At least two parameter required');   
end;
if (nargin == 1),                             %与原程序有所修改
error('At least two parameter required');   
end;
[xrow,xcol] = size(x);
if (xcol~=1),
    if(xrow==1)
        x=x';
        x=conj(x);                              %原程序有错
    else
         error('X must have only one column');
    end
end

[xrow,xcol] = size(x);                       %与原程序有所修改

if (nargin == 2),                            %与原程序有所修改
t=2:xrow-1; L=1; trace=0.0;
elseif (nargin == 3),
L = 1; trace=0.0;
elseif (nargin == 4),
trace=0.0;
end;

if L<1,
error('L must be >=1');
end
[trow,tcol] = size(t);
if (trow~=1),
error('T must have only one row');
end;

if (L==1),
if any(t==1)|any(t==xrow),
  error('T can not be equal to 1 neither to the last element of X');
else
  fnormhat=0.5*(angle(-x(t+1).*conj(x(t-1)))+pi)/(2*pi);
  freq_inst=fnormhat*freq_sampling;                           %增加的部分程序
end;
else
H=kaytth(L);
if any(t<=L)|any(t+L>xrow),
  error('The relation L<T<=length(X)-L must be satisfied');
else
  for icol=1:tcol,
   if trace, disprog(icol,tcol,10); end;
   ti = t(icol); tau = 0:L;
   R = x(ti+tau).*conj(x(ti-tau));
   M4 = R(2:L+1).*conj(R(1:L));
   
   diff=2e-6;
   tetapred = H * (unwrap(angle(-M4))+pi);
   while tetapred<0.0 , tetapred=tetapred+(2*pi); end;
   while tetapred>2*pi, tetapred=tetapred-(2*pi); end;
   iter = 1;
   while (diff > 1e-6)&(iter<50),
    M4bis=M4 .* exp(-j*2.0*tetapred);
    teta = H * (unwrap(angle(M4bis))+2.0*tetapred);
    while teta<0.0 , teta=(2*pi)+teta; end;
    while teta>2*pi, teta=teta-(2*pi); end;
    diff=abs(teta-tetapred);
    tetapred=teta; iter=iter+1;
   end;
   fnormhat(icol,1)=teta/(2*pi);
  end;
end;
end;
回复 支持 0 反对 1

使用道具 举报

发表于 2008-12-18 20:48 | 显示全部楼层
你只要把instfreq.m这个文件拷到EMD.m所在的文件夹,问题就解决了。
发表于 2009-4-14 15:26 | 显示全部楼层
本帖最后由 wdhd 于 2016-9-21 11:29 编辑
原帖由 gaojunwxws 于 2008-12-17 21:50 发表
function [freq_inst,fnormhat,t]=instfreq(x,freq_sampling,t,L,trace);
%INSTFREQ Instantaneous frequency estimation.
%        [FNORMHAT,T]=INSTFREQ(X,T,L,TRACE) computes the instantaneous
%        frequency of th ...

你的这个函数怎么用呢?和原来的那个程序有点不一样。
发表于 2009-9-15 11:00 | 显示全部楼层

回复 沙发 gaojunwxws 的帖子

程序运行时候报错了,??? Error using ==> instfreq
T can not be equal to 1 neither to the last element of X

Error in ==> hhspectrum at 45
  f(i,:)=instfreq(an(i,:)',tt,l)';

Error in ==> Untitled at 18
[A,f,tt]=hhspectrum(imf);  麻烦看看是怎末一回事呢?
发表于 2009-9-15 11:06 | 显示全部楼层

回复 楼主 lingyunzhi 的帖子

我的问题跟你的一样,同问:你找到问题所在了吗?我有把别人贴出的程序放到EMD中,但是一样的报错。
发表于 2010-10-6 19:27 | 显示全部楼层
回复 aprilcat 的帖子

我也同样的错误,怎么回事啊
发表于 2010-10-13 10:08 | 显示全部楼层
去下载一个时频工具箱装上就可以了。
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-6-6 03:16 , Processed in 0.108576 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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