%% for structure: % displacements: displacement vector % force: force vector % stiffness: stiffness matrix (matriz de rigidez) GDof=2*numberNodes; %GDof: total number of degrees od freedom displacements=zeros(GDof,1) force=zeros(GDof,1) % applied load at node 1 force(4)=-5000
ANDREA AGUILAR 2
force(8)-5000 force(9)=100000 % computation of the system stiffness matrix [stiffness]=formStiffness2Dtruss(GDof,numberElements,elementNodes,numberN odes,nodeCoordinates,xx,yy,EA) %% boundary conditions and solution prescribedDof=[1,2,11,12]'; %Posiciones donde no hay desplazamiento % solution displacements=solution(GDof,prescribedDof, stiffness,force)
for i=1:numberElements XX(i,:)=[xx(elementNodes(i,1)) xx(elementNodes(i,2))]; YY(i,:)=[yy(elementNodes(i,1)) yy(elementNodes(i,2))]; hold on plot(XX(i,:),YY(i,:),'b','LineWidth',2); end for j=1:numberElements for k=1:2:u-1 if displacements(k)~=0 XX1(j,:)=[xx(elementNodes(j,1))+displacements(k)*scale xx(elementNodes(j,2))]; YY1(j,:)=[yy(elementNodes(j,1))+displacements(k+1)*scale yy(elementNodes(j,2))]; hold on plot(XX1(j,:),YY1(j,:),'r'); end end end
%computation of the system stifness matrix for e=1:numberElements; %element Dof: element degrees of freedom indice=elementNodes(e,:); elementDof=[indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2]; %matrix of element coordinates
function displacements=solution(GDof, prescribedDof, stiffness, force)
%% function to find solutioin in terms of global displacements activeDof=setdiff([1:GDof]',[prescribedDof]); % SETDIFF(A,B)when A,B are vectors returns values in A that are not in B. U=stiffness(activeDof,activeDof)\force(activeDof); displacements=zeros(GDof,1); displacements(activeDof)=U;
FUNCIN ARMADURA:
function stress2Dtruss(numberElements,elementNodes,xx,yy,displacements,E)
%stress at elements for e=1:numberElements indice=elementNodes(e,:); elementDof=[indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2]; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; sigma(e)=E/length_element*[-C -S C S]*displacements(elementDof); end sigma=roundn(sigma,2)
ANDREA AGUILAR 4
RESULTADOS:
ANDREA AGUILAR 5
MATRIZ DE RIGIDEZ:
ANDREA AGUILAR 6
GRFICO:
ANDREA AGUILAR 7
EJERCICIO DE PRTICO:
Calcular las reacciones y esfuerzos del siguiente prtico:
CDIGO EN MATLAB:
%Armaduras 2D clc clear all %% E: modulus of elasticity % A: area of cross section % L: length of bar E=200000e6; A=2e-4; EA=E*A;
%% Generation of coordinates and connectivities elementNodes=[1 2;2 3;3 4]; numberElements=size(elementNodes,1); numberNodes=max(max(elementNodes)); nodeCoordinates=[0 0;0 3;4 3;9.2 0]; xx=nodeCoordinates(:,1); yy=nodeCoordinates(:,2);
%% for structure: % displacements: displacement vector % force: force vector % stiffness: stiffness matrix (matriz de rigidez) GDof=2*numberNodes; %GDof: total number of degrees od freedom displacements=zeros(GDof,1); force=zeros(GDof,1);
ANDREA AGUILAR 8
% applied load at node 1 force(3)=-2000; force(4)=1000; force(5)=-2000; force(4)=-300; force(6)=300; % computation of the system stiffness matrix [stiffness]=formStiffness2Dtruss(GDof,numberElements,elementNodes,numberN odes,nodeCoordinates,xx,yy,EA) %% boundary conditions and solution prescribedDof=[1,2,7,8]'; %Posiciones donde no hay desplazamiento % solution displacements=solution(GDof,prescribedDof, stiffness,force) %% Drawing displacements u=size(displacements); scale=20;
for i=1:numberElements XX(i,:)=[xx(elementNodes(i,1)) xx(elementNodes(i,2))]; YY(i,:)=[yy(elementNodes(i,1)) yy(elementNodes(i,2))]; hold on plot(XX(i,:),YY(i,:),'b','LineWidth',2); end % for j=1:numberElements % for k=1:2:u-1 % if displacements(k)~=0 % XX1(j,:)=[xx(elementNodes(j,1))+displacements(k)*scale xx(elementNodes(j,2))]; % YY1(j,:)=[yy(elementNodes(j,1))+displacements(k+1)*scale yy(elementNodes(j,2))]; % hold on % plot(XX1(j,:),YY1(j,:),'r'); % end % end % end
function displacements=solution(GDof, prescribedDof, stiffness, force)
%% function to find solutioin in terms of global displacements activeDof=setdiff([1:GDof]',[prescribedDof]); % SETDIFF(A,B)when A,B are vectors returns values in A that are not in B. U=stiffness(activeDof,activeDof)\force(activeDof); displacements=zeros(GDof,1); displacements(activeDof)=U;
FUNCIN PRTICO:
function stress2Dtruss(numberElements,elementNodes,xx,yy,displacements,E)
%stress at elements for e=1:numberElements indice=elementNodes(e,:); elementDof=[indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2]; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; sigma(e)=E/length_element*[-C -S C S]*displacements(elementDof); end sigma=roundn(sigma,2)
Mentalidades matemáticas: Cómo liberar el potencial de los estudiantes mediante las matemáticas creativas, mensajes inspiradores y una enseñanza innovadora
Física cuántica para principiantes: Descubra los fundamentos de la mecánica cuántica y cómo afecta al mundo en que vivimos a través de todas sus teorías más famosas