Frequency Translation in MATLAB

Status
Not open for further replies.

Pri6

Newbie level 6
Joined
May 4, 2017
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
101
I have to design a generic baseband filter. I have a C++ code which gives me filter coefficients based on the input parameters such as no. of taps, no. of bands, band edges, amplitudes and weights(code uses remez exchange algorithm).
I import the filter coefficients in MATLAB, do fft and plot the graph of it. I have to shift the graph such that its center is the center of baseband. I know that if I multiply filter coefficients with an exponential function and then do fft the resulting frequency domain output will be shifted in frequency [x(t)*e^j2*pi*f0 ==> X(f-f0)]. So to verify this I multiplied my filter coefficients with an exponential function and plotted it. But there is no change in the graph at all. Could someone tell me what am I doing wrong? I am posting the code and graph for reference.

Code:-
(b is the vector containing filter coefficients)
N = length(b);
fo = 200;
b1 = b.*exp(1j*2*pi*fo);
bins = [0:N-1];
bins_hz = bins*fs/N;
y = abs(fft(b1));

subplot(2,2,1)
plot(bins_hz, abs(fft(b)))
subplot(2,2,2)
plot(bins_hz, y)

 

Hey,
you are multiplying all samples with a constant phase instead of linear phase to get shift in frequency domain.
you should do
b1 = b.*exp(1j*2*pi*fo*(1:N)/N);
 
Reactions: Pri6

    Pri6

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…