Solve second order non linear differential equation

4 views (last 30 days)
I need to solve F'' + F^2 -1/2pi = 0
Boundary conditons
F(0) = 0;
F(inf) = 1
I am new to using the ode solver in matlab and am not sure how to make it solve a non-linear SECOND order equation. Any suggestion would be appreciated.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 9 Nov 2021
You can try a builtin fcn: bvp4c(). Here is a nice documentation on bvp4c() with examples:

More Answers (1)

John D'Errico
John D'Errico on 9 Nov 2021
You will not be able to use bvp4c directly, since it will use collocation. That will fail on an infinite domain.
One option might be to use a finite domain, but one that is relatively large. So [0,Xmax] where Xmax is sufficiently far out that the solve has a chance to finish in a reasonable time, yet not that far out that numerical problems exist.
I did try dsolve, and it fails to find a solution, but that is not unexpected. My next suggestion is to use a transformation of the domain into a bounded domain. For example, you might try a transformation like
y = atan(x)
This maps the domain [0,inf] into [0,pi/2], which may be surprisingly a good idea, considering the equation at hand. You can see some ideas here on a similar problem:
But certainly other links exist where people explain how to transform such a problem into a finite domain.
AJ on 10 Nov 2021
Thank you!John! Your efforts are appreciated

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by