Professional Documents
Culture Documents
clc
clear
f='(1-x^2)^(1/2)';
a=0;
b=3.1415/4;
n=100;
% f funcion
% a,b intevalo
% n numero partes
disp('Funcion: ');
f
disp('De [a: ');
a
disp('Hacia b]: ');
b
f=inline(f);
h=(b-a)/n;
aprox=f(a)+f(b);
for i=1:n-1
x=a+i*h;
aprox=aprox+2*f(x);
end
aprox=(h/2)*aprox;a=0;
disp(aprox);
Simpson 3/8
clear all;
clc;
fprintf('Calculo de la integral por el metodo de Simpson de 1/3\n\n');
f=input('introduce la funcion:','s');
a=input('lime inferior:');
b=input('limite superior:');
c=input('numero de segmentos a dividir (numero par):');
h=(b-a)/c;
z=0;
x=a;
for i=1:c;
if (-1)^i==1
k=eval(f);
z=z+k;
end
x=h*i;
end
zz=0;
x=a;
for i=2:c;
if (-1)^i==-1
k=eval(f);
zz=zz+k;
end
x=h*i;
end
x=a;
if x==a
d=eval(f);
end
x=b;
if x==b
e=eval(f);
end
z=z*4;
v=zz*2;
z=z+v+d+e;
z=z/(3*c);
z=z*(b-a)
fprintf('Resultado ');
Mtodo Cross
%------------------------------------------------------------------------%
PROGRAMA DE INGENIERA CIVIL
%
UNIVERSIDAD DE ANTIOQUIA
%
MTODO DE CROSS
%------------------------------------------------------------------------% - DESCRIPCION DEL PROGRAMA: calcula los momentos en cada uno
%
de los apoyos del sistema.
%
% - DESCRIPCION DATOS DE ENTRADA:
%
ND
: Numero de nudos del sisitema
%
NE
: Numero de elementos del sistema
%
E
: Modulo de elasticidad
%
L(i)
: Longitud del elemento i
%
I(i)
: Inercia del elemento i
%
K(i)
: Rigideces de los elementos
%
M(i)
: Vector de momentos
%
B(i)
: Vector de momentos iniciales
%
B1(i)
: Vector de momentos de equilibrio en los nudos
%
CD
: Coeficientes de distribucion
%
C
: Cantidad de cargas por elemento
%
TC
: Tipo de cargas en el elemento
%
TAI
: Tipo de apoyo del nodo inicial
%
TAF
: Tipo de apoyo del nodo final
%
w
: Carga distribuida
%
s
: distancia al nudo
%
P
: Carga puntual
%
E
: Error al que se quiere llegar
%
R
: Error calculado por iteracion
%
M1
: Vector de momentos a distribuir por cada nudo
%
M2
: Vector de momentos recibidos por cada nudo
%
M3
: Vector de momentos acumulados
%
% - CODIFICADO POR:
%
CARLOS CESAR DOMINGUEZ VEGA
%
ESTUDIANTE INGENIERIA CIVIL UDEA
% - ASESOR:
%
CARLOS ALBERTO RIVEROS JEREZ
%
GRUPO DE MODELAMIENTO DE SISTEMAS
%
PROGRAMA DE INGENIERA CIVIL
%
UNIVERSIDAD DE ANTIOQUIA
%
% - ULTIMA IMPLEMENTACION: SEPTIEMBRE 04 / 2009
%------------------------------------------------------------------------clc
clear all
diary on
fprintf('\n\t\t\t |
|');
fprintf('\n\t\t\t |
METODO DE CROSS
|');
% ------------------------- INGRESO DE DATOS ----------------------------fprintf('\n\t\t\t
|****************************************************|');
fprintf('\n\t\t\t
|****************************************************|');
fprintf('\n\t\t\t |NOTA: |');
fprintf('\n\t\t\t |1- LOS EMPOTRAMIENTO QUE SE TENGA EN LOS EXTREMOS,
TIENEN |');
fprintf('\n\t\t\t |
UN COEFICIENTE DE DISTRIBUCION = 0; LOS NUDOS
ARTICULADOS |');
fprintf('\n\t\t\t |
Y SIMPLEMENTE APOYADOS TIENEN UN COEFICIENTE DE
DISTRIBUCION =1 |');
fprintf('\n\t\t\t |2- LOS VOLADIZOS NO SE CUENTAN COMO ELEMENTOS |');
ND = input('\n\n INGRESE EL NMERO DE NUDOS: ');
NE = input('\n\n INGRESE EL NUMERO DE ELEMENTOS: ');
E
--------------------
B(2*i,1)=B(2*i,1) - (P*L(i))/(8);
elseif TC==4
P=input('INGRESE LA CARGA EN [T]: ');
s=input('\n INRECE LA DISTANCIA AL NUDO IZQUIERDO [m]: ');
B(2*i-1,1)=B(2*i-1,1) + (P*s*((L(i)-s)^2)/(L(i)));
B(2*i,1)=B(2*i,1) - (P*(s^2)*(L(i)-s)/(L(i)));
elseif TC==5
ME1=input('INGRESE LA ROTACION DEL APOYO INICIAL: ');
ME2=input('\n INGRESE LA ROTACION DEL APOYO FINAL: ');
B(2*i-1,1)=B(2*i-1,1) + ME1;
B(2*i,1)=B(2*i,1) - ME2;
elseif TC==6
w=input('INGRESE LA CARGA EN [T/m]: ');
B(2*i-1,1)=B(2*i-1,1) + (w*(L(i)^2)/(30));
B(2*i,1)=B(2*i,1) - (w*(L(i)^2)/(20));
end
end
end
B
B1(1)=B(1)+M(1);
B1(2*NE)=B(2*NE)+M(2*ND);
for i=2:2*NE-1
B1(i)=B(i);
end
B1
%-------------- VECTOR DE MOMENTOS CENTRALES--------------------------------------E = input('INGRESE EL VALOR DEL ERROR: ');
AUX = 0;
M3 = B;
R=100;
while R > E;
M1(1)=-CD(1)*B1(1);
M1(2*NE)=-CD(2*NE)*B1(2*NE);
for i=1:NE-1;
M1(2*i)=-CD(2*i)*(B1(2*i)+B1(2*i+1));
M1(2*i+1)=-CD(2*i+1)*(B1(2*i)+B1(2*i+1));
end
M1
for i=1:NE;
M2(2*i-1)=M1(2*i)/2;
M2(2*i)=M1(2*i-1)/2;
end
R=0;
for i=1:2*NE;
B1(i)=M2(i);
M3(i)=M1(i)+M2(i)+M3(i);
R=R+abs(M2(i));
end
M3
R
AUX=AUX+1;
end
AUX