fd1d_bvp, a MATLAB code which applies the finite difference method to solve a two point boundary value problem (BVP) in one spatial dimension.
The boundary value problem (BVP) that is to be solved has the form:
- d/dx ( a(x) * du/dx ) + c(x) * u(x) = f(x)in the interval X(1) < x < X(N). The functions a(x), c(x), and f(x) are given functions, and a formula for a'(x) is also available.
Boundary conditions are applied at the endpoints, and in this case, these are assumed to have the form:
u(X(1)) = 0.0; u(X(N)) = 0.0.
To compute a finite difference approximation, a set of n nodes is defined over the interval, and, at each interior node, a discretized version of the BVP is written, with u''(x) and u'(x) approximated by central differences.
u = fd1d_bvp ( n, @a, @aprime, @c, @f, x )where
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
fd1d_bvp is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
bvp4c_test, a MATLAB code which uses the MATLAB command bvp4c(), which can solve boundary value problems (bvp's) in one spatial dimension.
fd1d_advection_ftcs, a MATLAB code which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the ftcs method, forward time difference, centered space difference.
fd1d_burgers_lax, a MATLAB code which applies the finite difference method and the lax-wendroff method to solve the non-viscous time-dependent burgers equation in one spatial dimension.
fd1d_burgers_leap, a MATLAB code which applies the finite difference method and the leapfrog approach to solve the non-viscous time-dependent burgers equation in one spatial dimension.
fd1d_display, a MATLAB code which reads a pair of files defining a 1d finite difference model, and plots the data.
fd1d_heat_explicit, a MATLAB code which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1d.
fd1d_heat_implicit, a MATLAB code which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1d.
fd1d_heat_steady, a MATLAB code which uses the finite difference method to solve the steady (time independent) heat equation in 1d.
fd1d_predator_prey, a MATLAB code which implements a finite difference algorithm for predator-prey system with spatial variation in 1d.
fd1d_wave, a MATLAB code which applies the finite difference method to solve the time-dependent wave equation in one spatial dimension.
fem1d, a MATLAB code which applies the finite element method to a linear two point boundary value problem in a 1d region.
fem1d_bvp_linear, a MATLAB code which applies the finite element method, with piecewise linear elements, to a two point boundary value problem in one spatial dimension.