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

 Akzeptierte Antwort

Torsten
Torsten am 21 Mär. 2016
What are your boundary conditions ?
Best wishes
Torsten.

6 Kommentare

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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Mär. 2016

Kommentiert:

am 21 Mär. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by