声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

12
返回列表 发新帖
楼主: 棒棒糖662

[HHT] 请教HHT运行问题

[复制链接]
发表于 2008-3-21 16:00 | 显示全部楼层

回复 14楼 的帖子

function [fnormhat,t]=instfreq(x,t,L,trace);
if (nargin == 0),
error('At least one parameter required');
end;
[xrow,xcol] = size(x);
if (xcol~=1),
error('X must have only one column');
end

if (nargin == 1),
t=2:xrow-1; L=1; trace=0.0;
elseif (nargin == 2),
L = 1; trace=0.0;
elseif (nargin == 3),
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);
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;

咱们版里贴了很多次了。
回复 支持 反对
分享到:

使用道具 举报

 楼主| 发表于 2008-3-21 20:54 | 显示全部楼层
能把您的disp_hht程序发给我看看吗
发表于 2008-3-21 20:57 | 显示全部楼层

回复 17楼 的帖子

你现在出了结果了吗?运行得怎么样了?
 楼主| 发表于 2008-3-21 21:00 | 显示全部楼层
我用了您给的那个instfreq程序还是提示下面的错误信息,看来不是instfreq的问题
??? 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 17
[A,f,tt]=hhspectrum(imf);
发表于 2008-3-21 21:21 | 显示全部楼层
你的hhspectrum这个程序中以下两句是怎么出现的
[im,tt] = toimage(A,f(i,:));
disp_hhs(im,t,-20);
 楼主| 发表于 2008-3-21 21:42 | 显示全部楼层
哦,这两句话是多余的,去掉后的运行结果跟您的结果一样。困扰了我好几天,终于解决了。谢谢谢谢。:victory:
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-9-19 23:39 , Processed in 0.058976 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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