I am trying to translate a signal to baseband by multiplying by the complex exponential. The issue is when I do the calculation in MATLAB the signal seems to disappear. I originally thought the signal was moved out of the axis scale but even when shifting down to a few kHz the signal disappears.

Here is my Matlab code. I first generate a noisy signal at 26kHz as shown in the first subplot. Then I filter it using an FIR filter and try to shift it using the complex exponential.

Is the issue that I am shifting the signal outside the passband? If so, how would I shift t to baseband after the filter without losing signal amplitude?

enter image description here

close all

srate = 250e3;
nyquist = srate/2;
npnts = srate*5;    %generate number of points for 5 seconds of sampling
time = (0:npnts-1)/srate; 

% simulate brownian noise
bnoise = 30*cumsum(randn(1,npnts)); 
% simulate white noise 
wnoise = 50*randn(1,npnts);

% vector of frequencies in kHz
hz = linspace(0,srate/2,floor(npnts/2)+1)/1e3;  %go from 0 to nyquist, frequency resolution is defined by last term

% signal settings 
freq1 = 26e3;
ampl = 1;
Y = ampl*sin(2*pi*freq1*time)+bnoise+wnoise;

xlimits = [20e3/1e3 120e3/1e3];

% amplitude spectrum via Fourier transform
signalX = fft(Y);
signalAmp = 2*abs(signalX)/npnts;   %need to multiply by 2 to recover amplitude from negative freqs
                                    % divide by npnts to normalize fourier coefficients 
title('Frequency Response')

% FIR filter specs
passband = [25e3 27e3];
transw = 0.01;   %how the filter's edges taper
test_order = 13;

order = round(test_order*srate/passband(1)); % define the number of time points for the filter kernel

shape = [ 0 0 1 1 0 0 ];    %FIR shape

%define frequency shape of the FIR shape, firls function requires
%frequencies to go from 0 to 1
frex = [0 passband(1)-passband(1)*transw passband passband(2)+passband(2)*transw nyquist]/nyquist;

%define kernel
filter_kernel = firls(order, frex, shape);

% power spectrum of filter kernel
filtkernX = abs(fft(filter_kernel,npnts)).^2;

% initialize filtered signal matrix 
yFilt = zeros(1,length(Y));

% set initial conditions zi for filter function  
lead_dim = (max(length(1),length(filter_kernel))-1);
zi = zeros(1,lead_dim)';

% apply the filter to the data
    [yFilt, zf] = filter(filter_kernel, 1, Y, zi, 2);
    signalX3 = fft(yFilt);
    signalAmp3 = 2*abs(signalX3)/npnts;

title('Filtered Subband')

hold on 
plot([0 passband(1) passband passband(2) nyquist]./1e3,[0 0 1 1 0 0],'ro-','linew',2,'markerfacecolor','w')
ylabel('Filter gain')
title('Frequency response of filter (fir1)')

%shift the signal to baseband 
    cmpexp = exp(-1i*(10e3)*2*pi*time);
    shifted = zeros(1,length(Y));
    shifted = cmpexp.*yFilt;
    signalX4 = fft(shifted);
    signalAmp4 = 2*abs(signalX4)/npnts;

xlabel('Frequency (kHz)')
title('Filtered and Shifted Subbands')

1 Answer 1


Brown noise has theoretically infinite power at DC, so you will a see a huge amount of low frequency energy and a big DC offset in your signal. The FIR filter isn't good enough to really knock this down.

So your signal consists of three main frequency components. -26kHz, 0 Hz, and +26kHz. You shift the whole thing by -10 kHz and so you get -36kHz, -10kHz, and +16kHz which is exactly what you see if you look at the entire FFT of the shifted signal.

enter image description here

  • $\begingroup$ I assume you meant +26kHz... but I guess there is nothing wrong with my code then. I just need to look at the entire freq range and multiply by the center freq (26kHz) of the signal to shift to baseband. I was using 10kHz only as a test $\endgroup$ Apr 10, 2023 at 14:30
  • $\begingroup$ Yes, +26kHz. I still think your brown noise generation is problematic. The energy of the brown noise is enormous and it's dependent on your signal length. The rest looks fine to me (if you want a complex signal, that is). $\endgroup$
    – Hilmar
    Apr 10, 2023 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.