You are on page 1of 5

# PRCTICA 1

## ANLISIS DE PROBLEMAS 1 Y 2 DE FERREIRA

1.

OJO A LA CARGA P = 10 + XX, DONDE XX SON LOS DOS LTIMOS DGITOS DEL CDIGO UNI.

## CALCULAR LOS DESPLAZAMIENTOS DE LOS NODOS.

2.

ANLISIS DE LA BARRA

SOLUCIN:
1.

## force(2)=10.0; (valor de la fuerza puntual aplicada)

for e=1:numberElements;

elementDof=elementNodes(e,:) ;

## stiffness(elementDof,elementDof)=stiffness(elementDof,elementDof)+[1 -1;-1 1];

end

prescribedDof=[1;3;4];

activeDof=setdiff([1:numberNodes],[prescribedDof]);

displacements=stiffness(activeDof,activeDof)\force(activeDof);

displacements1=zeros(numberNodes,1);

displacements1(activeDof)=displacements;

outputDisplacementsReactions(displacements1,stiffness,numberNodes,prescribedDof)

function outputDisplacementsReactions(displacements,stiffness,GDof,prescribedDof)

disp('Displacements')

jj=1:GDof;

[jj' displacements]

## F=stiffness*displacements; (clculo de la fuerza)

reactions=F(prescribedDof); (clculo de reacciones)

disp('Reactions')

[prescribedDof reactions]

2.

## clear all (se limpia la pantalla y se borra la memoria)

E = 30e6;A=1;EA=E*A; L = 90; (se inicializan los valores de las propiedades mecnicas del
material)

## numberElements=3; (inicializacin de los nmeros de elementos)

nodeCoordinates=linspace(0,L,numberElements+1);

xx=nodeCoordinates;

## numberNodes=size(nodeCoordinates,2); (inicializacin del nmero de nodos)

ii=1:numberElements;

elementNodes(:,1)=ii;

elementNodes(:,2)=ii+1;

displacements=zeros(numberNodes,1);

force=zeros(numberNodes,1);

stiffness=zeros(numberNodes,numberNodes);

force(2)=3000.0;

for e=1:numberElements;

elementDof=elementNodes(e,:) ;

nn=length(elementDof);

length_element=nodeCoordinates(elementDof(2))-nodeCoordinates(elementDof(1));

detJacobian=length_element/2;invJacobian=1/detJacobian;

[shape,naturalDerivatives]=shapeFunctionL2(0.0);

Xderivatives=naturalDerivatives*invJacobian;

## B=zeros(1,nn); B(1:nn) = Xderivatives(:);

stiffness(elementDof,elementDof)=stiffness(elementDof,elementDof)+B'*B*2*detJacobian*EA;
end

fixedDof=find(xx==min(nodeCoordinates(:))| xx==max(nodeCoordinates(:)))';

prescribedDof=[fixedDof]

activeDof=setdiff([1:numberNodes]',[prescribedDof]);

GDof=numberNodes;

displacements=solution(GDof,prescribedDof,stiffness,force);

outputDisplacementsReactions(displacements,stiffness,numberNodes,prescribedDof)

function [shape,naturalDerivatives]=shapeFunctionL2(xi)

shape=([1-xi,1+xi]/2)';

naturalDerivatives=[-1;1]/2;

## end % end function shapeFunctionL2

function displacements=solution(GDof,prescribedDof,stiffness,force)

activeDof=setdiff([1:GDof]',[prescribedDof]);

U=stiffness(activeDof,activeDof)\force(activeDof);

displacements=zeros(GDof,1);

## displacements(activeDof)=U; (clculo de los desplazamientos)

Funciones para los clculos
function [shape,naturalDerivatives]=shapeFunctionL2(xi)
shape=([1-xi,1+xi]/2)';
naturalDerivatives=[-1;1]/2;
end

function
outputDisplacementsReactions(displacements,stiffness,GDof,prescribedDof)
disp('Displacements')
jj=1:GDof;
[jj' displacements]
F=stiffness*displacements; (clculo de la fuerza)
reactions=F(prescribedDof); (clculo de reacciones)
disp('Reactions')
[prescribedDof reactions]