implement run_FS (but the answer doesn't match with Matlab)