Update resample.m