@(t)
is what is known as an anonymous function. @(t)
will thus return a handle to a function that takes in one variable t
. Basically, it's a function that takes in one parameter, t
. The rest of the parameters are defined previously in your workspace.
What you are doing here is that the first parameter to computeNumericalGradient
takes in a function where t
is a variable that is defined by you. As such, your computeNumericalGradient
takes in two parameters:
- An anonymous function that is defined like before.
- A single 1D vector with two column vectors concatenated with each other - The first column is
X
, and the second column is Theta
.
As a sidenote, if you were to do this:
func = @(t) cofiCostFunc(t, Y, R, num_users, num_movies, num_features, lambda);
You would thus call this function by doing func(t)
, where t
is whatever variable you want that is relevant to the function at hand. The code would thus simplify to:
computeNumericalGradient(func, [X(:); Theta(:)]);
I'm not familiar with what you're doing here, so that context will have to be figured out by you.