I have the following function:
function ypdiff = ypdiff(t,y) a = 0.01; b = 0.1; ypdiff(1) = -a*y(1)*y(2); ypdiff(2) = b*y(1)*y(2)-b*y(2);
You can use an anonymous function in matlab (similar to lambda functions in other languages):
u = 1.2; [t y] = ode45(@(t, y) ypdiff(t, y, u), [to tf], yo);