When I want to solve a differential equation with additional parameters
function dx = myfun(t, x, p1, p2)
using ode45, I used to call it by passing the parameters as trailing arguments:
[T, Y] = ode45(@myfun, ts, x0, , p1, p2);
Now, the documentation recommends that I use anonymous functions instead:
[T, Y] = ode45(@(t,x) myfun(t, x, p1, p2), ts, x0);
What is the benefit of the latter method over the former?