# How do I generate micro Doppler data and graph (stft) from the given data?

79 views (last 30 days)
Annie on 8 Apr 2024
Answered: Garmit Pant on 19 Apr 2024
I have a radar and collect data like this : I'm using a Ti mmWave radar
• RangeDopplerResponse outputs as a 256 by 16 matrix (Power in db)
• RangeGrid outputs as a 1 by 256 matrix (Values of 0 to 12 as a measure of distance)
• DopplerGrid outputs as a 1 by 16 matrix ( Values of -1 to 1 in m/s)
• For a given value from the DopplerGrid and the RangeGrid, a RangeDopplerResponse value is produced.
My code is like so :
Graphs 1- 3d plot
%total_data = importdata("SIN.mat")
total_data(total_data > 5) = .8;
% Create coordinate matrices for velocity, range, and frame
[range_indices, doppler_indices, frame_indices] = ndgrid(1:256, 1:16, 1:size(total_data, 3));
range_values = meas.RangeGrid(range_indices);
doppler_values = meas.DopplerGrid(doppler_indices);
%frame_values = frame_collection_times(frame_indices);
%frame_values = frame_collection_times(frame_indices)
% Step 2: Plotting the 3D scatter plot
figure;
h = scatter3(doppler_values(:), range_values(:), frame_indices(:), [], total_data(:), 'filled');
xlabel('Velocity');
ylabel('Range');
zlabel('Frame');
title('Velocity, Range, and Frame');
colorbar;
set(gca,'CLim',[.8 2.6]);
Graph 2- 2d plot (doppler)
average_power = squeeze(mean(total_data, 1));
% Plotting the 2D plot
figure;
imagesc(meas.DopplerGrid, frame_collection_times, average_power');
xlabel('Velocity');
ylabel('Time');
title( 'Time vs Velocity');
colorbar;
set(gca,'CLim',[.8 2.6]);
How would I get micro doppler? I want to perform an stft on the grid but I can't.

Garmit Pant on 19 Apr 2024
Hello Annie
From what I gather, you have collected radar data using the “mmWaveRadar” MATLAB function. You aim to obtain the micro-doppler of your readings and have tried to obtain the Short-Time Fourier Transform (STFT) of the data for the same.
Your approach to obtain the micro-doppler of the data by performing STFT on it is correct. Given that you have extracted the “RangeDopplerResponse” for each frame, you need to perform certain operations before you can obtain the micro-doppler.
The “RangeDopplerResponse” stores the Range Doppler detection matrix. It should be noted that the values of the matrix are the Fast Fourier Transform (FFT) of the response. To perform STFT, first perform Inverse FFT on the data. The resultant data should be analysed by performing the STFT. This can be achieved using the MATLAB function “ifft” as follows:
% Perform inverse FFT on a matrix storing the RangeDopplerResponse
total_data = ifft(rangedopplerresponsematrix);
Given that you are extracting the data for multiple frames, and assuming that the data is stored as 256x16xN matrix containing 'N' “RangeDopplerResponse” matrices, where 'N' is the number of frames, you need to extract the extract time-varying Doppler signals for a given range bin.
% Assuming that the selected range bin is 100 and total_data contains the RangeDopplerResponse for each frame after inverse FFT has been applied.
time_series_doppler = squeeze(total_data(100, :, :));
You can obtain the STFT of this time-varying Doppler signal by using the MATLAB function “stft”. The following code snippet shows how to do so.
% Parameters for STFT
window = hamming(8); % Window function and size, adjust as needed
noverlap = numel(window)/2; % Typically half the window length
nfft = 256; % Number of FFT points, adjust as needed
% Perform STFT on the transpose of time_series_doppler to have time along columns because the MATLAB function expects the input matrix where each column corresponds to a channel.
[S,F,T] = stft(time_series_doppler.', fs, 'Window', window, 'OverlapLength', noverlap, 'FFTLength', nfft);
% Plot the STFT result to visualize the micro-Doppler signature of 1 channel
figure;
surf(T, F, 20*log10(abs(S(:,:,1))), 'EdgeColor', 'none'); % Display in dB for better dynamic range visualization
axis tight; colormap(jet);
xlabel('Time [sec]');
ylabel('Frequency [Hz]');
title('Micro-Doppler Signature for Selected Range Bin');
colorbar;
For further understanding, I suggest you refer to the following MathWorks Documentation:
1. stft” function: https://www.mathworks.com/help/signal/ref/stft.html
Hope you find the above explanation and suggestions useful!

### 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!