need help in solving 2nd order ODE using finite difference method: central scheme

 采纳的回答

What are your boundary conditions ?
Best wishes
Torsten.

6 个评论

Only intial condition is given 0<x<1
Let me cross check with teacher.
Thanks for your reply
Since your problem is not time-dependent, initial conditions are only important for convergence. Boundary conditions are the important issue.
Best wishes
Torsten.
boundary condition: u = 0 at x = 0 and x = 1
thanks
Then you will have to solve the linear system of equations
u(1)=0
(u(i+1)-2*u(i)+u(i-1))/(dh)^2=-(2*pi)^2*sin(2*pi*(i-1)*dh) (2<=i<=n-1)
u(n)=0
with
dh=1/(n-1)
See whether MATLAB supplies a solver for tridiagonal systems of linear equations.
Best wishes
Torsten.
I can not use any solver tool. I have to write a matlab code for getting solution. do you have code for similar boundary layer problem.
The linear system has the form
A*u=b
Set up A and b and solve for u using u=A\b.
Best wishes
Torsten.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by