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.
if you please i want a m.file to calculate the output power of wind turbine and PV by only giving them the rated power of each and wind speed for the turbine and temperature and sun radiance for PV. please send it to me on firstname.lastname@example.org