Hi everyone, I am really stuck in creating a code that creates global stiffness matrix that changing local stiffness matrixes value in every cycle.
For example it has to be
k1 -k1 0 0
-k1 k1+k2 – k2 0
0 – k2 k2+k3 -k3
0 0 -k3 k3
but my code doesn't change k1 to k2 for next step … it only calculates for k1.
k1 -k1 0 0
-k1 k1+k1 – k1 0
0 – k1 k1+k1 -k1
0 0 -k1 k1
Please help me to solve this problem. Thanks.
cleartp=[1 2]for i=2:4 tp(i,:)=tp(i-1,:)+1endtpmax=max(max(tp));KG=zeros(tpmax,tpmax); for i=1:4 d(i)=32+(28/1200)*(2*i-1)*50G(i)=(77000*pi*d(i).^4)/3200k=[G(i) -G(i);-G(i) G(i)] endfor n=1:4 i=n+[0 1] j=i KG(i,j)=KG(i,j)+k end
Best Answer