Borrar filtros
Borrar filtros

Find a row of the maximum of a matrix

2 visualizaciones (últimos 30 días)
Miguel Albuquerque
Miguel Albuquerque el 4 de Jul. de 2022
Respondida: Image Analyst el 4 de Jul. de 2022
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 an example for a position of a plane(400,184), where I have this correlation :
As seen in the following figure, and the maximum of that correlation indicated by the data tip.
maximum=(2.82e-7,209962).
In the previous figure, x is a time vector(time_compression) and y is the value of the signal in time(range_compressed).
Basically , I have this matrix(matlab.mat) and I want to find in the entire matrix, the max value of correlation, that in this example is 2.82e-7, and for that value, find the row(time_compression_cut) where this value is, and multiply it by speed of light.
I have this code, but im having troubles finding where this maximum value is for the rows, and then multiply the value of the row by speed of light.
range_compressed_matrix is the entire matrix filled by zeros, with execption of column 184. Waypoints are the positions of the plane, meaning each column of the matrix. time_compression_cut is the values of the rows of range_compressed_matrix.
[x,y] = max(max(max(range_compressed_matrix))); % max value of matrix
x_max = waypoints(y);
y_max = time_compression_cut(x);

Respuesta aceptada

Image Analyst
Image Analyst el 4 de Jul. de 2022
To find the max of the matrix:
maxValue = max(range_compressed_matrix(:))
% To find what row(s) and column(s) this occurs at use find():
[rows, columns] = find(range_compressed_matrix == maxValue)

Más respuestas (1)

dpb
dpb el 4 de Jul. de 2022
I fail to see the point in an array of 1960x400 of which 1959 columns are all identically zero???
That aside, what's the issue in finding the row associated with the maximum, whether the whole array as
>> [mx,imx]=max(range_compressed_matrix,[],'all','linear')
mx =
2.0996e+05
imx =
358760
>> [rmx,cmx]=ind2sub(size(range_compressed_matrix),imx)
rmx =
80
cmx =
184
>> range_compressed_matrix(rmx,cmx)
ans =
2.0996e+05
>>
or just the non-zero column --
>> [mx,rx]=max(range_compressed_matrix(:,184))
mx =
2.0996e+05
rx =
80
>>

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by