MATLAB的實(shí)現(xiàn)Hilbert變換程序如下:
N=20; n=0:N-1;
xn=cos(0.2*pi*n);
hxn=hilbert(xn);
%part 1
%compare FFT[x(n)] and FFT[Hilbert[x(n)]]
Xk=fft(xn);
hXk=fft(hxn);
aXk=abs(Xk);
ahXk=abs(hXk);
pXk=phase(Xk);
phXk=phase(hXk);
k=0:N-1;
subplot(2,2,1),stem(k,aXk)
xlabel('k');
title('amplitude of FFT[x(n)]');
subplot(2,2,2),stem(k,pXk)
xlabel('k');
title('phase of FFT[x(n)]');
subplot(2,2,3),stem(k,ahXk)
xlabel('k');
title('amplitude of Hilbert[x(n)]');
subplot(2,2,4),stem(k,phXk)
xlabel('k');
title('phase of FFT[Hilbertx(n)]');
%part 2
%method:if sum(xn.*hxn) is closely 0
add=sum(xn.*hxn)
%part 3:compare expansion function yhilbert.m and hilbert.m
y=hilbert(xn);
hxn
sn=sin(0.2*pi*n)
yn=imag(y)
本文來(lái)自: 高校自動(dòng)化網(wǎng)(Www.) 詳細(xì)出處參考(轉(zhuǎn)載請(qǐng)保留本鏈接):http://www./html/matlab/14925_2.html |
|
來(lái)自: cici0086 > 《我的圖書(shū)館》