Solution for MECH 4450 Homework #3 1. (a) The connectivity matrix EC EC=[1 2 2 3;2 3 4 4] EC = 1 2 2 3 2 3 4 4 (b) The MATLAB code to generate the property matrix : E=3*10^7*ones(4,1); A=1.5*ones(4,1); L=[30;40;50;30]; Prop=[E A L] The running result: Prop = 1.0e+007 * 3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000 0.000000150000000 0.000000150000000 0.000000150000000 0.000000150000000 0.000003000000000 0.000004000000000 0.000005000000000 0.000003000000000 (c) The function to generate stiffness matrix of element is: function K=local_stiff(E,A,L,th) k=[cos(th).^2 sin(th).*cos(th); sin(th).*cos(th) sin(th).^2]; K=E*A/L*[k -k;-k k]; Calling this function: Angle=[0;pi/2;pi/2+atan(3/4);pi] for i=1:4 E(i)=Prop(i,1); A(i)=Prop(i,2); L(i)=Prop(i,3); th=Angle(i); local_stiff(E(i),A(i),L(i),th) end Running result: Angle = 0 1.5708 2.2143 3.1416 K= 1500000 0 -1500000 0 0 -1500000 0 0 0 1500000 0 0 0 0 0 0 K= 1.0e+006 * 0.0000 0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 1.1250 -0.0000 -1.1250 -0.0000 0.0000 0.0000 -1.1250 0.0000 1.1250 K= 1.0e+005 * 3.2400 -4.3200 -3.2400 4.3200 -4.3200 5.7600 4.3200 -5.7600 -3.2400 4.3200 3.2400 -4.3200 4.3200 -5.7600 -4.3200 5.7600 K= 1.0e+006 * 1.5000 -0.0000 -1.5000 0.0000 -0.0000 0.0000 0.0000 -0.0000 -1.5000 0.0000 1.5000 -0.0000 0.0000 -0.0000 -0.0000 0.0000 (d) The function to generate the global matrix: function Gmatrix=global_stiff(n,Prop,angle,EC) globalstiffM=zeros(2*n); for m=1:n E(m)=Prop(m,1); A(m)=Prop(m,2); L(m)=Prop(m,3); th=angle(m); localM=local_stiff(E(m),A(m),L(m),th); if m==3 %refer to element 3 in the EC table I=2*(EC(1,m)-1); J=2*(EC(2,m)-2); globalstiffM(1+I:2+I,1+I:2+I)=globalstiffM(1+I:2+I,1+I:2+I)+ localM(1:2,1:2); globalstiffM(1+I:2+I,3+J:4+J)=globalstiffM(1+I:2+I,3+J:4+J)+ localM(1:2,3:4); globalstiffM(3+J:4+J,1+I:2+I)=globalstiffM(3+J:4+J,1+I:2+I)+ localM(3:4,1:2); globalstiffM(3+J:4+J,3+J:4+J)=globalstiffM(3+J:4+J,3+J:4+J)+ localM(3:4,3:4); else for i=1:4 for j=1:4 I=i+2*(EC(1,m)-1); J=j+2*(EC(1,m)-1); globalstiffM(I,J)=globalstiffM(I,J)+localM(i,j); end end end end Gmatrix=globalstiffM; Calling this function: EC=[1 2 2 3;2 3 4 4]; E=3*10^7*ones(4,1); A=1.5*ones(4,1); L=[30;40;50;30]; n=4; Prop=[E A L]; Angle=[0;pi/2;pi/2+atan(3/4);pi] global_stiff(n,Prop,Angle,EC); Running result: (e) Considering the boundary conditions, u1 0 P1 ? v 0 Q ? 1 1 u 2 ? P2 4000lb Q ? 2 v2 0 = Gmatrix P 0 3 u3 ? Q3 0 v3 ? P4 ? u 4 0 Q4 ? v 4 0 Referring to the Gmatrix in part (d), we can get the condensed matrix: P2 4000lb 1.824 0 0 u 2 6 1.5 0 ] u 3 P3 0 10 [ 0 Q 0 0 0 1.125 v 3 3 u 2 Once the values of u 3 are determined, loading matrix [P] can be directly v 3 computed. (f) Solving by MATLAB: A=10^6*[1.824 0 0;0 1.5 0;0 0 1.125]; b=[4000;0;0]; u=inv(A)*b Result: u= 0.0022 0 0 Thus, u2 0.0022 in, u3 0 , v3 0 Substitute these values, we obtain that P1 Q 1 P2 Q 2 P =1000* 3 Q3 P4 Q4 (g) Displacement field of each member: u1 0 v 1 0 Element1: = { } 0.0022 u 2 0 v 2 u 2 0.0022 v 2 0 Element2: = { } 0 u 3 0 v3 u 3 0 v 3 0 Element4: = { } 0 u 4 0 v 4 u 2 0.0022 v 2 0 Element3: = { } 0 u 4 0 v 4 The forces in each element can be computed: P1 II P1 I 0 −3289.5 II I Q Q 1 1 0 0 I = { 3289.5 } II = {0} P2 P2 II 0 0 I Q Q 2 2 P1 III P1 IV 0 709.56 III IV Q1 Q1 0 −946.08 III = {−709.56} IV = {0} P2 III P2 0 946.08 Q Q IV 2 2 The stress and strain in each element: 3289.5 𝜎 𝜎1 = = 2193 𝑝𝑠𝑖, 𝜀1 = 1 = 7.31 × 10−5 1.5 𝐸 𝜎2 = 0, 𝜀2 = 0 √(709.562 +946.082 ) 𝜎3 = 1.5 𝜎4 = 0, 𝜀4 = 0 = 788.4 𝑝𝑠𝑖, 𝜀3 = 𝜎3 𝐸 = 2.63 × 10−5 (h) From the calculations above, we can see that the reaction force at node 2 in the y direction is Q2 947.4 lb 2. (a) The beam is divided into two elements as shown in the above figure. The local element equation of each element is expressed as: Element I Q1 I q1 I 3L 6 3L v1 6 I I 3L 2 L2 3L L2 Q2 q 2 2 EI 1 I I 3 6 3L v 2 Q3 q3 L 6 3L 2 I I Q q 3L 2 L2 2 3L L 4 4 Element II Q1 II 3L 6 3L v 2 6 II 3L 2 L2 3L L2 Q2 2 EI 2 II 3 6 3 L v3 Q3 L 6 3L 2 II Q 3L 2 L2 3 3L L 4 By assembling the systems, the global system is expressed as P1 q1 I M I 1 q 2 P2 q 3 I 2 EI I 3 L M 2 q 4 P3 0 M 3 0 3L 6 3L 0 0 v1 6 3L 2 L2 3L L2 0 0 1 6 3L 12 0 6 3L v 2 2 0 4 L2 3L L2 2 3L L 0 0 6 3L 6 3L v 3 2 0 3L L 3L 2 L2 3 0 (b) The known boundary conditions are v1 v2 0m 1 0rad The known loading conditions are P3 2500 k (v3 ) , M 2 1250N m , M 3 0 N m q1 I qL / 2 2500 N I qL2 / 12 2083 N m q 2 L I 0 i q dx q3 qL / 2 2500 N q I qL2 / 12 2083 N m 4 (c) By imposing boundary conditions and loading conditions, the condensed system is expressed as: 4 L2 3L L2 2 1250 2083 3 kL 2 EI 3L v 3 2500 3 3L 6 2 EI L 2 0 3L 2 L2 3 L (d) By using MATLAB to solve the equations, the unknown nodal displacements are found as 2 0.0000724rad v3 0.000879m 0.0002275rad 3 Then unknown reactions can be found as I 0 2 q1 974 N P1 3L 0 2 EI 2 I 0 0 v3 q 2 3707 N m M 1 3 L P L 0 6 3L q I 8456 N 2 3 3 (e) The MATLAB code for shear force and moment: P=[-974 8456]; q=-1000; M1=-3707; x1=linspace(0,5,20); x2=linspace(5,10,20); for i=1:length(x1) y1(i)=P(1)+q*x1(i); y3(i)=P(1)*x1(i)+0.5*q*x1(i)^2-M1; end for j=1:length(x2) y2(j)=P(2)+y1(i); y4(j)=(P(2)+y1(i))*(x2(j)-10); end subplot 211; plot(x1,y1,'k',x2,y2,'k','linewidth',3); ylabel('N','Fontsize',20); legend('Shear force(N)'); grid on; subplot 212; plot(x1,y3,'r-o',x2,y4,'r-o','linewidth',3); xlabel('x(m)','Fontsize',20); ylabel('Nm','Fontsize',20); legend('Moment') grid on; The diagram: 3. a) The MATLAB code for generating the local matrix: function K=Q3local_stiff(E,A,I,L,th) Q1=[cos(th) sin(th) 0; -sin(th) cos(th) 0; 0 0 1]; Q=[Q1 zeros(3);zeros(3) Q1]; k=[A*E/L 0 0, -A*E/L 0 0; 0 12*E*I/L^3 6*E*I/L^2, 0 0 6*E*I/L^2 4*E*I/L, 0 -A*E/L 0 0, A*E/L 0 0; 0 -12*E*I/L^3 -6*E*I/L^2, 0 6*E*I/L^2 2*E*I/L, 0 K=Q'*k*Q; -12*E*I/L^3 6*E*I/L^2; -6*E*I/L^2 2*E*I/L; 0 12*E*I/L^3 -6*E*I/L^2; -6*E*I/L^2 4*E*I/L;]; Calling this function: clc; clear all; format short; EC=[1 2;2 3]; E=3*10^7*ones(2,1); A=100*ones(2,1); I=[1000,1000]'; L=[30*sqrt(2)*12,40*12]'; Prop=[E A I L]; Angle=[pi/4;0] for i=1:2 th=Angle(i); Q3local_stiff(E(i),A(i),I(i),L(i),th) end The result: (b) The function to obtain the global stiffness matrix: function Gmatrix=Q3global_stiff(Prop,angle,EC) globalstiffM=zeros(9); for m=1:2 E(m)=Prop(m,1); A(m)=Prop(m,2); I(m)=Prop(m,3); L(m)=Prop(m,4); th=angle(m); localM=Q3local_stiff(E(m),A(m),I(m),L(m),th); for i=1:6 for j=1:6 I=i+3*(EC(1,m)-1); J=j+3*(EC(1,m)-1); globalstiffM(I,J)=globalstiffM(I,J)+localM(i,j); end end end Gmatrix=globalstiffM; Calling the function Q3global_stiff: clc; clear all; format short; EC=[1 2;2 3]; E=3*10^7*ones(2,1); A=100*ones(2,1); I=[1000,1000]'; L=[30*sqrt(2)*12,40*12]'; Prop=[E A I L]; Angle=[pi/4;0] GlobalMatrix=Q3global_stiff(Prop,Angle,EC) The result: (c) Boundary conditions: 𝑢1 = 0, 𝑣1 = 0, 𝜃1 = 0; 𝑅2 = 0, 𝑆2 = 0, 𝑀2 = 0; 𝑢3 = 0, 𝑣3 = 0, 𝜃3 = 0; q1 II qL / 2 2 10 4 lb II qL2 / 12 6 L q 2 1.6 10 lb in II 0 i q dx 4 q3 qL / 2 2 10 lb q II qL2 / 12 1.6 10 6 lb in 4 By row operations, the condensed system can be obtained: 0 u 2 0.092 0.0294 0.0049 4 8 { 210 } = 10 × [0.0294 0.0295 0.0029] × v 2 0.0049 0.0029 4.8570 1.6 10 6 2 P1 −0.0295 −0.0294 −0.0049 S 1 −0.0294 −0.0295 0.0049 M1 0.0049 −0.0049 1.1785 × 8 10 × −0.0625 0 0 R 3 0 0 −0.0078 4 S 3 2 10 [ 0 0.0078 1.25 ] M 3 1.6 10 6 u 2 v 2 2