Replace
fabs(delta_h) < 0.6*raio_elipsoide
with
abs(delta_h) < 0.6*raio_elipsoide % or -delta_h < 0.6*raio_elipsoide
It seems someone translates a C code to MATLAB code without care.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!