I have a rather complicated function the I would like to write as an anonymous function.
It looks something like this:
function Answer = MatlabFunction(x)
a=4*x;
b=sin(a);
c=cos(b);
Answer = c;
I don’t know how to put this into an anonymous function however. Is there a way to do this without writing it as several cascading functions?
There are two ways:
Either, you save your function
MatlabFunctionon the Matlab path, and define your anonymous function asOr, you define the function directly as