I have solved this isssue with the following odeEvent object definition:
E = odeEvent("EventFcn",@impactEvent,"Direction","ascending","CallbackFcn",@impactEventCallback,"Response","callback");
However, the previous definition of odeEvent object is :
E = odeEvent("EventFcn",@(t,y,P) impactEvent(t,y,P),"Direction","ascending","CallbackFcn",@(te,ye,ie,P) impactEventCallback(te,ye,ie,P),"Response","callback");
The difference is that the EventFcn and CallbackFcn are defined utilize function handle syntax explicitly.
I am confused why the implicity syntax of function handle definition is effective yet the explicity syntax is not.
The simulation result after fixing is illustrated as follows:
parameter befor updating : 0.10000 After updating : 0.37243
parameter befor updating : 0.37243 After updating : 0.18519
parameter befor updating : 0.18519 After updating : 0.22448
parameter befor updating : 0.22448 After updating : 0.13929
...