how to plot a centralize upconverted signal around the carrier frequency - Matlab

109 Views Asked by At

I have an upconverted signal that is around the carrier frequency fc. I'm trying to plot this signal's FFT but failed to scale the frequency axis correctly as the signal's FFT is centered around the DC. I tried:

f = 1;
fs = 10*f;
t = 0:1/fs:5;
fc = 100;
x = sin(2*pi*f*t);
x_up = x .* exp(1i*2*pi*fc*t);
f_fc = linspace(-fc,fc,length(t));
plot(f_fc,fftshift(abs(fft(x_up))))

How should I scale it correctly? Thanks.

1

There are 1 best solutions below

0
A.B.A On

I found my mistake. The fixes in the code should be:

  1. the sampling frequency should be a multiplication of fc and not f, such as: fs = 2*fc
  2. the scaling of the frequency axis should be: f_fc = linspace(0,2*fc,length(t)) In that way the FFT of the upconversion signal is shown around the carrier frequency fc.