how do I extract the graph so that the x-axis becomes a frame

1 回表示 (過去 30 日間)
지원 전
지원 전 2023 年 3 月 16 日
回答済み: Varun 2023 年 4 月 19 日
1.present situation
Figure 0 is a numeric representation of the bin file. Based on the number of cells, we extracted the graph of Fig.1 by frame (code is below).
For example, suppose it's a 32 frame, we've written code to have 32 pictures like this. in other words, a graph with velocity information is drawn for each frame.
2. what I want
Like the graph in Figure 2., I want to show all the velocities of each frame in a single graph.
3. my code
What code should I add to represent the x-axis as a frame (time) as shown in Figure 2?
%% ADC data per frame
i = 0; % For recording the number of times
numframe = 32;
for n=1:numframe
A = adcData(1, (32768*(n-1)+1):numADCSamples*numChirps/numframe*n);
A = reshape(A, [numADCSamples, numChirps/numframe]); % column-numADCSample row-numChirps
% return receiver data % adcData FFT
radar_data_1dFFT = fftshift(fft(A,[], 2));%.*window_1D
fftSize1D = size(radar_data_1dFFT);
radar_data_2dFFT = fft(radar_data_1dFFT,[], 1);%.*window_2D
fft_out = radar_data_2dFFT;
%fft_out = fftshift(fft_out);
fft_out = 20*log10(abs(fft_out));
%% 횟수 기록
i = i+1;
%% Obtain range-velocity map after performing 2d fft
% range
c = 3e8; % speed of light
s = 29.9817e15; % slope of chirp signal
Fs = 7675e6;
fb = Fs/(numADCSamples-1)*(0:(numADCSamples-1)); % beat frequency
range = (c*fb)/(2*s);
% velocity
lamda = 5e-3; % Tx signal length
PRT = 310.8e-6; PRF = 1/PRT; % PRF = Pulse Repitition Frequency, PRT = ..Time
velocity = PRF/(numChirps/numframe-1)*(0:(numChirps/numframe-1))*lamda/4*pi;
% plot
figure; % two dimension
imagesc(-velocity, -range ,abs(fft_out));
% save image
myfilename = sprintf('Going%d.png', i);
saveas(gcf, myfilename)

回答 (1 件)

Varun 2023 年 4 月 19 日
As per my understanding, you want to put together all the frames generated in the loop side-by-side in the same figure. Since, you are saving all the plots generated as image files (.png), you can use the imtile function to arrange the plots frame by frame. You can customise the grid size and other parameters to get the figure you need. You may find the documentation for ‘imtile’ at:
Hope this helps!


Help Center および File ExchangeAnnotations についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by