필터 지우기
필터 지우기

How to use jacobian in a specific case

조회 수: 1 (최근 30일)
John Miller
John Miller 2012년 7월 27일
Hello,
I have following code:
function dydt = fun_eval(t,x,a)
global x0g
f1 = [((119*x(2))/27 + (2981766797354441*exp((500*x(1))/13))/309485009821345068724781056 + (8882160727547769*exp((500*x(2))/13))/2475880078570760549798248448 - 24758800785740341793088867777/2475880078570760549798248448);
(x(1) + (4901737476034079*exp((500*x(1))/13))/4951760157141521099596496896 + (6669030579638201*exp((500*x(2))/13))/9903520314283042199192993792 - 18547597874385838245692255223/9903520314283042199192993792)];
G=[(x(1)-x0g(1)),0;0,(x(2)-x0g(2))];
f=G*f1;
dydt1 = t*f + (1-t)*(x-x0g + f);
J = jacobian(dydt1,x); %Here is the problem but I don't how to change dydt1
Ji=inv(J);
f_d=diff(dydt1,t);
dydt=-Ji*f_d;
ERROR:
Undefined function 'jacobian' for input arguments of type 'double'.
Error in ProbSE31>fun_eval (line 79)
J = jacobian(dydt1,x);
Error in cjac (line 32)
j(:,i) = feval(odefile, 0, x2, p{:})-feval(odefile, 0, x1, p{:});
Error in init_EP_EP (line 78)
jac = cjac(eds.func,eds.Jacobian,x,num2cell(p),eds.ActiveParams);
Error in MainRealSE3 (line 80)
[x0,vO] = init_EP_EP(@ProbSE31,x0g+dx, p, ap);
  댓글 수: 1
Sargondjani
Sargondjani 2012년 7월 27일
it looks like 'jacobian' only works for symbolic expressions... i have no experience with them, but you would have to declare variables as symbols (as in the example in the documentation).
or if you are fine with estimating the jacobian with finite differences you could also use the 'jacobianest' function from the file exchange
(or you could derive the analytical jacobian yourself. this doesnt look too difficult at first glance)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by