How to plot the actual frequency range for the FFT plot?
21 次查看(过去 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,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1357733/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1357738/image.png)
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?
0 个评论
回答(2 个)
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)
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.
.
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
is way too small relative the base sinusoidal frequency
fc - B/2
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
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 Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!