FEM solution of the spring mass system including time period

1 view (last 30 days)
I have written the code for spring mass system but I have problem in it. would you please check it and help me to correct this?
clc; E=input('Enter the elements number'); y=0:(1/E):1; A=0.01; m=1; k=1;
KG=zeros(E+1); %GLOBAL
for j=1:E k(1,j)=A*10*E; K=k(1,j)*[1 -1;-1 1]; z=zeros(E+1); k=z((j:j+1),(j:j+1)); KG=z+KG; w(1,j)=9810*0.01*(1/E); %weight end
p(1,1)=w(1,1)/2; %force for j=2:E p(j,1)=(w(1,j-1)+w(1,j))/2; end p(E+1,1)=0; KG(E+1,E+1)=1; for i=1:E KG(E+1,i)=0; end u=(KG^(-1))*p %displacement for i=0:E u(i+1,1)=i*(1/E); end t=[0 10]; T=t/E; w=2*pi/T;
  2 Comments
Andrew Reibold
Andrew Reibold on 31 Oct 2014
please format your code and use the feature specially designated for displaying coding
Geoff Hayes
Geoff Hayes on 31 Oct 2014
As well, please indicate what the problem is. Are you observing an error, and if so, what is it? Or is just not working the way you expect? If that is the case, then please describe the expected behaviour versus the observed behaviour.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!