0
$\begingroup$

Given the problem

\begin{align} &u''− x^2u(u − 1) = 0,\\ &u(1) = 2,\\ &u(3) = 4, \end{align}

solve it with a finite difference method with the interval divided into $N+1$ equal intervals between $1 \leq x \leq 3$.

  • First in detail write the equations when $N=3$.
  • Draw the interval and mark the discretization points for the differential equation in the $N$ inner points for arbitrary $N$-value.
  • Write the equations $f(u) = 0$. Write a MATLAB function that for a given $u$ calculates $f(u)$.
  • Use global values for the boundary values.

What I can do is transform the differential equation to first order:

$ v_1=u,\\ v_2=u',\\ v_2'=u''. $

Hence

$ v_2'-x^2v_1(v_1-1)=0\\ v_1(1)=2\\ v_1(3)=4 $

But I don't know how to continue.

2 Answers 2