updated matlab resample script