Processing UAV Signals Using Matlab Based on RFUAV System
Tutorial Introduction
In communication security and spectrum monitoring, drone identification systems based on radio frequency (RF) data have been widely studied. The RFUAV project analyzes and processes the IQ signals of drones through spectrum analysis and signal-to-noise ratio estimation. This project uses MATLAB on the OpenBayes platform to implement the key processes of RFUAV, completing tasks such as .mat → .dat data conversion, spectrum visualization, SNR estimation, and segment cropping.
This tutorial is based on the paper "RFUAV: A Benchmark Dataset for Unmanned Aerial Vehicle Detection and Identification"To reproduce the data processing, since the original data is not available, the data set here uses the data from the IDLab platform as a data processing demonstration. Because the complete data set is too large, this tutorial only analyzes part of the data.
Theoretical basis
Signal format
- IQ Data: The complex form is expressed as x(t)=I(t)+jQ(t), which contains amplitude and corresponding information.
- .mat data: The original file is stored in the IQ_samples field.
- .dat data: float32 format, storing I and Q alternately.
Analysis Process
- Loading IQ data
- Convert to .dat format
- Plotting the spectrum using FFT
- Estimating SNR using power spectral density and frequency band partitioning
- Segment cropping for model training
Procedure
1. Preparation for operation
After cloning and starting the container, "Open Workspace" → Open "Matlab" on the startup page

2. Data conversion
2.1 Data conversion algorithm (main_convert.m)
% 设置路径
mat_path = 'lorasf12_g0.0dB_att24dB_freq867.4MHz_4.mat'; % 当前目录
dat_path = 'AVATA_1.dat'; % 输出 .dat 文件名
% 加载 .mat 文件
mat_data = load(mat_path);
disp(fieldnames(mat_data)) % 显示变量名,确认变量存在
% 正确提取变量
iq = mat_data.IQ_samples;
% 转换为 float32 类型,并交替存储 I 和 Q
iq_float32 = single([real(iq(:)).'; imag(iq(:)).']); % 交错排列为 I1 Q1 I2 Q2 ...
% 保存为 .dat 文件
fid = fopen(dat_path, 'w');
fwrite(fid, iq_float32, 'float32');
fclose(fid);
fprintf('转换完成,.dat 文件保存至: %s\n', dat_path);
2.2 Data conversion implementation
run('main_convert.m')
Generate the AVATA_1.dat file on the left

3. Signal processing and spectrum generation
3.1 Code implementation (main.m)
% main.m
clc; clear;
addpath('tools'); % 添加工具函数路径
% 参数设置
data_path = 'AVATA_1.dat'; % 替换为实际上传的文件路径
fs = 100e6; % 采样率
nfft = 512; % FFT 点数
duration = 0.1; % 时长 0.1s
datatype = 'float32';
% 频谱图显示
fprintf('>>> 可视化频谱图\n');
fig = check(data_path, nfft, fs, duration, datatype);
saveas(fig, 'spectrum_AVATA_1.png');
% 读取 IQ 数据
fid = fopen(data_path, 'rb');
dataIQ = fread(fid, 'float32');
fclose(fid);
% 信噪比估计
fprintf('>>> 信噪比估计\n');
bw = 2e6;
[idx1, idx2, idx3, idx4, f1, f2] = positionFind(dataIQ, fs, bw, nfft);
snr_val = snrEsti(dataIQ, fs, nfft, f1, f2, idx1, idx2, idx3, idx4);
fprintf('Estimated SNR: %.2f dB\n', snr_val);
% 分段裁剪
fprintf('>>> 开始数据分段...\n');
rawdata_crop(data_path, 2, fs); % 每段 2 秒
3.2 Signal processing results and spectrum diagram

4. Other .mat file processing
You can change the mat_path file path in main_convert.m to the file you need to process
