# Finding specific iteration in a triple for loop

8 views (last 30 days)
Jacky Foo on 29 May 2020
Commented: Jacky Foo on 31 May 2020
I am trying to find the corresponding values of alpha, beta and gamma where my P value is maximum. My code is able to get maximum value of P = 1.9956 but I have no idea how to get the corresponding values of alpha, beta and gamma.
I have attached the question and my current code.
Could anyone help me out. Much appreciated.

KALYAN ACHARJYA on 29 May 2020
Edited: KALYAN ACHARJYA on 29 May 2020
You can't do that, as all having different lengths. For equaly vector sie you can get the undex position and find the corresponding vector elements from a,b and y. To compare the corresponding array elements, arrays sizes must be same.
>> length(a)
ans =
151
>> length(b)
ans =
126
>> length(y)
ans =
21
>> length(P)
ans =
399546
I suspect, there may be issue within loop. Look for the solution, how to generate the same length size P, so that you can find the respective array elements from a,b and y, those index values generate the max P.

#### 1 Comment

Jacky Foo on 31 May 2020
Yeah, there was an issue in the for loop. I got it fixed. Thanks for your help!