Documentos de Académico
Documentos de Profesional
Documentos de Cultura
m 1 of 4
clear all
%Módulo de elasticidad
E=input('Ingrese el módulo de elasticidad:' );
end
for st=1:barras
for fil=1:2
if fil==1
sta1='Ingrese uno de los nodos relacionado con la barra' ;
sta2=num2str(st);
sta3=' :';
men=strcat(sta1,sta2,sta3);
IJ(st,fil)=input(men);
end
if fil==2
sta1='Ingrese el otro nodo relacionado con la barra' ;
7/08/18 10:01 AM C:\Users\camil\Desktop\TAREA.m 2 of 4
men=strcat(sta1,sta2,sta3);
IJ(st,fil)=input(men);
end
end
end
if Ac ==0
for Acc=1:barras
sta1='Ingrese el área para la barra' ;
sta2=num2str(Acc);
sta3=' :';
men=strcat(sta1,sta2,sta3);
At(Acc,1)=input(men);
end
end
%Matriz de rigidez
gl=nodos*3;
K=zeros(gl,gl);
for st=1:barras
cx=(X(IJ(st,2))-X(IJ(st,1)))/l(st);
cy=(Y(IJ(st,2))-Y(IJ(st,1)))/l(st);
cz=(Z(IJ(st,2))-Z(IJ(st,1)))/l(st);
if Ac==0
K_e=E*At(st)/l(st)*[cx^2 cx*cy cx*cz -cx^2 -cx*cy -cx*cz; cx*cy cy^2 cy*cz -cx*cy
-cy^2 -cy*cz; cx*cz cy*cz cz^2 -cx*cz -cy*cz -cz^2; -cx^2 -cx*cy -cx*cz cx^2 cx*cy
cx*cz; -cx*cy -cy^2 -cy*cz cx*cy cy^2 cy*cz; -cx*cz -cy*cz -cz^2 cx*cz cy*cz cz^2]
elseif Ac==1
K_e=E*A/l(st)*[cx^2 cx*cy cx*cz -cx^2 -cx*cy -cx*cz; cx*cy cy^2 cy*cz -cx*cy -
cy^2 -cy*cz; cx*cz cy*cz cz^2 -cx*cz -cy*cz -cz^2; -cx^2 -cx*cy -cx*cz cx^2 cx*cy
cx*cz; -cx*cy -cy^2 -cy*cz cx*cy cy^2 cy*cz; -cx*cz -cy*cz -cz^2 cx*cz cy*cz cz^2]
end
g_e=[3*IJ(st,1)-2 3*IJ(st,1)-1 3*IJ(st,1) 3*IJ(st,2)-2 3*IJ(st,2)-1 3*IJ(st,2)];
deltaK_e=zeros(gl,gl);
deltaK_e(g_e,g_e)=K_e;
K=K+deltaK_e;
end
%Apoyos
7/08/18 10:01 AM C:\Users\camil\Desktop\TAREA.m 3 of 4
cont=1;
contas=1;
sinapo=1;
for st=1:nodos
%Clase de apoyo
sta1='¿Tiene apoyo el nodo';
sta2=num2str(st);
sta3='? Si:1 No:0';
men=strcat(sta1,sta2,sta3);
ap=input(men);
if ap==0
apsd(cont)=st*3-2; %en x
apsd(cont+1)=st*3-1; %en y
apsd(cont+2)=st*3; %en z
cont=cont+3;
elseif ap==1
sta1=input('¿Qué clase de apoyo es? Fijo:0 Esfera:1' );
if sta1==0
apss(contas)=st*3-2; %en x
apss(contas+1)=st*3-1; %en y
apss(contas+2)=st*3; %en z
contas=contas+3;
elseif sta1==1
apsd(cont)=st*3-2; %en x
apsd(cont+1)=st*3-1; %en y
cont=cont+2;
apss(contas)=st*3; %en z
contas=contas+1;
end
end
end
%Fuerzas aplicada
for app=1:nF
F=input('¿En que nodo se encuentra la fuerza aplicada? ' );
P(3*F-1)=cooy;
P(3*F)=cooz;
end
%Cálculo de desplazamientos y reacciones
a=apss'; b=apsd';
K_aa=K(a,a);
K_ab=K(a,b);
K_ba=K(b,a);
K_bb=K(b,b);
P_b=P(b);
D_b=K_bb\P_b;
P_a=K_ab*D_b
D=zeros(39,1);
D(b)=D_b;
P_b
display(D)