Error of indexing in uq_eval_uq_default_model using RIA, SORA and SLA

I am facing the error " Index in position 2 exceeds array bounds. Index must not exceed 1. " while running the analysis RIA, SORA, and SLA. However, the code runs normally for PMA analysis.

I ran the constraints function “Rotor_FlexBrg_WFound_rev2” to check if the function was running right the output was okay and no error appeared.

I have attached all the files, and the UQLAB program to be run is " uq_Rotor_Laval_2var " . (17.4 KB)

Thank you for your support,


Hi @Barbara_Oliveira_Men

To me it looks like there is a bug in your code. The index error occurs in your D_FEM_GlobalMatrix_FlexBrg_alternativa1 function. Did you perhaps miss that the input that UQLab passes to your function Rotor_FlexBrg_WFound_rev2 function contains both d and Z (see Eq. (2.2) in the RBDO manual)? Or phrased differently: your function Rotor_FlexBrg_WFound_rev2 must be the limit state function g(d, Z).

PMA passes more than one sample at a time to Rotor_FlexBrg_WFound_rev2. The fact that PMA works can be an unfortunate coincidence. “Unfortunate” because although the code can be executed successfully since there is no out-of-bounds access, the result may be incorrect.

I recommend that you check your code very carefully and assess whether the results you get are plausible. Also, be critical with my assessment as I only skimmed your code and may have missed things.

Best regards

Hi Styfen,

Thank you very much for your support, you are completely right, I had an error in my code.

I found it and corrected it, and now it is working properly.

Thank you a lot,