Maximun Value in Vectors

2 次查看(过去 30 天)
Virginia
Virginia 2013-6-23
Hello!, I have a column vector that has a variable, I mean this vector has a function that depends on t (time). I want to give a range of time for example 1 to 10 sec and obtain the maximun value of each row and the time it happens.
For example in time=0 sec a=
1
20
15
4
in time 5 sec a=
10
11
2
13
So the maximun value of row(1) is 10 in time 5 seg The maximun value of row(2) is 20 in time 0 seg The maximun value of row(3) is 15 in time 0 seg The maximun value of row(4) is 13 in time 5 seg
Also, the time interval (I mean 0 to 10 sec), has to be introduced by user when the code asks for it.
Hope you can help me!

回答(1 个)

Matt J
Matt J 2013-6-23
This will take the maximum across the rows of "data"
[maxval,maxloc]=max(data,[],2)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by