Skip to content
Permalink
fc517f15b1
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
27 lines (19 sloc) 694 Bytes
%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)