0% found this document useful (0 votes)
44 views16 pages

GROUP9 MEM591 FinalProject

This document summarizes three problems related to numerical analysis and solving systems of equations. Problem 1 involves determining member forces in a truss structure. Problem 2 involves modeling heat conduction on a plate using finite differences. Problem 3 compares methods for solving the matrix equation Ax=b that arises from Problem 2, specifically Gaussian elimination, Jacobi iteration, and Gauss-Seidel iteration. For each problem, the document outlines the governing equations, numerical methods used, and key results such as computation times for different solving algorithms.

Uploaded by

legocaptain24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views16 pages

GROUP9 MEM591 FinalProject

This document summarizes three problems related to numerical analysis and solving systems of equations. Problem 1 involves determining member forces in a truss structure. Problem 2 involves modeling heat conduction on a plate using finite differences. Problem 3 compares methods for solving the matrix equation Ax=b that arises from Problem 2, specifically Gaussian elimination, Jacobi iteration, and Gauss-Seidel iteration. For each problem, the document outlines the governing equations, numerical methods used, and key results such as computation times for different solving algorithms.

Uploaded by

legocaptain24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Kylie Fitchett

Naveen Thomas Ninan


Brian Tsymbal
Ethan Shapiro

MEM591 Final Project Report – Group 9

Problem 1

For problem 1, a plane truss is given with 13 members, 8 joints, and indicated loads (in tons) applied to
joints 2 (10 tons), 5 (15 tons), and 6 (20 tons). The goal is to determine the resulting force in each
member of the truss. By observing the principle of static equilibrium, there would be 16 total equations
for the 8 joints, meaning that there are more than 13 unknown forces to be determined.

In order for the truss to be statically determinate, joint 1 is assumed to be rigid in both x and y, and joint
8 is assumed to be rigid in only y; now we have 13 equations for 13 unknowns, meaning that our
problem is statically determinate.

√2
We also establish the variable 𝛼 = 2
and the following system of equations for member forces 𝑓𝑖 :

(a) To solve the system of linear equations for the vector f via the built-in solving function “\”, we
must first establish a 13 x 13 matrix S containing the variables to all 13 equations. We must also
establish a 13 x 1 vector y containing the solutions to the 13 equations. With the matrix S and
the vector y established, we can run the operation of S\y to solve for the member forces vector f.

(b)
i. For the inner product of vectors b and f, we created the function “dotprod =
innerProd(b,f)” which manually computes the dot product of the vector b (represented
by y) and the already established vector f by means of a for loop. This dot product value
is then compared to the built-in function “dot()” for the same vectors with an error
calculation we called “errorDot”. The value of this error was reported as 0%.
Kylie Fitchett
Naveen Thomas Ninan
Brian Tsymbal
Ethan Shapiro

ii. For the multiplication of matrix A and vector f, we created the function “[result] =
matrixMult(matrix,vector)” which manually computes the multiplication of the matrix A
(represented by S) and the already established vector f by means of multiple for loops.
This multiplication value is then compared to the built-in function “*” for the same
matrix and vector with an error calculation we called “errorMatrixMult”. The value of
this error was reported as 0%.

iii. For the 2-norm computation of vector f, we created the function “[normf] =
vectorNorm(f)” which manually computes the 2-norm of the already established vector f
by means of a for loop. This 2-norm calculation value is then compared to the built-in
function “norm()” for the same vector f with an error calculation we called “errorNorm”.
The value of this error was reported as 1.368158 x 10-14%.

To view the MATLAB code, please refer to Appendix 1.

Problem 2

Problem 2 depicts a square 1x1 plate experiencing conduction. The governing equation that depicts this
conduction is

𝜕2𝜑 𝜕2𝜑
+ =0
𝜕2𝑥 𝜕2𝑦

The 2-D is discretized and has a stencil applied of

