My program calls a nested function. That nested fanction gets the 'number of iterations' as the input. Sometimes, the number of iterations is high and leads to singular matrix. I want to reduce the number of iterations if and only if the Matlab shows a singularity warning otherwise I want to leave it as high as possible. The reason is singluarity warning reduce the running time signifincatly (I prefer iteration as high as possible to increase the accuracy of my program).
Here is an example code
function some_out_put = main_function(x)
some_out_put = my_nested_function(x, iteration)
iteration = 100;
x = X(i)
y(i) = main_function(x)