taking jacobion of function

조회 수: 1 (최근 30일)
Benjamin
Benjamin 2019년 3월 19일
답변: Walter Roberson 2019년 3월 19일
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.
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 3월 19일
You appear to be taking the jacobian with respect to [a b c]
Benjamin
Benjamin 2019년 3월 19일
편집: Benjamin 2019년 3월 19일
Since my function is a function of x and y, shouldn't the jacobian be taken with respect to x and y? a and b are just fitted coefficients. Also, if I were taking the jacobian wrt to [a b c], wouldnt the partial with respect to c by 0? Why do they have it as a column vector of 1's?
Edit: When I try to take Jacobian with respect to x and y, I get that it expexted another number in that matrix. So it appears that taking wrt a, b, c, is right. I just don't know why.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 3월 19일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by