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

 Réponse acceptée

What are your boundary conditions ?
Best wishes
Torsten.

6 commentaires

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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by