𝜑𝑖+1,𝑗 + 𝜑𝑖−1,𝑗 + 𝜑𝑖,𝑗+1 + 𝜑𝑖,𝑗−1 − 4𝜑𝑖,𝑗 = 0

where 𝑖 is the x-position in the plate, and 𝑗 is the y-position in the plate, and 𝜑𝑖,𝑗 are temperature
conditions at each 𝑖, 𝑗 point in the plate.

(a) Using the stencil provided, matrix A (361x361) and vector b (361x1) need to be created. The stencil
describes the temperature conditions in the plate which are different in the center vs edge of the
plate. The sum of the surrounding positions on a plate is equivalent to four times the temperature of
the current position.

Using this knowledge, a set of loops are created to set all the diagonals of matrix A to negative 4.
Additionally, the positions right above and below the diagonals are set to 1 as well to satisfy the
condition. Since this breaks down at the corners, there needs to be checks in place. If the position is
at the top column, only the value below the diagonal is entered as 1. Likewise, if the position is at
Kylie Fitchett
Naveen Thomas Ninan
Brian Tsymbal
Ethan Shapiro

the bottom column, only the value above the diagonal is updated. Vector b is also updated in this
process.

Once these have been created, matrix A is plotter on a contour plot. A major pattern that is observed
is that matrix A is a banded matrix with a band of 19. Also, matrix A is diagonally dominant which
means that the magnitude of the diagonal entry is always larger than the sum of the rest of
magnitude entries in that row.

(b) For the second part of the problem, we solve for the temperature distribution in the plate using
Gaussian Elimination on the banded matrix A to rewrite A as an upper triangular matrix. The size of
matrix A is identified initially and then a loop of gaussian elimination is run. This function determines
if any pivoting is needed by checking the magnitudes of all the values in a column. If a value below
the diagonal is greater in magnitude than the value at the diagonal, a permutation matrix is applied
to switch the rows.

Then the multipliers for elimination are computed using a loop and then saved in a lower diagonal
matrix L. These multipliers are then used to eliminate the values below the diagonal in the original
matrix A to form an upper diagonal matrix. These calculations are also performed to the vector b
simultaneously. Then, back substitution is performed to identify the solution matrix nodeTemp
which is the temperature distribution.

This solution is confirmed with the use of the built-in MATLAB function mldivide(). If fact, the code
checks the accuracy and precision of the two answers to 10 digits and they are equal. This represents
a successful algorithm for identifying the temperature distribution in the plate.

(c) A second contour plot is made of temperature values in the plate based on the solution found in part
b. A separate matrix called nodeMatrix (19x19) is created to describe the interior of the plate. This is
done by looping over all the rows in the nodeTemp temperature distribution to assign certain values
in the nodes of the plate. The boundary corner points instead compute and display an average of the
adjacent boundary points. The steps in the x and y direction go up in steps of 0.1 on the plot.

To view the MATLAB code and contour plots, please refer to Appendix 1.

Problem 3

For problem 3, we are asked to consider the conduction problem for the 2D plate in problem 2 and add
the matrix equation Ax=b. This matrix equation is constructed using the discrete form of Laplace’s
equation.
Kylie Fitchett
Naveen Thomas Ninan
Brian Tsymbal
Ethan Shapiro

(a) For the first part of the problem, the built-in function “mldivide()” is used to find the exact
solution to Ax=b. We establish this solution as xGauss = mldivide(A,b), and utilize the tic toc
functionality to record its computing time, which we called “time_g” (set equal to toc).

