expand matlab code for GLF