Numerical Solution for Nonlinear BVP with Polynomial D(x) in Matlab

  • Thread starter Thread starter dirk_mec1
  • Start date Start date
  • Tags Tags
    Matlab Nonlinear
AI Thread Summary
The discussion focuses on solving a nonlinear boundary value problem (BVP) in MATLAB for the function φ(x) defined by a second-order differential equation involving a polynomial D(x). Participants explore methods such as rewriting the equation in state space form and the shooting method, noting that D(x) complicates the iteration process. The boundary conditions specified are φ(0) = 0 and φ'(L) = 0, and it is emphasized that the shooting method requires guessing the initial derivative φ'(0) to find φ(L). The conversation clarifies that while fsolve is not suitable for this problem, integration algorithms like R-K45 can be employed to achieve the solution. Overall, the thread provides insights into numerical techniques for addressing nonlinear BVPs in MATLAB.
dirk_mec1
Messages
755
Reaction score
13

Homework Statement


Solve from the differential equation below numerically for the function \phi(x) for x \in [0,L]

\phi '' (x) + D(x) sin(\phi (x) ) + E sin(\phi (x) ) cos( \phi (x) ) = 0

with D(x) a polynomial.

Homework Equations


Matlab.

The Attempt at a Solution


I can rewrite it in a state space form and then iterate towards the function \phi(x) if D is constant. But what can I do with that pesky D(x). If I am iterating towards D(x) I cannot iterate, right?
 
Physics news on Phys.org
Did you tried the shooting method ?
What bounday values must fulfill ##\phi(x)## ?
 
Right I forgot:

\phi(0) =0
\phi ' (L) =0

No I haven't tried the shooting method, it it preprogrammed in Matlab?
 
No, but it is straight forward. Just define you function and use some integration algorithm, e.g. R-K45, then by changing the value of ##\phi^\prime(x=0)## you should obtain ##\phi(x=L)=0##.
 
No fsolve does not work here.

I do not understand what you mean with changing the BC.
 
You partial derivative equation is of second order, and this means that Beside the equation itself one has to provide two aditional values in order to determine the solution, you can either specify ##\phi(x=0)## and ##\phi(x=L)##, or ##\phi(x=0)## and ##\phi^\prime(x=0)##. You are given the function values at the ends of the interval, but the shooting methods uses the values at one end of the interval, i.e. the function and its derivative, and by integration you end up with the value of the function at the other end of the interval. This is how the shooting method work, you need to "guess" the value of ##\phi^\prime(x=0)## in order to obtain ##\phi(x=L) = 0##. You can do it by trial and error or build up some iteration loop. See also the wikipedia article on shooting method.

For other numerical methods you specify directly the values of the function at both ends of the interval.
 
Back
Top