File Exchange

image thumbnail

Finite Element Toolbox 2.1

version 1.0 (132 KB) by

Piecewise linear Galerkin method with piecewise constant coeffs for static PDE probelms.

20 Ratings



No License

I've discovered that the piecewise coefficients method I'm using is wrong. To get correct results use constant coefficients. This will be corrected in the next version. This will make the release for the next version a bit more delayed than expected. I'm also writing a paper on how FEM works that will be included in the toolbox (as a tutorial).

Version 3.0 will contain:
* 3D FEM
* improved function documentations
* introduction to applied linear Galerkin (document)
* correction of the piecewise constant coefficients
* correction on how to enter Robin condition in the 1D case
* improved syntax


This is a toolbox for computing ODEs or PDEs in BVPs using FEM in 1D, 2D (and 3D, yet to come).

* FEM1
this is the main routine for solving ODE BVPs using any combination of Dirichlet, Neumann or Robin conditions.

called by FEM1 and is the core of the program. It generates the matrices used for solving the linear equation system for the ODE. Uses alytical results of the integration of basis functions (for sake of efficiency).

with this routine you can refine the mesh over certain critical grid points. The the gridpoints will become nonuniformly linearly spaced.

this is a test for the 1D case of FEM. Look through this example carefully in order to fully understand how FEM1 works.

plot mesh/triangulation in 2D and put a number in each corresponding element (triangle).

generates quadratically spaced vectors. That is, the spaces are linearly decreasing/increasing.

* FEM2
this is the main routine for solving PDE BVPs using any combination of Dirichlet, Neumann or Robin conditions.

called by FEM2 and is the core of the program. It generates the matrices used for solving the linear equation system for the PDE.

test for the 2D case of FEM. Test this for better learning how to use FEM2 and other utilities.

Both FEM1 and FEM2 uses the sparse class in order to become more efficient (since the matrices generated are in general tridiagonal).

These routines may be useful for solving electrostatic problems with strange geometries and with spatially changing dielectric constants (or similar).
Of course the elliptical problem is universal and can be used for a lot of other applications such as the classical heat equation, etc...

Unfortunately, the FEM solvers does not support parabolic nor hyperbolic problems "yet".

the FEM1 and FEM2 routines should be fairly user friendly, and not much knowledge about finite elements ought to be required to operate them.

Remark: in the FEM1 routine you have to enter the neumann/(robin)-condition as


rather than


and I will correct this minor inconsistency for future versions.

Have fun!

More toolboxes and assorted m-files can be found at:

Comments and Ratings (32)

Gandy Lopez

Grazie mille

by the way, i can not reach you via the email you offered.


When do you expect the 3.0 version to be available ?

liviu b


Didit Nugroho

alaa taha

thank u


????? ???? ????

hamlet hamlet

probleme de stabilité des plaques la matrice
de geometrie et element finis par matleb




yuga gautama


yuga gautama


yuga gautama

arash shabani

tanks for useful helps.

roozbeh Behzadi

Hi,thanks for your help

david Zeitoun

joao gouveia

kyun wo

none of the links ( you provided are working.

osmar monteagudo

phuong nguyen

Rasmus Anthin

Ok... this project has been on ice for some time and it is uncertain when I can pick it up again. Perhaps within a year or two. If you are interested in the theory behind Galerkin finite elements, you can read my article about it:
it is not yet completed though. The article will be included in the next version of this toolbox.
/the author.

Hieu Vu Duc


adi sayoga


Johnny C.

Great package, works well and runs fast. More comments in the source code would help students taking a FEM course understand how the included functions work. This, of course, isn't needed for just using the package.

Hossein Kazemi


abbassi ammar

lalu PP

(author) Rasmus Anthin

It'll be fixed for next version. There might be some incompability with the mat-files somehow, that I do not understand :). Another explanation could be that it have been corrupted in the packing or unpacking process of the toolbox. Seems that mat-files are sensitive to compression.

Syed Ali

Ex1 does not work
load ex1 gives error.

Zhang Shaozhi


javad Eashraghi


Updated information/description.

Updated information/description.

Only changed the packing format from tar.gz to zip since many people seems to have problems with corrupted mat-files. The tar.gzipped file can still be found on my homepage.

MATLAB Release
MATLAB 5.2 (R10)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video