Need help to solve nonlinear ode in matlab

u''-2Ru'*u''+T=0 with boundary conditions u(0)=0 and u(1)=0 and u=u(x). R and T are constant. i have to change value of R in range 0.1 to 0.8.
assume T=1.
is it possible to get numerical solution to this non-linear ODE?
i also need assistance to plot the graph of u vs x.

 Accepted Answer

Just for kicks, I had to try solving this using dsolve to see what it would do.
syms u(x)
T = 1;
R = 0.5; % Just picking a value in the interval of interest.
usol = dsolve(diff(u,2)*(1 - 2*R*diff(u,1)) + T == 0,u(0) == 0,u(1) == 0)
usol = 
So it does seem to find a solution, but a difficult one to appreciate. There are three unspecified constants in there: C1, C2, C3. C2 and C3 are the roots of a pair of 4th degree polynomials. But C1 is unspecified. Strange.
Oh well, nothing stops you from the use of a tool like BVP4C or BVP5C, numerical tools for boundary value problems.
To do that, you convert this into a system of ODEs, where there are two unknowns, u(x), and v(x) = u'(x). That gives us two ODES.
u' = v
v' = -T/(1 - 2*R*v)
The boundary values on these ODES are simple, u(0 = u(1) = 0.
If you will use a tool like bvp4c, it requires an initial guess at the solution. sin(pi*x) seems like a perfect guess for u(x), and so then the guess for v(x) would be pi*cos(pi*x).
Finally, I see that chebfun also provides a BVP ssolver.

More Answers (1)

Write your equation as
u'' = -T/(1-2*R*u'),
substitute u1 = u and u2 = u' to arrive at the system
u1' = u2
u2' = -T/(1-2*R*u2)
with boundary conditions
u1(0) = u1(1) = 0
and use bvp4c to solve.

Community Treasure Hunt

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

Start Hunting!