+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Newbie level 6
    Points: 152, Level: 2

    Join Date
    May 2017
    Posts
    12
    Helped
    0 / 0
    Points
    152
    Level
    2

    Frequency Translation in MATLAB

    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)

    Click image for larger version. 

Name:	graph.PNG 
Views:	1 
Size:	15.3 KB 
ID:	142062

    •   Alt27th October 2017, 10:28

      advertising

        
       

  2. #2
    Member level 5
    Points: 1,546, Level: 8

    Join Date
    Aug 2011
    Posts
    81
    Helped
    13 / 13
    Points
    1,546
    Level
    8

    Re: Frequency Translation in MATLAB

    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);


    1 members found this post helpful.

--[[ ]]--