help-octave
[Top][All Lists]

## Re: A matrix-vector problem

 From: Brett Green Subject: Re: A matrix-vector problem Date: Sat, 13 Feb 2021 12:43:42 -0500

On Sat, Feb 13, 2021 at 11:38 AM Alan Turing via Help-octave <help-octave@gnu.org> 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

--
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)