# Frequency Translation after FIR Filter

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?

%%
clc,clear
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

figure;
subplot(4,1,1)
stem(hz,signalAmp(1:length(hz)))
title('Frequency Response')
ylabel('Amplitude')
xlim(xlimits)

% 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

% apply the filter to the data
[yFilt, zf] = filter(filter_kernel, 1, Y, zi, 2);

signalX3 = fft(yFilt);
signalAmp3 = 2*abs(signalX3)/npnts;

subplot(4,1,2)
stem(hz,signalAmp3(1:length(hz)))
ylabel('Amplitude')
xlim(xlimits)
title('Filtered Subband')

subplot(4,1,3)
plot(hz,filtkernX(1:length(hz)),'-','linew',2,'markersize',1)
hold on
plot([0 passband(1) passband passband(2) nyquist]./1e3,[0 0 1 1 0 0],'ro-','linew',2,'markerfacecolor','w')
xlim(xlimits)
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;

subplot(4,1,4)
stem(hz,signalAmp4(1:length(hz)))
ylabel('Amplitude')
xlim(xlimits)
xlabel('Frequency (kHz)')
title('Filtered and Shifted Subbands')