matlab: all step4 except optional.