pkg load signal % sampling freq fs = 256e3; % time t = 0:1/fs:1; % test signal x = 10*sin(2*pi*1e3*t) + 0.1*sin(2*pi*2e3*t) + sin(2*pi*3e3*t) + 0.5*randn(size(t)); % center and span of the fft center = 2e3; span = 4e3; % complex down conversion #loi = cos(2*pi*center*t); #loq = sin(2*pi*center*t); ##xc = loi.*x + i*loq.*x; xc=hilbert(x); % lowpass [b,a]=butter(5,center/128e3); #xc = filter(b,a,xc); % decimation xc = xc(1:256e3/span:end); % take only 1024 samples xc = xc(1:1024); f = linspace(center-span/2, center+span/2, 1024); plot(f, (20*log10(abs(fft(xc))))) grid on