Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab Index of max value

  1. Apr 14, 2010 #1
    In matlab I have a function which calculates P04 for different values of i,j, and k providing a 8x89x89 matrix of values. I am trying to find the max P04 for each value of i and the corresponding j and k values.

    Here are my for loops:

    for i = 1:1:8;
    M1(i) = 2+0.1*i;
    for j = 1:1:89;
    betaA(j) = j*pi/180;

    for k = 1:1:89;
    betaB(k) = k*pi/180;

    [P04(i,j,k)] = Mach3(M1(i),betaA(j), betaB(k),P01);


    [c(i),I] = max(P04(i,j,k));


    I tried:

    [c(i),I] = max(P04(i,j,k)); (as above)


    [val(i),ind]= max(P04(i,j,k));

    both gave me a max value of zero and did not give me the indices.

    Thanks for any help!
    Last edited: Apr 14, 2010
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Threads - Matlab Index value Date
Python How can I run Python by getting values from Matlab Mar 7, 2018
What is each step of this Matlab program doing? Feb 21, 2018
C/++/# Help with MATLAB code? Feb 9, 2018
Numerical Integration with variable limits MATLAB Jan 15, 2018
Python Array Indexing Nov 8, 2017