Find the maximum of matrix and represent in plots

2 views (last 30 days)
Hey guys, thanks in advance,
I have this code that correlates in time two signals. These correlation is made in a matrix 3199 x 400. The 3199 values are the values of the signals in frequency, and 400 values are positions of a plane, and the values of the signal are different for each column.
I have this example that present the maximum correlation for 1 column(184,85). Made with this code:
maxValue = max(range_compressed_matrix(:));
[rows, columns] = find(range_compressed_matrix == maxValue);
x_max = waypoints(columns);
y_max = time_compression_cut(rows);
y_max= y_max*c;
% Plot the maximum of range compression
figure;
imagesc(1:400,time_compression_cut*c,abs(range_compressed_matrix));
colorbar;
colormap(jet);
hold on
title('Range Compressed Data');
xlabel('Waypoints (m)');
ylabel('Range (m)');
textString3 = sprintf('(%u,%3.f)',x_max, y_max);
text(x_max, y_max,textString3,"Color",'b','FontSize',10);
hold off
shading interp;
My question is, if I have range_compressed_matrix all filled with values, How can I do the same code, so that I can see the maximum value of correlation for all the columns, and representing the value without make a figure too filled with values all across the place.
Basically I want to get the same I did in the figure, but for all the columns, and represent its values,
Thanks

Answers (1)

Animesh
Animesh on 1 Sep 2023
According to my understanding, you want to find the maximum value for each column of ‘range_compressed_matrix’ and plot it in a cleaner way.
To find the maximum value for each column you can use the below mentioned code:
[maxValues, rows] = max(range_compressed_matrix, [], 1);
Here, ‘maxValues’ is the maximum value in each column and ‘rows’ is the index of the maximum value.
One way to enhance the representation of maximum values is by utilizing the 'heatmap' function
To read more about ‘heatmap’, please refer to the following documentation :- https://www.mathworks.com/help/matlab/ref/heatmap.html

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!