1 Star 0 Fork 0

qiuyueyuan/CSRadar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
readdata.m 2.94 KB
一键复制 编辑 原始数据 按行查看 历史
Alexander Serrano 提交于 2016-04-13 13:05 . Added files via upload
function [ range_profile ] = readdata( filename )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
file = csvread(filename,0,3);
data_test = file(:,[1,2]);%csvread('1127_exp_ch1.csv',0,3);
data_test1 = file(:,[3,4]);%csvread('1127_exp_ch2.csv',0,3);
%% radar parameter
%frequency starts from 2GHz
f0 = 2e9;
%center frequency 3GHz, total bandwidth 2GHz
fc = 3e9;
%speed of light
c = 3e8;
%wavelength at center frequency
lamda = c/fc;
%step frequency 20MHz
delt_f = 20e6;
%for each channel of 1GHz bandwidth, there are 50 steps
N = 50;
%data sampled at 5KHz
fs1 = 5e3;
%sampled period 0.2ms
ts1 = 1/fs1;
%each frequency step duration 1ms, so there are 5 sampled points each pulse
s_num = 5;
%50 steps, 5 points for each step, so there are 250 points in each frame
s_fram = 250.015; %instrument (signal genaretor) as reference
%total time for one frame 50ms
ts2 = ts1*s_fram;
%frame repeated frequency 20Hz
fs2 = 1/ts2;
%In experiment, data were collected for 20s, including 400 frames in total. We use 398 frames.
fram_num = 398;
%start read from this point(excel file), for each step the first two points generated by PLL are not good enough
first_sp = 3;
%for each frequency step, only one sample point is selected
data = zeros(2,N*fram_num);
data1 = zeros(2,N*fram_num);
%% re-order data
%for each frequency step, there are 5 samples, only the 4th sample is used.
%for all 398 frames of channel 1, select the 4 samples for each step and store them
%in matrix data. One column for I and the other column for Q
for cnt = 1:2
for cnt1 = 1:fram_num
data_tem = data_test(round(first_sp+s_fram*(cnt1-1)):round(first_sp-1+s_fram*cnt1),cnt);
for cnt2 = 1:N
data(cnt,cnt2+N*(cnt1-1)) = data_tem(2+round(s_num*(cnt2-1)));
end
end
end
%for all 398 frames of channel 2, select the 4 the sample for each step and store them
%in matrix data1. One column for I and the other column for Q
for cnt = 1:2
for cnt1 = 1:fram_num
data_tem1 = data_test1(round(first_sp+s_fram*(cnt1-1)):round(first_sp-1+s_fram*cnt1),cnt);
for cnt2 = 1:N
data1(cnt,cnt2+N*(cnt1-1)) = data_tem1(2+round(s_num*(cnt2-1)));
end
end
end
%form complex values using I and Q for both channels
%vector size 50*398
data_c_tem = data(1,:)-1i*data(2,:);
data_c_tem1 = data1(1,:)-1i*data1(2,:);
%transform the vectors to matrice, matrice size 50x398
data_c = reshape(data_c_tem,N,[]);
data_c1 = reshape(data_c_tem1,N,[]);
%one channel sweeps from 2-3GHz, the other channel sweeps from 3-4GHz
%combine these two matrice together, the new matrix is 100x398, and the
%frame size is 100 now
data_c = [data_c; data_c1];
%apply hamming window to each frame
N_hamming1 = hamming(N*2)*ones(1,fram_num);
data_c = data_c.*N_hamming1;
%pulse compress
%apply ifft to each frame
%fftshift moves the zero-frequency component to the center of spectrum
ifft_num = 1024*2;
range_profile = ifft(data_c,ifft_num);
range_profile_abs = abs(range_profile);
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qiuyueyuan/CSRadar.git
git@gitee.com:qiuyueyuan/CSRadar.git
qiuyueyuan
CSRadar
CSRadar
master

搜索帮助