How to plot the actual frequency range for the FFT plot?

24 次查看(过去 30 天)
Suppose I have a complex linear frequency modulated signal, where the frequency of it sweeps from 9.975 GHz to 10.025 GHz with 50 MHz bandwidth and the time duration is 10 . As my sampling frequency is fixed as 51.2 MHz, the FFT plot of the signal is shown below,
The corresponding code is given below.
clear all;
close all;
clc;
%% Signal parameter
c = 3e8; % speed of light
fc= 10e9; % carrier frequency
lambda = c/fc; % wave length
B = 50e6; % bandwidth
Tchirp = 1e-5; % duration time
slope = B / Tchirp; % slope
Nr = 513; % number
fs = (Nr-1)/Tchirp; % sampling frequency
t = linspace(0,Tchirp,Nr);
t(Nr)=[];
St = exp(1j*2*pi*((fc-B/2)*t + (slope*t.^2)/2)); % signal
St_all = [St];
figure; % check fft plot
plot(abs(fft(St_all)));
As my signal ranges from 9.975 GHz to 10.025 GHz. What is the actual frequency for x axis here? Why the FFT plot will include the current period of signal and an adjacent period here? Meanwhile, is there any way to present the whole 50 MHz of signal in a single FFT plot?

回答(2 个)

Star Strider
Star Strider 2023-4-16
One approach —
%% Signal parameter
c = 3e8; % speed of light
fc= 10e9; % carrier frequency
lambda = c/fc; % wave length
B = 50e6; % bandwidth
Tchirp = 1e-5; % duration time
slope = B / Tchirp; % slope
Nr = 513; % number
fs = (Nr-1)/Tchirp; % sampling frequency
t = linspace(0,Tchirp,Nr);
t(Nr)=[];
St = exp(1j*2*pi*((fc-B/2)*t + (slope*t.^2)/2)); % signal
St_all = [St];
L = numel(St_all)
L = 512
FT_St = fft(St_all)/L;
Fv = linspace(0, 1, fix(L/2)+1)*fs/2; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure; % check fft plot
plot(Fv, abs(fft(St_all(Iv))));
xlabel('Frequency (Hz)')
ylabel('Magnitude (units)')
xlim([min(Fv) max(Fv)])
The code for ‘Fv’ originates in the documentation for fft in R2015b. I have used it since, although other ways to calculate the frequency for a one-sided fft that produce the same result are equally valid. The ‘Iv’vector simply make subsequent addressing easier. It is not required.
.
  7 个评论

请先登录,再进行评论。


Paul
Paul 2023-4-16
编辑:Paul 2023-4-16
clear all;
close all;
clc;
%% Signal parameter
c = 3e8; % speed of light
fc= 10e9; % carrier frequency
lambda = c/fc; % wave length
B = 50e6; % bandwidth
Tchirp = 1e-5; % duration time
slope = B / Tchirp; % slope
Nr = 513; % number
fs = (Nr-1)/Tchirp; % sampling frequency
t = linspace(0,Tchirp,Nr);
t(Nr)=[];
St = exp(1j*2*pi*((fc-B/2)*t + (slope*t.^2)/2)); % signal
St_all = [St];
Frequency vector corresponding to St_all
N = numel(St_all);
f = (0:(N-1))/N*fs;
figure; % check fft plot
plot(f,abs(fft(St_all)));
xlabel('Hz')
The reason that all the action is around 4.22e7 Hz is because the sampling frequency
fs
fs = 5.1200e+07
is way too small relative the base sinusoidal frequency
fc - B/2
ans = 9.9750e+09
The 4.22e7 result is the aliased frequency.
If we make the sampling frequency more than two times larger than the base frequency
fs = (fc - B/2)*5 % sampling frequency
fs = 4.9875e+10
then we get this result:
t = linspace(0,Tchirp,round(Tchirp*fs));
St = exp(1j*2*pi*((fc-B/2)*t + (slope*t.^2)/2)); % signal
St_all = [St];
Frequency vector corresponding to St_all
N = numel(St_all);
f = (0:(N-1))/N*fs;
figure; % check fft plot
plot(f,abs(fft(St_all)))
xlabel('Hz')
xlim([9e9 11e9])
xline(fc-B/2,'r')

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by