Add Radar simulation
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
% https://blog.csdn.net/Xiao_Jie123/article/details/115296169
|
||||
|
||||
clc; clear;
|
||||
|
||||
global c T_r F_s k lambda
|
||||
|
||||
%% 加载数据
|
||||
% IF_mat = cell2mat(struct2cell(load('Ego_vehicle.mat','IF_mat')));
|
||||
IF_mat = cell2mat(struct2cell(load('Ego_vehicle_ksy.mat','IF_mat')));
|
||||
[N, M] = size(IF_mat);
|
||||
%% 生成窗
|
||||
range_win = hamming(N); %生成range窗
|
||||
doppler_win = hamming(M); %生成doppler窗
|
||||
%% range fft
|
||||
for i = 1:1:N
|
||||
temp = IF_mat(i,:) .* range_win';
|
||||
% temp_fft = fftshift(fft(temp,N));
|
||||
temp_fft = fft(temp,N);
|
||||
IF_mat(i,:) = temp_fft;
|
||||
end
|
||||
%% doppler fft
|
||||
for j = 1:1:M
|
||||
temp = IF_mat(:,j) .* doppler_win;
|
||||
temp_fft = fftshift(fft(temp,M));
|
||||
IF_mat(:,j) = temp_fft;
|
||||
end
|
||||
%% 画图
|
||||
figure;
|
||||
distance_temp = (-N/2:N/2 - 1) * F_s * c / N / 2 / k;
|
||||
% distance_temp = (0:N - 1) * F_s * c / N / 2 / k;
|
||||
speed_temp = (-M / 2:M / 2 - 1) * lambda / T_r / M / 2;
|
||||
[X,Y] = meshgrid(distance_temp,speed_temp);
|
||||
mesh(X,Y,(abs(IF_mat)));
|
||||
xlabel('距离(m)');
|
||||
ylabel('速度(m/s)');
|
||||
zlabel('信号幅值');
|
||||
title('2维FFT处理三维视图');
|
||||
|
||||
figure;
|
||||
speed_temp = -speed_temp;
|
||||
imagesc(distance_temp,speed_temp,abs(IF_mat));
|
||||
title('距离-多普勒视图');
|
||||
xlabel('距离(m)');
|
||||
ylabel('速度(m/s)');
|
||||
Reference in New Issue
Block a user