ODE - what exactly does Jacobian matrix do
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 日
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
Ameer Hamza
2020 年 3 月 22 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
