Peace be upon you,
I have a system of equations to be solved. I know that I can solve my system in Matlab like this:
function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
and save it as "myfun.m" and then in command line I write
x0 = [-5; -5];
[x,fval] = fsolve(@myfun,x0)
But I would like to know how I can do this without defining a function. Because I am using Matlab command line via a proxy provided from another software.
You can do it by defining an inline anonymous function:
will do exactly what you want, in a single line that can be evaluated in the interactive prompt.