(b) For the second part of the problem, we developed a subroutine to execute the Jacobi method to
find the solution to Ax=b. It is important to make sure the matrix A is strictly diagonally
dominant as that is the only time Jacobi method converges. A function named jacobiMethod is
setup to take in input arguments of a matrix (A), a resultant (b), and an initial guess of the
solution vector. First, the variables and tolerances are established within the function. Then, the
main loop is run starting with a condition that checks whether the error is within the tolerance.
𝑥 𝑘 −𝑥 ∗
The error chosen to compute this is 𝐸 = | 𝑥∗
|. Within this function, each diagonal entry is
solved for, and an approximate value is plugged in. This process is iterated until it converges to
the solution. The function outputs the solution vector x_Jacobi. Like the previous part, the tic toc
functionality is used to record the solving time of the jacobiMethod function, and this time is
stored as time_j.

(c) For the third part of the problem, we developed a subroutine to execute the Gauss-Seidel
method to find the solution to Ax=b. It is important to make sure the matrix A is strictly
diagonally dominant or symmetric and positive definite to ensure convergence. A function
named gaussSiedel is setup to take in input arguments of a matrix (A), a resultant (b), and an
initial guess of the solution vector. First, the variables and tolerances are established within the
function. Then, the main loop is run starting with a condition that checks whether the error is
𝑥 𝑘 −𝑥 ∗
within the tolerance. The error chosen to compute this is 𝐸 = | 𝑥∗
|. Then, the loop is iterated
until the solution vector x_Seidel converges. Like the previous two parts, the tic toc functionality
is used to record the solving time of the gaussSeidel function, and this time is stored as time_s.

(d) To compare the timeliness of the solving methods, two different analyses were performed.

The first analysis only compared the developed subroutines for the Jacobi and Gauss-Seidel
methods. Between these two methods, the Jacobi method was fastest with a computing time of
1.365816 x 10-1 seconds during this run.

The second analysis compared all three methods, including both developed subroutines and the
built-in function. Between all three methods, the built-in mldivide() function was fastest with a
computing time of 1.039200 x 10-3 seconds during this run.

Please note that the numerical computing times vary based on the abilities of your machine, but
the demonstrated trends in computing time speed remain constant.
Kylie Fitchett
Naveen Thomas Ninan
Brian Tsymbal
Ethan Shapiro

(e) The results indicate that the built-in direct solving method was faster for this problem. However,
iterative solving techniques are also very beneficial when dealing with large systems which
would use up too much computing power if direct solving were to be attempted.

For the Jacobi method, the Jacobi iteration matrix (𝑇𝐽 ) includes the diagonal matrix of
coefficients (D), a strictly lower triangular matrix (L), and an upper triangular matrix (U).

𝑇𝐽 = 𝐷 −1 (𝐿 + 𝑈)

The eigenvalues of this matrix are the solutions to the initial matrix A. Therefore, the specific
values of the eigenvalues play a big role in the convergence of this method. Additionally, the
method has a better chance of convergence if matrix A is either strictly diagonally dominant or
symmetric positive definite. The convergence is also improved if the eigenvalues have a good
distribution.

For the Gauss-Seidel method, the reasons for convergence are very similar. The Gauss-Seidel
iteration matrix (𝑇𝐺𝑆 ) includes the diagonal matrix of coefficients (D), a strictly lower triangular
matrix (L), and an upper triangular matrix (U).

𝑇𝐺𝑆 = (𝐷 − 𝐿)−1 ∗ 𝑈

The eigenvalues of this matrix are the solutions to the initial matrix A. Therefore, the specific
values of the eigenvalues play a big role in the convergence of this method. Additionally, the
method has a better chance of convergence if matrix A is either strictly diagonally dominant or
symmetric positive definite. The convergence is also improved if the eigenvalues have a good
distribution.

In the future, the optimal method for this system is an iterative method. As we saw, the
computing times for the built-in function mldivide and the other two iterative methods were
similar. This indicates that the built-in function also utilized some form of iterative solving. That
decision is based on the most efficient and cost-effective process. A direct solving method for
this problem would use up too much computing power and take a long time because matrix A is
361x361. Therefore, an iterative method would be ideal for such a system when solving for a
solution.

To view the MATLAB code, please refer to Appendix 1.

You might also like