?? hilbert_demo.m
字號:
% hilbert_demo.m -- Demonstration of Hilbert transform and an application% to single sideband (SSB) amplitude modulation.%% ELEC 470, Rich Kozick, Spring 1998Ts = 0.05; % Sample spacingFs = 1/Ts; % Sampling frequencyt= -5:Ts:5; % Sample timesg = sinc(t); % Time signalN = 2^13; % Number of samples in FFTG = fftshift(fft(g, N));f = (-(N/2):(N/2-1))/N*Fs;figure(1)subplot(211)plot(t,g)title('g(t) = sinc(t)');subplot(212)plot(f,abs(G))title('Amplitude of FFT of g(t)')gplus = hilbert(g); % Hilbert transform is in imaginary part of gplusghat = imag(gplus);Gplus = fftshift(fft(gplus, N));Ghat = fftshift(fft(ghat, N));figure(2)subplot(211)plot(t,ghat)title('Hilbert transform of g(t) = sinc(t)');subplot(212)plot(f,abs(Ghat))title('Amplitude of FFT')% Plot the pre-envelopefigure(3)plot(f,abs(Gplus))title('Amplitude of FFT of gplus(t)')% Modulate by cos with frequency 5 Hzxdsb = g .* cos(2*pi*5*t);Xdsb = fftshift(fft(xdsb,N));xssb = g .* cos(2*pi*5*t) - ghat .* sin(2*pi*5*t);Xssb = fftshift(fft(xssb,N));figure(4)subplot(211)plot(t, xdsb)title('Double sideband (DSB) time signal')subplot(212)plot(f, abs(Xdsb))title('Amplitude of FFT of DSB signal')figure(5)subplot(211)plot(t, xssb)title('Single sideband (SSB) time signal')subplot(212)plot(f, abs(Xssb))title('Amplitude of FFT of SSB signal')
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -