I am quite new in this field. For my university I prepared a stiffness matrix to solve for a project group. This matrix consists of 450 equations with 450 unknows (it's a Matlab script) and I have the associated load vector $\{L\}$ of 450 rows. since I need to calculate the displacements would you advice me to simply do $\{x\} = [K]^{-1} \{L\}$?
-
$\begingroup$ Just use any routine for solving linear systems, as inverting a matrix must be avoided. In MatLab, you have the backslash. Look the documentation on mathworkds, you'll find anything you need $\endgroup$– VoBJan 25, 2021 at 16:17
-
1$\begingroup$ This is such a small problem that matlab's backslash operator is the way to go. $\endgroup$– Wolfgang BangerthJan 25, 2021 at 17:02
1 Answer
As mentioned in the comments by Wolfgang Bangerth, for this problem you want to use the backslash operator, i.e.,
u = K \ L;
In general, you don't want to reinvent the wheel and should go with a linear algebra library for this kind of problem.
PS: Keep in mind that your stiffness matrix might be singular if you haven't imposed any constraints.