This question relates to the function handle to determine the derivative vector for use in ODE45.

My 'dx' changes during each iteration of my code (my dx is dependent on applied forces), as such I need a way of updating the force within the function. A simple example is shown below.

`function dx = functionhandle(t,x_current)dx(1) = x_current(1)*F_x end`

and then I would call this function handle in my main script to determine the new statespace

`[t,x_new] = ODE45(@functionhandle,[0 dt/2 dt],x_current)`

where x_new is my updated statespace. My question can be boiled down to this: How do I retreive F_x within the function handle to tabulate dx.

## Best Answer