Help with index for maximum value
Show older comments
I have an 2D array of data containing product fractions. The column index is associated with a mix ratio. The row index is associated with the product species. I can find the maximum fraction value for a specific species, but the mix ratio (and index) is wrong.
My code gives:
species max-frac mix-ratio
*H2 0.96220083 0.3
H2O 0.6870072 6.5
*OH 0.12253145 8
*O2 0.098079432 10
*H 0.041959177 10
*O 0.023207462 10
HO2 0.00045286 10
H2O2 6.51818E-05 10
O3 1.13457E-06 10
But the correct answer should be:
species max-frac mix-ratio
*H2 0.96220083 0.3
H2O 0.6870072 8
*OH 0.12253145 10
*O2 0.098079432 10
*H 0.041959177 6.5
*O 0.023207462 10
HO2 0.00045286 10
H2O2 6.51818E-05 10
O3 1.13457E-06 10
Any help sorting this out would be much appreciated.
format long g
fracts()
2 Comments
Walter Roberson
on 14 Feb 2024
Edited: Walter Roberson
on 14 Feb 2024
type fracts
Brantosaurus
on 14 Feb 2024
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!