I need to pass an inline anonymous function into ode45 function in Matlab but I have not managed to do that. I have looked through the help of Matlab but it didn't help me.

Here's a code example to clarify:

I have a matrix function as follows:

f_xyz = @(x,y,z) [-1 1 0;2 -1 -x;0 y -3]*[x;y;z];

and I would like to pass it into ode45 function with such syntax:

[T Y] = ode45(ode_function,time_interval,initial_values);

I checked many forums to get some hints but it didn't work

Please advise me how to do this?

P.S. I know how to do it if we have a m-file function but I need it to be as an anonymous function.

Similar questions and discussions