ODE - what exactly does Jacobian matrix do
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
1 개 추천
Hi:
I have a gnereal question regarding to the Jacobian matrix when solving the ODE. I don't know why the Jacobina matrix needs to be provided? And could you explain how does Matlab use it to improve the efficiency for sovling ODE?
Is it better to provide the Jacobian matrix for both the stiff and non-stiff system of ODE?
Thanks,
채택된 답변
Ameer Hamza
2020년 3월 20일
3 개 추천
Jacobian is an equivalent of a gradient vector for a vector-valued function. In an oversimplified way, you can think of it in the same way as the derivative of a scalar function.
You don't need to specify the Jacobian matrix for ODE functions in MATLAB explicitly. However, providing it will increase the speed because otherwise, the MATLAB will have to estimate the Jacobian matrix using finite difference, which essentially involves nudging each variable a little bit and estimating its effect on the output vector. If you explicitly provide it, then MATLAB does not have to go through all that nudging.
댓글 수: 9
Chao Gong
2020년 3월 21일
Hi,
Would you mind helping me to understand how the boundary jacobian matrix is calculated (Jy(a) and Jy(b))? I couldn't figure it out.
Please check the attachment.
Many thanks.

Ameer Hamza
2020년 3월 21일
Chao, I found that you mentioned this example from here: https://www.mathworks.com/help/matlab/math/solve-bvp-using-continuation.html
Since we have the boundary conditions
So he matrices
and
are defined as
Similarly you can write the expression for
and after putting the values, you will get the matrices as given in the example.
Chao Gong
2020년 3월 22일
Got it. Many thanks!
Chao Gong
2020년 3월 22일
Hi Ameer:
I have another question and hope you don't mind helping me to explain. I am reading the document '
Solve BVP with Multiple Boundary Conditions
'
The bouddary condition is
v(0)=0,
C(λ)=1.
However, I don't quite understnad the intial guess.
It says 'A simple guess that satisfies the boundary conditions is the constant guess y = [1; 1].'.
My question is why the constant guess y is not set as y = [0, 1] instead? From my understanding, [0, 1] is the one satisying the given boundary conditions instead.
Thanks,
Chao
Chao, I think you are under the impression that [1 1] defines the initial guess at two end-points. But if you look at the output of the following, you will see how the initial guess is calculated from [1 1]
xc = 1;
xmesh = [0 0.25 0.5 0.75 xc xc 1.25 1.5 1.75 2];
yinit = [1; 1];
sol = bvpinit(xmesh,yinit);
sol.y
ans =
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
The vector [1 1] is use to specify the initial guess for both variables, v and C, on their entire range, not just end-point. Instead of [1 1], you can also input a vector of dimension size(xmesh,2)*2. The first row of initial guess corresponds to the first variable (i.e., v) and second row is for the second variable (C).
The initial guess does not need to satisfy the boundary conditions. It is just an initial guess, you can give whatever value you want. The solver will just use that initial point to get toward the final solution.
Chao Gong
2020년 3월 22일
Hi Ameer,
Thanks for taking time to answer my question and I really appreciate your great help.
However, the 'whatever value' part of the initial guess still confuses me. According to the guideline of creating a good initial guess as below, it's better to have the intial guess satisfy the boudary conditions (bullet 1). Also, I understand [1 1] is used to specify the intiial guess for both varaibles. I just don't see why first term isn't set as 0 instead to satisfy v(0) = 0, which makes the initial guess as [0, 1], though I am aware both initial guess give the same solutions. However, I don't get how does '1' in first term come from in initial guess [1,1] and why '1' is used. This also makes sol.y(1,:) as all 1s and doesn't satisfy the condition v(0) = 0. Would you mind eplaining this in more detials? Also, when saying 'you can give whaterever value you want' for initial guess, is it always true?
Thanks, and looking forward to the answers.

Ameer Hamza
2020년 3월 24일
Chao, It is correct a good initial guess is necessary for the quick convergence performance of the bvp4c() function; however, following the boundary condition is a guideline, not a pre-requisite. A close enough value for initial guess is enough as a starting point for solving a BVP. For simple problems, even a rough initial guess can work. Additionally, this page, https://www.mathworks.com/help/matlab/math/solve-bvp-with-multiple-boundary-conditions.html, also mentions that "For multipoint BVPs, the boundary conditions are automatically applied at the beginning and end of the interval of integration," so internally the solution might always enforce the constraint at the end-point despite the initial guess.
You can also think of it in this way. In the case of this problem, there are actually 4 boundary conditions. The initial guess [0;1] will only satisfy 2 of these conditions. Whereas, the initial guess [1;1] satisfy three of these conditions. Besides, the MATLAB might enforce the boundary constraint internally, as already stated.
Chao Gong
2020년 3월 24일
Ameer, thanks so much. This really clear things up. Really appreciate your time and great help!
Ameer Hamza
2020년 3월 24일
Glad to be of help.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
