|
% 1-D Hilber transform and amplitude demodulation
% writen by Lu, 7/28/2015
clc; clear all; close all;
% setup
X=linspace(0,1,1024);
ac=255/2; dc=ac;
Y=255/2+(255/2)*sin(2*pi*5*X);
Yac=Y-dc;
% Hilbert transfrom (-90 degree phase shifter), x=xr+i*xi % G(k)=F(k)*H(k), H(k)=-i*sgn(k); k>0, sgn=1 and k<0, sgn=-1 % If xr=b*cos(phai), then xi=b*sin(phai); % If xr=b*sin(phai), then xi=-b*cos(phai); % Transfrom steps: x=ac+dc*b*cos(phai) % 1) fft on x, F=fft(x) % 2) frequency processing: F(1)=0, remove dc component; % 2) F(p+1:end)=F(p+1:end)*(-1), p=ceil(length(F)/2), % 2) that is, mutiply the negative frequencies by -1 % 3) apply ifft, the obtained signal is i*xi % Those can easily proofed by inspection of dirac functions forms of % Fourier transfrom of cosine and sine functions Y_fft=fft(Y);
P=ceil(length(Y)/2); % note how fftshift/ifftshift works
Y_fft(1)=0;
Y_fft(P+1:end)=Y_fft(P+1:end)*(-1);
Yht=ifft(Y_fft);
Yreal=real(Yht);
Yimag=imag(Yht);
% Amplitude demodulation
% Amp=abs(Yac+Yht);
Amp=sqrt(Yac.^2+Yimag.^2);
figure; plot(X, Yreal,'r-',X,Yimag,'g-','linewidth',2);
hold on;
plot(X,Yac,'b-','linewidth',2);
plot(X,Amp,'k-','linewidth',2);
xlabel('spatial distance'); ylabel('intensity');
title('Hilbert transform based demodulation');
%Comments:
% The 1-D transfrom can be extended to 2-D space by line by line processing
% But note boundary effect esists in the hilbert-transform based demodulation
% Further cutoff should be considered to mitigate the boundary effects
% compare with spiral-phase-operator based transfrom (vortex transform)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-1 00:25
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社