nihao00000 发表于 2006-6-4 22:24

求助:求用MATLAB实现hilbert变换过程的程序 谁有共享一下哈 谢谢

如题<BR>求用MATLAB实现hilbert变换过程的程序 谁有共享一下哈 谢谢<BR>

bainhome 发表于 2006-6-5 01:49

<P>function x = hilbert(xr,n)<BR>%HILBERTDiscrete-time analytic signal via Hilbert transform.<BR>%   X = HILBERT(Xr) computes the so-called discrete-time analytic signal<BR>%   X = Xr + i*Xi such that Xi is the Hilbert transform of real vector Xr.<BR>%   If the input Xr is complex, then only the real part is used: Xr=real(Xr).<BR>%   If Xr is a matrix, then HILBERT operates along the columns of Xr.<BR>%<BR>%   HILBERT(Xr,N) computes the N-point Hilbert transform.Xr is padded with <BR>%   zeros if it has less than N points, and truncated if it has more.<BR>%<BR>%   For a discrete-time analytic signal X, the last half of fft(X) is zero, <BR>%   and the first (DC) and center (Nyquist) elements of fft(X) are purely real.<BR>%<BR>%   Example:<BR>%   Xr = ;<BR>%   X = hilbert(Xr)<BR>%   produces X= such that Xi=imag(X)= is the<BR>%   Hilbert transform of Xr, and Xr=real(X)=.Note that the last half<BR>%   of fft(X)= is zero (in this example, the last half is just<BR>%   the last element).Also note that the DC and Nyquist elements of fft(X)<BR>%   (10 and -2) are purely real.<BR>%<BR>%   See also FFT, IFFT.</P>
<P>%   Copyright 1988-2002 The MathWorks, Inc.<BR>%   $Revision: 1.10 $$Date: 2002/03/28 17:28:20 $</P>
<P>%   References:<BR>%    Alan V. Oppenheim and Ronald W. Schafer, Discrete-Time<BR>%   Signal Processing, 2nd ed., Prentice-Hall, Upper Saddle River, <BR>%   New Jersey, 1998.<BR>%<BR>%    S. Lawrence Marple, Jr., Computing the discrete-time analytic <BR>%   signal via FFT, IEEE Transactions on Signal Processing, Vol. 47, <BR>%   No. 9, September 1999, pp.2600--2603.</P>
<P>if nargin&lt;2, n=[]; end<BR>if ~isreal(xr)<BR>warning('HILBERT ignores imaginary part of input.')<BR>xr = real(xr);<BR>end<BR>% Work along the first nonsingleton dimension<BR> = shiftdim(xr);<BR>if isempty(n)<BR>n = size(xr,1);<BR>end<BR>x = fft(xr,n,1); % n-point FFT over columns.<BR>h= zeros(n,~isempty(x)); % nx1 for nonempty. 0x0 for empty.<BR>if n&gt;0 &amp; 2*fix(n/2)==n<BR>% even and nonempty<BR>h() = 1;<BR>h(2:n/2) = 2;<BR>elseif n&gt;0<BR>% odd and nonempty<BR>h(1) = 1;<BR>h(2:(n+1)/2) = 2;<BR>end<BR>x = ifft(x.*h(:,ones(1,size(x,2))));</P>
<P>% Convert back to the original shape.<BR>x = shiftdim(x,-nshifts);</P>

nihao00000 发表于 2006-6-5 08:17

<P>谢谢楼上的把要进行hilbert变换的信号代入xr就行吗?我怎么运行不出来 </P>

bainhome 发表于 2006-6-5 12:45

实际这是MATLAB信号工具箱中的官方函数,可以查阅看看它的实例以及官方的在线FAQ,有详细的介绍<BR><a href="http://www.mathworks.com/cgi-bin/texis/webinator/search/?db=MSS&amp;prox=page&amp;rorder=750&amp;rprox=750&amp;rdfreq=500&amp;rwfreq=500&amp;rlead=250&amp;sufs=0&amp;order=r&amp;is_summary_on=1&amp;ResultCount=10&amp;query=hilbert" target="_blank" >http://www.mathworks.com/cgi-bin/texis/webinator/search/?db=MSS&amp;prox=page&amp;rorder=750&amp;rprox=750&amp;rdfreq=500&amp;rwfreq=500&amp;rlead=250&amp;sufs=0&amp;order=r&amp;is_summary_on=1&amp;ResultCount=10&amp;query=hilbert</A>
页: [1]
查看完整版本: 求助:求用MATLAB实现hilbert变换过程的程序 谁有共享一下哈 谢谢