How to find when the maximum occurs
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Cam B
el 21 de Mzo. de 2022
Comentada: Zach Ruble
el 27 de Sept. de 2023
I am trying to find the time, t, at which the maximum value occurs at. The variable 'maxgiven' displays a 1x5 vector of the maximum values for a set of data. Trying to find the time, t, at which each maximum value is occuring at, which would be labeled 'tmaxgiven'. The test case written belows displays an empty vector. Please use the variable names provided.
maxgiven = [max(y1(:,1)); max(y2(:,1)); max(y3(:,1)); max(y4(:,1)); max(y5(:,1))]
%test case
tmaxgiven = find(t1 == max(y1(:,1)))
0 comentarios
Respuesta aceptada
Arif Hoq
el 21 de Mzo. de 2022
time=(1:5)';
val1=[10 13 45 23 11]';
val2=[56 23 45 89 23]';
val3=[90 78 12 45 22]';
matrix=[time val1 val2 val3]
[M I]=max(matrix(:,2:end))
I is your time(row) index
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!