The code reads binary data from a DCA1000 sensor and performs processing to obtain a 2D FFT amplitude profile. Here's a breakdown of what the code does:\n\n1. The binary data is read using the function readDCA1000. \n2. Various parameters related to the sensor configuration are defined.\n3. Constants such as the speed of light, sample rate, slope, chirp repetition period, start frequency, etc. are defined. \n4. The range and velocity axes are computed based on the sensor parameters and FFT sizes.\n5. The received data is reshaped into a 256x(frame_cnt) array.\n6. A 1D Hann window is applied to the data, and a 1D FFT is computed.\n7. A 2D FFT is computed on the 1D FFT data, and the result is FFT-shifted.\n8. The amplitude of the 2D FFT is plotted using imagesc. \n9. The velocity resolution and maximum velocity are calculated based on the sensor parameters and displayed.\n\nThe function readDCA1000 reads the binary file generated by the DCA1000 and performs necessary conversions to obtain the complex ADC data.\n\nNote: The code assumes that the binary file matlab_lab_adc_data.bin is present in the current directory.\n\n```matlab\nclear all\ndata=readDCA1000('matlab_lab_adc_data.bin');\n\nframe_cnt=size(data,2)/256/128;\n\nlightSpeed =300000000; \n\nSample_Rate_Hz = 10000000; \n\n\nSlope_Hz = 29982000000000; \n\nChirp_repetition_period_sec = 0.00016; \n\nStart_Frequency_Hz = 77000000000; \n\n\nSamples_Per_Chirp = 540;\nChirps_Per_Frame =128 ; % chris: no of loops in framecfg\n\nTx_antennas = 1;\nlambda =lightSpeed/ Start_Frequency_Hz;\n\nfftSize1D = 256;\nfftSize2D = 128;\nrange_step = ((Sample_Rate_Hz/Samples_Per_Chirp)/Slope_Hz)...\n (lightSpeed/2) * Samples_Per_Chirp / fftSize1D;\n\nvel_step = ((1/(Chirp_repetition_period_secTx_antennas))...\n /Chirps_Per_Frame)(lambda/2) * Chirps_Per_Frame / fftSize2D ; \nvel_axis = (-fftSize2D/2:fftSize2D/2-1)vel_step;\n\nrange_axis = (0:fftSize1D-1)range_step;\ntime_axis = (0:fftSize1D-1)/Sample_Rate_Hz;\nfor i =1:size(data,2)/256\n recv1_data(1:256,i) = data(1,(i-1)256+1:i256);\nend\nfor i=1:frame_cnt\n recv1_frame_data(i,:,:) = recv1_data(:,(i-1)Chirps_Per_Frame+1:iChirps_Per_Frame);\nend\nwindow_1D = hann(256);\nradar_data_1dFFT = fft(squeeze(recv1_frame_data(1,:,:)).window_1D, fftSize1D); \n\nradar_data_2dFFT = fft(radar_data_1dFFT,Chirps_Per_Frame,2);\nradar_data_2dFFT_fftshift = fftshift(radar_data_2dFFT,2);\n% surf(vel_axis, range_axis, abs(radar_data_2dFFT_fftshift));\nimagesc(vel_axis, range_axis, 10log10(abs(radar_data_2dFFT_fftshift)+1));\nview(0,270)\nylabel('range (meters)'); \nxlabel('velocity (metersc)'); \nzlabel('2D FFT Output (dB)');\ntitle('2D FFT amplitude profile')\n \n\n Tc =Chirp_repetition_period_sec;\n Tf = Chirp_repetition_period_secChirps_Per_Frame ;\n \n vel_resolution = lambda /(2 Tf); %input a formula here;\n disp( vel_resolution);\n \n max_vel = lambda/(4 Tc); %input a formula here;\n disp( max_vel);%%% This script is used to read the binary file produced by the DCA1000\n%%% and Mmwave Studio\n%%% Command to run in Matlab GUI -\nreadDCA1000('matlab_lab_adc_data.bin')\nfunction [retVal] = readDCA1000(fileName)\n%% global variables\n% change based on sensor config\nnumADCSamples = 256; % number of ADC samples per chirp\nnumADCBits = 16; % number of ADC bits per sample\nnumRX = 4; % number of receivers\nnumLanes = 2; % do not change. number of lanes is always 2\nisReal = 0; % set to 1 if real only data, 0 if complex data0\n%% read file\n% read .bin file\nfid = fopen(fileName,'r');\nad

DCA1000 Data Processing for 2D FFT Amplitude Profile Visualization

原文地址: https://www.cveoy.top/t/topic/pyLu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录