Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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)

graph.PNG
 

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);
 
  • Like
Reactions: Pri6

    Pri6

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top