A matrix-vector problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A matrix-vector problem

Octave - General mailing list
Good Evening. I am currently working on a project in which I have developed a
matrix M (12, 10), with each row's values representing force values in
Newtons, except the last row, which is filled with angle values (in deg).
Each column represents a specific angle and the force values I have there.
What I want to do now is write a script which tells me the max of each force
(essentially the maximum value of each row of matrix M), and at which angle
that maximum happens. In other words, I need to calculate which column has
the maximum value for each row (hence for each force), and finally the value
of the bottom row at which that max appears? I have already developed the
part which calculates the max of the forces, I only need to find the
corresponding angle. I hope my explanation is clear. Any help? Thanks in
advance.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: A matrix-vector problem

BGreen


On Sat, Feb 13, 2021 at 11:38 AM Alan Turing via Help-octave <[hidden email]> wrote:
Good Evening. I am currently working on a project in which I have developed a
matrix M (12, 10), with each row's values representing force values in
Newtons, except the last row, which is filled with angle values (in deg).
Each column represents a specific angle and the force values I have there.
What I want to do now is write a script which tells me the max of each force
(essentially the maximum value of each row of matrix M), and at which angle
that maximum happens. In other words, I need to calculate which column has
the maximum value for each row (hence for each force), and finally the value
of the bottom row at which that max appears? I have already developed the
part which calculates the max of the forces, I only need to find the
corresponding angle. I hope my explanation is clear. Any help? Thanks in
advance.

--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




Since the column M(:,1) is the force column, you can find the maximum in that column and the corresponding angle as follows:

[Fmax, Findex] = max( M(:,1) )
angle_Fmax = M(Findex,10)



Reply | Threaded
Open this post in threaded view
|

Re: A matrix-vector problem

Octave - General mailing list
Many thanks, you have been very helpful.




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html