MATLAB: Taking jacobion of function

curve fittingjacobian

I am using the lsqcurvefit function to fit a function that is dependent on two variables. Let's call these two variables, X, and Y.
If my function looks like:
f(x,y) = a*X + b*Y + c
can someone explain why the Jacobian to this is:
Jacobian=[X(:), Y(:), ones(size(X(:)))];
If I take df/dX, I would get "a", df/dY = "b". Why is the answer what I show it to be?
I am confused and I need to understand what is going on, since I need to change this function to something else. I wanted to start with this one, which is an example I was given, and the Jacobian is known.

Best Answer

If you look carefully at https://www.mathworks.com/help/optim/ug/lsqcurvefit.html#buuhcjo-fun then the x it is talking about are the model parameter values, which are distinct from xdata . Your model parameters appear to be a, b, and c so you take the jacobian with respect to those.
Your function contains a + c term. The derivative of c with respect to c is 1, not 0.