matlab code of thickness analysis