Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
linear_algebra/springSysEval.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27 lines (19 sloc)
694 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%define spring constant and mass in matrices | |
springConst= [10,20,20,10]; | |
mass= [1;2;4;]; | |
%define system of equations | |
eqn1=[-1*(springConst(1)+springConst(2)), springConst(2), 0]; | |
eqn2=[springConst(2), -1*(springConst(2)+springConst(3)), springConst(3)]; | |
eqn3=[0,springConst(3), -1*(springConst(3)+springConst(4))]; | |
%collect results from above into matrix | |
formColl= [eqn1;eqn2;eqn3]; | |
%reverse above value | |
formColl= -1*formColl; | |
%create diagonal matrix using mass values | |
diagMat= diag(mass); | |
%equation for final values | |
finalEval= (diagMat^(-1/2))*(diagMat^(-1/2))*(formColl); | |
%find eigenvalues of above equation | |
eigVal=eig(finalEval) | |
%determine natural frequencies | |
natFreq= sqrt(eigVal) |