Convert velocity from fps to kts using convvel. KTAS is true airspeed in knots.

KTAS_bg = convvel(TAS_bg,'ft/s','kts')';

Convert KTAS to KCAS using correctairspeed. KCAS (calibrated airspeed in knots) is the velocity corrected for instrument error and position error. This position error comes from inaccuracies in static pressure measurements at different points in the flight envelope.

KCAS_bg = correctairspeed(KTAS_bg,a,P,'TAS','CAS')';

Best glide angle is calculated using:

This is the angle between the flight path and the ground that provides the highest L/D ratio.