FFT size. Determine K so that K is a power of two

조회 수: 5 (최근 30일)
Meshaal Mouawad
Meshaal Mouawad 2019년 11월 4일
편집: Daniel M 2019년 11월 4일
I want to to set The computational frequency resolution a the sampling rate f_s divided by the size of FFT so that I can plot the FFT magnitude
Determine K so that K is a power of two such that the Doppler computational frequency resolution is <= 20 Hz. The computational frequency resolution is the sampling rate divided by the FFT sizeFFT size. Plot the magnitude of the Doppler FFT this is my code
I used the K=size(FFT_y) where delta_f_comp=f_s./K;
but the diminssion is not siffecient or the plot doesnt make since
c=3e8; % speed of light m/s
M=50; % 50 pulses
M_samples=M-1; % M samples
m_th= 0:1:M_samples; % m_th pulses
v=30; % the radial velocity 30m/s
% The radar parameters
f_t= 3e9; % frequency of 3.0 GHz
tau= 1e-6; % a pulse width of 1 microsecond
PRF=4e3; % a PRF of 4.0 KHz
f_s=PRF; % sampling rate
R_0=40e3; % an initial range of R0 = 40 km
A=1; % set A to 1
theta=0; % set theta to 0
%
% calculate
%
PRI=1/PRF; % find PRI
T = PRI; % T = PRI
f_d=(2*v*f_t)/c; % Calculate the Doppler frequency Hz
m_calc=R_0/(v*T); % calculate m in equation 8.2
t_m= m_calc*T; % claculate the transmited times for the m_th pulse
smp_time=1/f_s; % sampling time
t_m_2= m_th*T; % estimate the transmited times for the m_th pulse
%
%
y_1=A*exp(1i*((2*pi*f_d*t_m)+theta)); % Calculate Equation 8.28 the data y
y_2=A*exp(1i*((2*pi*f_d*t_m_2)+theta)); % Estimate Equation 8.28 the data y
% b) Using subplot, plot in subplot(2,1,1) the real portion of y. In subplot(2,1,2), plot the imaginary portion.
% Let the x axis be the time of each pulse number (number pulses from 0 to M?1), in msec. From the
% plot, estimate the Doppler frequency in Hz. Calculate the Doppler frequency and compare. Discuss.
%
subplot(2,1,1);
plot (m_th,real(y_2));
subplot(2,1,2)
plot(m_th,imag(y_2));
%
% c) Perform Doppler processing on the data by taking a K?point FFT of y. Determine K so that K is a power
% of two such that the Doppler computational frequency resolution is <= 20 Hz. The computational
% frequency resolution is the sampling rate divided by the FFT size. Discuss.
%
FFT_y= fft(y_2); % FFT of y_2
%K=sqrt(size(FFT_y));
%size_K=size(FFT_y);
K=size(FFT_y)
delta_f_comp=f_s./K;
%fd_r<=20 % the Doppler computational frequency resolution is <= 20 Hz
%fd_r=smp_r/FFT_s % The computational frequency resolution is the sampling rate divided by the FFT size.
%
% d) Looking for a peak in the FFT, determine the Doppler frequency and the associated bin number in the
% FFT. Estimate the corresponding radial velocity. Determine the associated error in Doppler frequency
% and radial velocity. Plot the magnitude of the Doppler FFT results in dB (use 20log10) vs Doppler
% frequency. Set the y axis limits to ?40 to 40 dB. Discuss your results.
% Hint: To set axis limits, do this after your figure plotting is done
% ax = axis;
% axis([ax(1:2) -40 40]);
% Hint: To determine Doppler bin frequencies, use fftshift after calculating the fft. Then the Doppler
% frequencies for plotting will be
% Yfreq = -PRF/2 + delta_f_comp*(0 : (K-1));
% where delta_f_comp is the K?point FFT computational frequency resolution.
%
radl_v=(c*f_d)/(2*f_t); % Estimate the corresponding radial velocity
plot(delta_f_comp);
plot(real(FFT_y),delta_f_comp);
% Determine the associated error in Doppler frequency and radial velocity
% e) Determine a different positive and a different negative radial velocity that will show up in the same
% FFT bin as the results in part (d). Calculate the corresponding radial velocities. Discuss.

답변 (1개)

Daniel M
Daniel M 2019년 11월 4일
편집: Daniel M 2019년 11월 4일
If you sampling frequency is 4000 Hz, then to get a resolution of 20 Hz you need to take an N-point fft, where N = 4000/20 = 200.
Therefore, it should be
FFT_y = fft(y_2,200)
However, I suggest giving yourself more samples to work with, such as M = 500, if not even more.
Use the second input for the function size to get the value you want. E.g.
K = size(FFT_y,2);
To plot the frequency spectrum properly, you need to create your frequency vector. Then plot against abs(FFT_y). If you do this properly, you will find that the distance between successive data points is 20 Hz.
I suggest going through the first example on the help document for fft to brush up here.

카테고리

Help CenterFile Exchange에서 Detection, Range and Doppler Estimation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by