Re: A matrix-vector problem
Brett Green <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <CANkKLCdmEmD2=EbzUJrh83ngyuWZWMSv9ctnUpK9NRcVOQs9aw@mail.gmail.com> |
On Sat, Feb 13, 2021 at 11:38 AM Alan Turing via Help-octave < [email protected]> 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 > > > See the documentation for max <https://octave.sourceforge.io/octave/function/max.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)