2 coupled second order equations
古いコメントを表示
Hello everyone, I have a problem of 2 coupled second order equations of the form that is described in the photo I attached. By the way – W(t) and T(t) are quite simple functions, and I plan calling another external function when using it. The reason I don't include them above is the fact that they have a "steps" form and hence time-interval dependent. As I see the only option is a numeric solution by using the ode45 function. I want to make sure that using the above function is possible at all by doing the manipulation that is also described in the attached photo. I will be happy to hear what is your advice – is there another good way to solve this problem? If not, is the methodic way described above should work? How should I write the command when using the ode45 function? [t,q]=ode45(@(t,q) F(t,q),t_span,q0) While F is a 2x1 vector that consists each of the above eauations.

6 件のコメント
Walter Roberson
2018 年 9 月 29 日
If you have the Symbolic Toolbox then I recommend using the flow documented in the first example of odeFunction() to set up the equations.
However, step functions cannot be used with any of the ode*() routines, all of which assume continuous derivatives. Perhaps you should be using delay differential functions.
Bruno Luong
2018 年 9 月 29 日
編集済み: Bruno Luong
2018 年 9 月 29 日
Uh uh, he told about step in the coefficients T/W, it has nothing to do with the smoothness of the solution, at least not directly at the same differential order.
If the non linearity is "nice", the solution might be stiff but solvable with some stiff method.
Secondly, nothing prevent user to solve the ode (using smooth solver) successively on each time interval on which the coefficients have no jump.
Walter Roberson
2018 年 9 月 29 日
If the non linearity is "nice", the solution might be stiff but solvable with some stiff method.
Not if it crosses any step boundaries. If it does then it is not solvable using the ode*() routines, except perhaps as numeric nonsense.
Secondly, nothing prevent user to solve the ode (using smooth solver) successively on each time interval on which the coefficients have no jump.
Correct, but not something I felt like getting into at 6:30 AM after having been awake all night.
Bruno Luong
2018 年 9 月 29 日
編集済み: Bruno Luong
2018 年 9 月 29 日
Not if it crosses any step boundaries. If it does then it is not solvable using the ode*() routines, except perhaps as numeric nonsense.
Wrong, it makes perfect sense (ever heard of "weak solution" or are you still thinking about classical derivative?), the ODE solver adapt the step, and detect the stiffness. I can cross the boundary with the small step, and the error is still small and ensure the stability.
Try this simple example to revise your opinion:
ode45(@(t,y) double(t>=1), [0 2], 0)
here I don't even need stiff solver for step RHS.
Walter Roberson
2018 年 9 月 29 日
Runge–Kutta methods to estimate slopes are only valid if the slopes have continuous derivatives, which is not the case for step functions.
ode45() does not always detect the discontinuity, which just means that the answers produced are not always valid.
Bruno Luong
2018 年 9 月 29 日
編集済み: Bruno Luong
2018 年 9 月 29 日
The non-stiff method such as Runge-Kutta is less accurate at the breakpoints, but it is a valid solution.
I don't know if you see the graph of the example I gives, but yes it detect the discontinuity indirectly by estimate the error term and it reduces the step when it cross the break point. The solution looks OK (zoom around t=1, you'll see it negotiates the break point very very well). The theoretical solution at final time t=2 is y=1 theorically, and ode45 has an error of 3.148e-5. Tell me if that accuracy does not satisfy you.
The ODE solver are more sophisticated than you might think.
Nothing telling me (beside you of course) that the solution is not valid.
採用された回答
その他の回答 (2 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!