# Finite Element Analysis (FEA) in MATLAB - Textbook Guide

• MATLAB
• rppearso
In summary, the conversation discusses finding resources for setting up FEA in MATLAB in detail. The conversation suggests two books with MATLAB code that could be useful, one of which is a bit old. It also mentions a 50-line code for doing FEA in MATLAB and discusses the possibility of using a finite difference method for a first attempt at writing a CFD solver. The conversation also mentions the need to define and build an array and loop through its elements in time to solve the problem. Finally, the conversation mentions the desire to display the results in a plot and adjust the area factor to reach steady state.

#### rppearso

Does anyone know of a great text that shows how to set up FEA in MATLAB in detail. I have wrote out the sort of pre pseudo code from John Andersons - Computational Fluid Dynamics now I just need to build it out in code. I am old school with the hand sketches, hopefully this does not get me a down vote.

#### Attachments

• 40457590_1882933911773922_8490047946346201088_o.jpg
38.1 KB · Views: 503
• 40403655_1882935495107097_1975171256596561920_o.jpg
29.7 KB · Views: 580
You can also do FEA in MATLAB in 50 lines:

I thought Anderson also gives some numerical methods in his book?
I would start with a finite difference method if this is your first attempt to write a CFD solver (but MATLAB is fine, at least you don't have to worry about implementing solvers for sparse matrices).
I don't know a good book on finite element methods, although I have a couple of them on my shelf.

bigfooted said:
You can also do FEA in MATLAB in 50 lines:

I thought Anderson also gives some numerical methods in his book?
I would start with a finite difference method if this is your first attempt to write a CFD solver (but MATLAB is fine, at least you don't have to worry about implementing solvers for sparse matrices).
I don't know a good book on finite element methods, although I have a couple of them on my shelf.

Thank you for the reference. Anderson does not provide raw code, although I did find his email address and asked him (but he has not yet responded). His book does a marvelous job of breaking the PDE's into algebraic problems which is what is required for finite element (PDE -> algebra) and then looped in an array.

Basically I just need to figure out how to define/build out an array and then loop each element of the array in time (allowing each array element to pull values from each other either from adjacent array cells or values from previous time steps in the same array or other arrays.

So the initial array will be pre-populated with values (initial and boundary conditions, the boundary conditions are no longer "neumann" they are simply algebra) and then the calculations will solve and a new array will be created. There will now be 2 arrays with values, the initial conditions (t=0) and the new conditions (t=1), then to get t=2 the calculations will be ran again using the new values from t=1. These new t=2 array values can either replace the initial conditions or just keep creating more arrays (with computing power what it is today and the fact this is a simple pseudo one dimensional problem I don't think there will be issues just to save them but only display the latest values in the plot. I then want to display the values as colors in the shape that I have drawn and have that shape change as I manually change the area factor A(x). This will go on until the new t=x value is negligibly different from t=x-1 (that acceptable difference, steady state, will be set by the user).

I don't think this is super hard to do in MATLAB but I have never done it so need a little help/reference. I have only done a loop in an "array" with a single box so an array didn't really need to be set up, I simply set up a do until loop to converge on a value.

## 1. What is Finite Element Analysis (FEA)?

Finite Element Analysis (FEA) is a numerical technique used to analyze and solve complex engineering problems. It involves dividing a complex system into smaller, simpler elements and using mathematical equations to calculate the behavior and response of the system.

## 2. How is FEA used in MATLAB?

MATLAB is a powerful software platform that allows engineers and scientists to perform FEA simulations using its built-in functions and toolboxes. It provides a user-friendly interface for creating, modifying, and analyzing FEA models, making it a popular choice for FEA simulations.

## 3. What are the advantages of using FEA in MATLAB?

One of the main advantages of using FEA in MATLAB is its versatility. MATLAB offers a wide range of tools and functions that can be used to create and analyze FEA models, making it suitable for a variety of engineering applications. It also has a large and active user community, providing support and resources for FEA simulations.

## 4. Are there any limitations of using FEA in MATLAB?

While MATLAB offers many advantages for FEA simulations, it also has some limitations. One of the main limitations is that it is a general-purpose software and may not be suited for highly specialized or complex FEA simulations. It also requires a strong understanding of programming and FEA concepts to effectively use the software for simulations.

## 5. Can FEA simulations in MATLAB be validated?

Yes, FEA simulations in MATLAB can be validated by comparing the results with analytical solutions or experimental data. MATLAB also has tools for performing verification and validation of FEA models to ensure their accuracy and reliability. It is important to properly validate FEA simulations to ensure their usefulness in real-world applications.