0% found this document useful (0 votes)
54 views5 pages

%% Datos Generales

The document is a MATLAB code that performs two simulations of a single-degree-of-freedom system subjected to earthquake ground motion. The code uses: 1) excitation interpolation to determine the ground acceleration at each time step, and 2) central difference method to solve the equations of motion. It then compares the maximum displacement and acceleration spectra obtained from both methods over a range of natural periods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

%% Datos Generales

The document is a MATLAB code that performs two simulations of a single-degree-of-freedom system subjected to earthquake ground motion. The code uses: 1) excitation interpolation to determine the ground acceleration at each time step, and 2) central difference method to solve the equations of motion. It then compares the maximum displacement and acceleration spectra obtained from both methods over a range of natural periods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Nombre: Ivan Escandon

Curso: 7mo “C”

clc ;
clear all;
Cont=0;
k=666562.5;
dt=0.02;
shi=0.05;

for Tn=0.001:0.01:10
Cont=Cont+1;
Wn=2*pi()./Tn;
m=k/Wn^2 ;
T(Cont,1)=Tn;

Wd=Wn*sqrt(1-shi^2);

%% Datos Generales
g=9.81 ;
load elcentro.txt
p=elcentro*g ;
f=(p);
t=(length(f)*0.02)-0.02 ;
t1=(0:0.02:t);
t2=t1';
%% Interpolacion
A=exp(-shi*Wn*dt).*((shi*sin(Wd*dt))/(sqrt(1-shi^2))+cos(Wd*dt));
B=exp(-shi*Wn*dt).*(sin(Wd*dt)/Wd);
C=(1/k)*((2*shi/(Wn*dt))+exp(-shi*Wn*dt).*(((1-2*shi^2)/(Wd*dt)-
shi/(sqrt(1-shi^2)))*sin(Wd*dt)-(1+(2*shi)/(Wn*dt))*cos(Wd*dt)));
D=(1/k)*(1-(2*shi)/(Wn*dt)+exp(-shi*Wn*dt).*(((2*shi^2-
1)*sin(Wd*dt))/(Wd*dt)+(2*shi*cos(Wd*dt))/(Wn*dt)));
a=-exp(-shi*Wn*dt).*((Wn*sin(Wd*dt))/(sqrt(1-shi^2)));
b=exp(-shi*Wn*dt).*(cos(Wd*dt)-(shi*sin(Wd*dt))/(sqrt(1-shi^2)));
c=(1/k)*(-1/dt+exp(-shi*Wn*dt).*(((Wn)/(sqrt(1-shi^2))+(shi)/(dt*sqrt(1-
shi^2)))*sin(Wd*dt)+(cos(Wd*dt))/(dt)));
d=(1/(k*dt))*(1-exp(-shi*Wn*dt).*((shi*sin(Wd*dt))/(sqrt(1-
shi^2))+cos(Wd*dt)));

uo=0 ;
vo=0 ;
u(1,1)=uo;
v(1,1)=vo;

p=-f*m;

for i=1:length(t1)-0.2

u(i+1,1)=A*u(i,1)+B*v(i,1)+C*p(i,1)+D*p(i+1);
v(i+1,1)=a*u(i,1)+b*v(i,1)+c*p(i,1)+d*p(i+1);
end
umax(Cont,1)=max(abs(u(:,1)));
Sa(Cont,1)=Wn.^2.*umax(Cont,1);
end

Cont2=0;
for Tn=0.01:0.01:10
Cont2=Cont2+1;
T2(Cont2,1)=Tn;
Wn2=2*pi()./Tn;
m2=k/Wn2^2 ;
%% Datos
g=9.81 ;
load elcentro.txt
p=elcentro*g ;
f=(p);
t=(length(f)*0.02)-0.02 ;
t1=(0:0.02:t);
t2=t1;
p=-f*m2;

c=2*m2*Wn2*shi;
k1=m2/dt^2+c/(2*dt);
A1=m2/dt^2-c/(2*dt);
B1=k-2*m2/(dt^2);
p=[0;p];

uo=0 ;
vo=0 ;

u2(2,1)=uo;
v2(2,1)=vo;
a2(2,1)=(-k*u2(1,1)-c*v2(1,1))/m2;

for i=2:length(t1)-0.2

p1(i,1)=p(i,1)-A1*u2(i-1,1)-B1*u2(i,1);
u2(i+1,1)=p1(i,1)/k1
end
umax2(Cont2,1)=max(abs(u2(:,1)));
Sa2(Cont2,1)=Wn2.^2.*umax2(Cont2,1);
end
figure
plot(T2,umax2,'red')
hold on
plot(T,umax,'blue')
hold on
legend('Interpolacion de Excitacion','Diferencia Central ')
xlabel(' Tiempo (Tn) ');
ylabel(' Espectro de Desplazamiento (m) ');
figure
plot(T,Sa,'red')
hold on
plot(T,Sa2,'blue')
legend('Interpolacion de Excitacion','Diferencia Central ')
xlabel(' Tiempo (Tn) ');
ylabel(' Espectro de Aceleracion (m/s^2) ');

You might also like