George Mason University



Conor Philip Nelson

Source: Home > Classes > Math 447 > Project 1 > Step 1

Math 447: Numerical Analysis

Project 1 Step 1: Step 2: Step 3: Step 4: Step 5: Step 6: Step 7:


1. Write a Matlab program to define the structure matrix A in (2.34). Then, using the Matlab \ command or code of your own design, solve the system for the displacements \(y_i\) using \(n=10\) grid steps.


Initially, a sparse \(n\) x \(n\) matrix is constructed. This conserves memory and greatly reduces the computational cost of solving the system of equations. Once the matrix is constructed, the first four entries in each row are assigned in accordance with the approximations used in discretizing the derivatives found in the equations. A for-loop is used to assign the third through \(n-2\) rows’ entries due to the repeating nature of these rows. Finally, the last two rows are assigned values. Once all of this is done, a solution vector, 'y', is created and the Matlab \ command is used to solve the system for the displacement vector.

y =
-0.000180624738462
-0.000674847507692
-0.001416986584615
-0.002349087507692
-0.003420923076923
-0.004589993353846
-0.005821525661538
-0.007088474584615
-0.008371521969230
-0.009659076923076

Project 1 Home Next: Step 2