Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
1
2
3
4
6
6
6
7
7
Response Spectrum
[filename, pathname] = uigetfile('*.*');
filename = fullfile(pathname, filename);
%
fid = fopen(filename,'r'); % input of base accelerations in [m/s^2]
THM = fscanf(fid,'%g %g',[2 inf]);
THM=THM';
%
t=double(THM(:,1));
y=double(THM(:,2));
%
tmx=max(t);
tmi=min(t);
n = length(y);
%
out1 = sprintf('\n %d samples \n',n);
disp(out1);
%
dt=(tmx-tmi)/(n-1);
sr=1./dt;
%
out1 = sprintf(' SR = %g samples/sec
dt = %g sec \n',sr,dt);
disp(out1);
%
f_start = 1 ; % starting frequency (Hz)
f_end = 20 ; % end frequency (Hz)
delta_f = 1 ; % frequency increment (Hz)
freq_num = round((f_end - f_start + 1) / delta_f);
fprintf('Start frequency = %f [Hz]\n', f_start);
fprintf('End frequency = %f [Hz]\n', f_end);
fprintf('Frequency increment = %f [Hz]\n', delta_f);
%
zeta = input('Enter the damping coefficient zeta [% of critical damping]: ') / 100;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate the response spectrum %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
S_pv = zeros(freq_num,1);
S_d = zeros(freq_num,1);
S_a = zeros(freq_num,1);
frequencies = zeros(freq_num,1);
disp(' ');
disp(' Calculating response..... ');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% YOUR TASK: Calculate the response spectrum %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for freq_count = 1:freq_num
freq = (freq_count-1)*delta_f;
omega= 2*pi*freq;
fprintf('Current freuency = %f [Hz]\n', freq);
x= zeros(n,1);
for ii = 1:n
for jj = 1:ii
sin_val = sin(omega*dt*(ii-jj));
exp_val = exp(-zeta*omega*dt*(ii-jj));
x(ii) = x(ii)+y(jj)*exp_val*sin_val;
end
end
S_pv(freq_count) = max(abs(x));
S_d(freq_count) = S_pv(freq_count)/omega;
S_a(freq_count) = S_pv(freq_count)*omega;
frequencies(freq_count) = freq;
clear('x');
end
Eigenvalues Problem
M = [m, m*h/2;m*h/2, 2*m*h^2/3];
K = [2*k, k*h; k*h, k*h^2];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% solve the generalized eigenvalue problem%
%
YOUR TASK !!!%
% solution should be called [eigenvectors, eigenvalues]
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[eigenvectors,eigenvalues] = eig(K,M);
nat_freq_eigenval= sqrt(eigenvalues)/(2*pi);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% solve the problem with the characteristic equation%
%
YOUR TASK !!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
polynom = [(M(1,1)*M(2,2)-M(2,1)*M(2,2))...
(K(2,1)*M(1,2)+K(1,2)*M(2,1)-K(1,1)*M(2,2)-K(2,2)*M(1,1))...
(K(1,1)*K(2,2)-K(1,2)*K(2,1))];
omega_square = roots(polynom);
nat_freq_poly = sqrt(omega_square) / (2*pi);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% solution from lecture%
%
YOUR TASK !!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f_1 = sqrt(6*k/(5*m))/ (2*pi);
X(:,ii+1) = Meff\Feff ;
X_dot(:,ii) = a1*(X_dot(:,ii-1)+X_dot(:,ii+1));
X_dotdot(:,ii) = a0*(X(:,ii+1)-2*X(:,ii)+X(:,ii-1));
end
Logarithmic Decrement
%%%%%% This is your task ! %%%%%%
omega_0 = sqrt(k/m);
freq = omega_0/(2*pi);
period = 1/freq;
log_decrement =zeta*omega_0*period;
IRF
calculate dynamic parameters
omega = sqrt(k/m);
ccrit = 2 * m * omega;
zeta = c/ccrit;
%calculating time period
%T=Time period
T=2*pi/omega;
t=(0:T/20:n*T);
H=(1/(m*omega))*sin(omega*t);
H_damped= exp(-zeta*omega*t)/(m*sqrt(1-zeta^2)*omega)...
.*sin(sqrt(1-zeta^2)*omega*t);
x(ii+1)=(F(ii+1)+(m*multi2)+(c*multi3))/multi1;
x_dot(ii+1)=(2*(x(ii+1)-x(ii))/delta_t)-x_dot(ii);
x_ddot(ii+1)=(F(ii+1)-c*x_dot(ii+1)-k*x(ii+1))/m;
end
end
Duhamel Integral
if (1)
% this case uses the general discretized Duhamel integral
for ii=1:numTimeSteps
for jj= 1:ii
exp_val=exp(-zeta*omega*delta_t*(ii-jj));
sin_val=sin(omega_damped*delta_t*(ii-jj));
x(ii)=x(ii)+F(jj)*exp_val* sin_val;
end
x(ii)=x(ii)*(omega*delta_t)/(k*eta);
end
else
% this case uses the discretized Duhamel integral for base excitation
for jj= 1:ii
exp_val=exp(-zeta*omega*delta_t*(ii-jj));
sin_val=sin(omega_damped*delta_t*(11-jj));
x(ii)=x(ii)+x_b(jj)*exp_val* sin_val;
end
x(ii)=x(ii)*(omega*delta_t)/(k*eta);
end
x_1=x(ii);
x_ddot_1=x_ddot_0;
diff=1;
fprintf('Time step = %f \n', ii);
while diff>1e-8
x_dot_1=x_dot_0+(1-gamma)*delta_t*x_ddot_0+gamma *delta_t*x_ddot_1;
x_new=x_0+delta_t*x_dot_0+(0.5-beta)*delta_t^2*x_ddot_0+beta*delta_t^2*x_dd
x_ddot_1=(F(ii)-c*x_dot_1-k*x_new)/m;