code matlab BASE ISOLATION
code matlab BASE ISOLATION
clear all
close all
%==========================================================
=====================
disp(date)
disp('MATLAB CODE by VINOD KUMAR A M.Tech. (STE)')
disp('date:23/1/2019')
disp('STRUCTURAL DYNAMICS')
disp('NEWMARKS METHOD TO FIND THE RESPONSE OF THE STRUCTURE');
disp('NEWMARKS LINEAR ACCELERATION METHOD =1');
disp('NEWMARKS CONSTANT AVERAGE ACCELERATION METHOD =2');
disp('________________________________________________________________')
ty=input('enter the TYPE OF NEWMARKS METTHOD');
disp('========================================================
==========');
if ty==2
g=1/2
b=1/4
elseif ty==1
g=0.5
b=1/6
end
end
%==========================================================
=====================
H=input('enter the height of liquid in the tank in meters=')
R=input('enter the radius of the tank in meters=')
S=H/R
Yc = 1.01327 -0.87578*S + 0.35708*S^2-0.06692*S^3 + 0.000439*S^4
Yi = -0.15467 + 1.21716*S -0.62839*S^2 + 0.14434*S^3 -0.0125*S^4
Yr= 0.01599 +.86356*S -0.30941*S^2+ .04083*S^3
m=pi*R*R*H*9.81
mc=m*Yc
mi=m*Yi
mr=m*Yr
P = 0.07726+.17563*S-0.106*S*S + .02609*S^3-0.0025*S^4
M=[mc 0 mc;0 mi mi;mc mi mc+mi+mr]
g=9.81
wc=sqrt(1.84*(g/R)*tanh(1.84*S))
rhos=input('enter the density of tank wall in kg/m^3=')
Em=input('enter the youngs modulus of the tank wall in KN/m^2=')
E=Em/9.81
zc=input('enter the damping ratio of the convective mass in %=')
zi=input('enter the damping ratio of the impulsive mass in %=')
zb=input('enter the damping ratio of the base isolator in %=')
wi=(P/H)*sqrt(E/rhos)
Tb=input('enter the time period of the base isolator in sec=')
wb=2*pi/Tb
%-------------------------------------------------------------------------
cc=2*zc*mc*wc
ci=2*zi*wi*mi
cb=2*zb*(mc+mi+mr)*wb
%-------------------------------------------------------------------------
kc=mc*wc*wc
ki=mi*wi*wi
kb=((mc+mi+mr)*4*pi*pi)/(Tb^2)
%-------------------------------------------------------------------------
cd=[cc ci cb]
C=diag(cd)
kd=[kc ki kb]
K=diag(kd)
%%--------------------------------------------------------------------
[v1 D]=eig(K,M)
disp('****eigen vectors or MODE SHAPES VALUES*********')
disp(v1);
disp('------------------------------------------------------------------')
disp('******eigen values OR FREQUENCIES (W) ******');
disp(D);
disp('-----------------------------------------------------------------')
disp('***********frequencies(W)************');
disp('_______________________________________________________________')
W=diag(sqrt(D));
disp(W);
disp('-----------------------------------------------------------------')
disp('*******time periods IN SECONDS**********')
T=(2*pi)./W
fori=1:length(v1)
vm(:,i)= v1(:,i)./v1(1,i);
end
disp('_______________________________________________________________')
disp('******MODIFIED eigen vectors or MODE SHAPES VALUES*********')
disp('_______________________________________________________________')
disp(vm)
disp('_______________________________________________________________')
disp('modal matrices')
disp('_______________________________________________________________')
Mstar=v1'*M*v1
Kstar=v1'*K*v1
Cstar=v1'*C*v1
disp('_______________________________________________________________')
nst=length(cd)
%-------------------------------------------------
[filename pathname]=uigetfile({'*.xlsx'},'file selector');
fullpathname=strcat(pathname,filename)
text=xlsread(fullpathname);
t=text(:,1);
di=text(:,2);
% de=xlsread('CHAMBA.xlsx');
format short
fori=1:nst
f(:,i)=-di*Mstar(i,i);
end
pstar=v1*f';
Pstar=pstar';
u0=zeros(nst,1)';
v0=zeros(nst,1)';
fori=1:nst
acc0=inv(Mstar)*(Pstar(1,:)'-Cstar*v0'-Kstar*u0')
end
dt=t(2)-t(1);
kba=(Kstar+(g/b))*Cstar+(1/(b*dt*dt))*Mstar;
kinv=inv(kba);
aa=(1/(b*dt))*Mstar+(g/b)*Cstar;
bb=(1/(2*b))*Mstar+dt*(g/(2*b)-1)*Cstar;
u(1,:)=u0;
v(1,:)=v0;
acc(1,:)=acc0;
fori=2:length(f)
df(i,:)=Pstar(i,:)-Pstar(i-1,:)+v(i-1,:)*aa'+acc(i-1,:)*bb';
du(i,:)=df(i,:)*kinv;
dv(i,:)=(g/(b*dt))*du(i,:)-(g/b)*v(i-1,:)+dt*(1-g/(2*b))*acc(i-1,:);
da(i,:)=(1/(b*dt*dt))*du(i,:)-(1/(b*dt))*v(i-1,:)-(1/(2*b))*acc(i-1,:);
u(i,:)=((u(i-1,:)+du(i,:)))*v1;
v(i,:)=(v(i-1,:)+dv(i,:))*v1;
acc(i,:)=(acc(i-1,:)+da(i,:))*v1;
end