I am looking at find_best_table_1de. I have two comments:
(a) It seems there is a problem with max_iterations. Lets say we have length(x_0)=10. So max_iterations=10. In the first while loop, n_x could increase up to 3*2^10 = 3072. This is much higher than length(x_0)! The loop should stop when n_x>=length(x_0).
(b) Why dont you start directly the dichotomie using
n_x_left = 3;
n_x_right = length(x_0);
? This looks simpler because you can get ride of the first while loop.
I want to create some fault cases of the subsystem to see how it responds and therefore have some question: is there any way to change certain parameter during the simulation? For instance, simulation time is 80, I want to replace the leakage area of 4-way directional valve in hydraulic pitch system with another value at 40 second. Is it theoretical doable?