How to plot a adc_data.bin signal and it's fft?

15 views (last 30 days)
I have a adc.bin file from a radar. With a code i have restructured the data into a 4 to 524288 complex double matrix (4 receiver).
Is it possible to plot this data against time? My attempt was not very succesful.
How do i get the fft of this signal?
current code:
%%% Thisscriptis usedto readthe binaryfileproducedby the TSW1400
%%% and MmwaveStudio
%%% Commandto run in MatlabGUI - readTSW16xx('<ADC capturebin file>')
function[retVal]= readTSW16xx(fileName)
%% globalvariables
% changebasedon sensorconfig
%----------------------------------------------------------------------
numADCSamples= 256;% numberof ADC samplesper chirp
numADCBits= 16; % numberof ADC bitsper sample
numRX= 4; % numberof receivers
numLanes= 2; % do not change.numberof lanesis always2
isReal= 0; % set to 1 if realonlydata,0 if complexdata0
%-----------------------------------------------------------------------
fileName = 'C:\ti\mmwave_studio_02_01_00_00\mmWaveStudio\PostProc\adc_data.bin';
%% readfile
% read.binfile
fid = fopen(fileName,'r');
adcData= fread(fid,'uint16');
% compensate for offset binary format
adcData= adcData- 2^15;
% % if 12 or 14 bitsADC per sample compensate for sign extension
if numADCBits ~= 16
a= 2^(numADCBits-1)-1;
adcData(adcData> a)= adcData(adcData> a)- 2^numADCBits;
end
fclose(fid);
% get total file
fileSize = size(adcData,1);
test= adcData;
%% organize data by LVDSlane
% for real data
if isReal
adcData= reshape(adcData,numLanes*2,[]);
% seperate each LVDS lane in to rows
LVDS= zeros(2,length(adcData(1,:))*2);
% interleave the two sample sets from each lane
LVDS(1,1:2:end-1)= adcData(1,:);
LVDS(1,2:2:end)= adcData(2,:);
numChirps= fileSize/2/numADCSamples/numRX;
if numRX> 1
LVDS(2,1:2:end-1)= adcData(3,:);
LVDS(2,2:2:end)= adcData(4,:);
LVDS= reshape([LVDS(1,:);LVDS(2,:)],size(LVDS(1,:),1),[]);
numChirps= fileSize/2/numADCSamples/numRX;
end
LVDS= LVDS(1,:)
% for complex data
else
adcData= reshape(adcData,numLanes,[]);
% seperate each LVDS lane in to rows
LVDS= zeros(1,fileSize/2);
LVDS(1,:)= adcData(1,:) + sqrt(-1)*adcData(2,:);
numChirps= fileSize/2/numADCSamples/numRX;
end
%% organize data by receiver
adcData= zeros(numRX,numChirps*numADCSamples);
LVDS= reshape(LVDS,numADCSamples*numRX,numChirps);
LVDS= LVDS.';
for row = 1:numRX
for i = 1: numChirps
adcData(row,(i-1)*numADCSamples+1:i*numADCSamples)= LVDS(i,(row-1)*numADCSamples+1:row*numADCSamples);
end
end
%% return receiver data
retVal= adcData;

Answers (0)

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!