0% found this document useful (0 votes)
11 views8 pages

Lab 1

Seismic Engineering

Uploaded by

stiagolondonol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Lab 1

Seismic Engineering

Uploaded by

stiagolondonol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

EARTHQUAKE ENGINEERING: LAB – WS – PR

1. LABORATORY 1

1.1 Plot the time-history displacements of the structure of Figure 1 for both cases.
The solution, in terms of displacements 𝑢(𝑡) (m) of a SDOF system can be evaluated with Equation (1).

𝑣0 + 𝜁𝜔𝑛 𝑢0
𝑢(𝑡) = 𝑒 −𝜁𝜔𝑛 𝑡 (𝑢0 cos(𝜔𝑑 𝑡) + sin(𝜔𝑑 𝑡)) (1)
𝜔𝑑

where 𝑢0 and 𝑣0 are the initial conditions: initial displacement (m) and velocity (m/s) respectively.
𝜁 is the damping ratio, a dimensionless positive quantity that allow the energy dissipation (commonly less
than 0.05).
𝜔𝑛 (rad/s) is the natural pulsation or natural circular frequency and 𝜔𝑑 (rad/s) the damped pulsation.
To evaluate the natural frequency, 𝑓𝑛 , of the structure you need to compute the system’s stiffness 𝐾𝑠 (N/m or
Nm/rad) and the system’s mass, 𝑀𝑠 (kg). 𝐾𝑠 can be calculated by adding all the columns’ stiffness, 𝐾𝑐 , of the
SDOF system of Figure 1.

𝐾𝑠 = ∑ 𝐾𝑐,𝑖 (2)
𝑖

For this exercise you can consider, 𝐾𝑐,𝑖 = 𝐾𝑐 equal to:

12𝐸𝐽𝑐⁄
𝐾𝑐 = (3)
ℎ3

𝐸, 𝐽𝑐 , and ℎ are the Young’s modulus (N/m2), the moment of inertia (m4) and the height (m) of each column
(supposed to be the same in this exercise) respectively. 𝑀𝑠 can be instead estimated by knowing the surface
density, 𝜌 (kg/m2), and the dimensions, 𝐿 (m), of the floor (neglect the weight of the columns for this
exercise).
To build the time axis use the sampling time, 𝑡𝑠 (s), starting form 0 s up to a desired time 𝑡𝑒𝑛𝑑 . If 𝑡𝑒𝑛𝑑 =
10 𝑠 and 𝑡𝑠 = 0.01 𝑠 the time axis is: 𝑡 = 0 , 0.01 , 0.02 , 0.03 , 0.04 , … , 9.99 , 10 s (a vector of 1001
elements).
Figure 1.
MATLAB help:
1) If you need help to use a function use: help name_function;
2) Start each script with: close all; clear; clc;
3) End each row of the script with ;
4) Use % to introduce a comment in your script. Everything following % in the same row, will not be
evaluated by the program
5) To assign a value to a variable use: name_varible = value;
6) To build the time axis use: time_start:sampling_time:time_end;
7) To multiply, divide, sum, subtract or elevate scalar quantities use * / + - ^: variable3 = variable2 *
variable1;
8) To carry out vector or matrix operations (e.g. row column product) use * / + -: variable3 = variable2
* variable1;
9) If you want to evaluate the product, the division, the sum, the subtraction or the power elevation
between each element of two vectors or matrices having the same size use .* ./ + - .^: variable3 =
variable2 .* variable1;
For example, Equation (1) can be written as:
% defining the time vector
t=0:ts:tend;
% calculate the system responce
u1 = exp(-zita*omegan*t) .* ( u0*cos(omegad*t) +
(v0+zita*omegan*u0)*sin(omegad*t)/omegad );

10) To plot the results, use the following notation:


% open a new figure
figure;
% plot the case 1
plot(t,u1);
% superimpose case 2 to the case 1 in the same figure
hold on;
% plot the case 2 with a red line
plot(t,u2,'r');
% introduce the legend for case 1 and case 2
legend('case 1: u_0=0.03 m, v_0=0 m/s','case 2: u_0=0 m, v_0=3 m/s');
% introduce the background grid in the figure
grid on;
% introduce the axis labels and the title of the figure NB: Remember the
unit of measure!
xlabel('Time t (s)');
ylabel('Displacement u(t) (m)');
title('SDOF Time-History Displacement');

The output will be:

Figure 2.

What difference do you notice from the two responses? What kind of action is exercised in the two cases?

1.2 Choose one of the two previous cases. Then change the sampling time and plot the
time-history displacement for each assumption on ts to highlight the Nyquist criterion.
The sampling theorem states that a signal x(t) with null spectrum for |f|>Bf can be completely reconstructed
by its measured samples x(kts) if the sample frequency fs=1/ts is greater than 2Bf.
Bf (Hz) is the half-bandwidth of the signal. The Nyquist frequency is equal to fNY=2Bf, while the Nyquist
criterion states that the sampling frequency should respect Equation (4).

𝑓𝑠 > 2𝐵𝑓 (4)

For the SDOF system of Figure 1 one can approximate 𝐵𝑓 = 𝑓𝑛 . To demonstrate the validity of the Nyquist
criterion, choose a sampling frequency, fs, equal to 0.5𝑓𝑛 , 2𝑓𝑛 , 2.1𝑓𝑛 and 1⁄𝑡 = 100 𝐻𝑧 and plot the time-
𝑠
history for the four cases.

MATLAB help:
1) The number of elements in a column vector can be calculated using: num_rows = size(vector,1);
2) The number of elements in a row vector can be calculated using: num_cols = size(vector,2);
3) The number of elements along the columns and the rows in a matrix can be calculated using:
num_rows = size(matrix,1); num_cols = size(matrix,2); num_elem = num_rows * num_cols;
4) For a matrix nxm: [n,m] = size(matrix);
5) For a matrix nxm: y = length(matrix) = max(size(matrix)) = max([n,m]);
6) To plot the results, use the following notation:
figure;
% define sub-figure 1 (4 sub-figures along the columns and 1 sub-figure
% along the rows)
subplot(4,1,1);
plot(t1,u1,'r');
legend('case A: f_s=0.5f_n')
grid on;
ylabel('u_A(t) (m)');
% define sub-figure 2
subplot(4,1,2);
plot(t2,u2,'m');
legend('case B: f_s=f_N_Y')
grid on;
ylabel('u_B(t) (m)');
% define sub-figure 3
subplot(4,1,3);
plot(t3,u3,'g');
legend('case C: f_s=2.1f_n')
grid on;
ylabel('u_C(t) (m)');
% define sub-figure 4
subplot(4,1,4);
plot(t4,u4,'b');
legend('case D: f_s=100 Hz >> f_n')
grid on;
ylabel('u_D(t) (m)');
xlabel('t (s)');

where:
% evaluate the natural frequency
fn = omegan/(2*pi);
% calucalte the sampling frequency
fs1 = 0.5*fn; fs2 = 2*fn; fs3 = 2.1*fn; fs4 = 100;
% caluclate the sampling time
ts1 = 1/fs1; ts2 = 1/fs2; ts3 = 1/fs3; ts4 = 1/fs4;
% calulate the time axis
t1 = 0:ts1:tend;
t2 = 0:ts2:tend;
t3 = 0:ts3:tend;
t4 = 0:ts4:tend;

The output will be:


Figure 3.

Explain the Nyquist criterion and comment the plots. In case C the sampling frequency respect the Nyquist
criterion but the response is not properly reproduced, why? Theoretically speaking, what is the maximum
frequency reproducible by a 100 Hz sampled signal?

1.3 Calculate the Fourier transform of the previously determined sinusoidal signal
(sampled at 100 Hz): use the fft command. Then plot the amplitude and the phase of
the DOUBLE-SIDED SPECTRUM WITH NEGATIVE PART computed with FFT.
Remember that the Fourier transform of a signal is a complex signal in the frequency domain. Moreover, the
fft algorithm produce a Fourier transform composed of negative frequency components and positive
frequency components but the negative frequencies are shifted after the positive frequency and mirrored.
MATLAB help:
1) To compute the FFT of a signal use: FFT = fft(signal)*ts;
2) To shift the FFT use: FFTs = fftshift(FFT);
3) To compute the amplitude of the FFT use: amplitude = abs(FFTs);
4) To compute the phase of the FFT use: phase = angle(FFTs);
5) To plot the results, use the following notation:
figure;
subplot(2,1,1);
plot(f,abs(FFTs));
grid on;
ylabel('Amplitude |U(f)|');
title('Double-sided spectrum of u(t)');
subplot(2,1,2);
plot(f,angle(FFTs),'r');
grid on;
ylabel('Phase \phi(f) (rad)');
xlabel('f (Hz)');

where:
% calculate the FFT
FFT=fft(u)*ts;
% shift the FFT (just for the plot)
FFTs=fftshift(FFT);
% calculate the sampling frequency
fs = 1/ts;
% calculate the frequency resolution
fres = 1/tend;
% define the frequency axis
f = [-fs/2:fres:fs/2];

The output will be:

Figure 4: Left, if you choose case 1 of Figure 1. Right, if you choose case 2 of Figure 1.

Comment the figures. What happen near the natural frequency, why?

CURIOSITY:
Q1: Why do you need to scale the FFT output with the sampling time?
A1: Generally, scaling a FFT output is not important. However, this is necessary if you want to respect the
Plancherel theorem (the “energy” of the signal computed in time domain must be the same of what computed
in frequency domain). This can be written in MATLAB language as:
sum(u.*conj(u)*ts) = sum(FFT.*conj(FFT)*fresN)

where fresN = 1/(ts*length(u)) and it can differ from fres = 1/tend because the length of
the signal, while conj(…) denote the complex conjugate.

Example
ts = 0.01; % s
tend = 50; % s
t = 0:ts:tend; % it is a vector of 5001 elements
N = length(t); % N = 5001
fs = 1/ts; % fs = 100 Hz
fres = 1/tend; % fres = 0.02 Hz
fresN = (1/ts)/N; % fresN = (100)/5001 = 0.0199960007998… Hz
% If now we suppose that u is our signal we can have two cases:
% CASE 1: FFT output not scaled
FFT = fft(u);
% Checking the Plancherel theorem we obtain:
che = sum(u.*conj(u)*ts) / sum(FFT.*conj(FFT)*fresN); % che = 1e-4;

% CASE 2: FFT output scaled


FFT = fft(u)*ts;
% Checking the Plancherel theorem we obtain:
che = sum(u.*conj(u)*ts) / sum(FFT.*conj(FFT)*fresN); % che = 1;

% If we use fres insetad of fresN we obtain the same result with a


% numerical error:
che = sum(u.*conj(u)*ts) / sum(FFT.*conj(FFT)*fres); % che = 0.998;

This concept will be useful in the next laboratories.


Q2: What is the difference between sampling time, ts (s), frequency resolution, fres (Hz), length of the signal,
tend (s) and sampling frequency, fs (Hz)?

A2: 𝑡𝑠 = 1⁄𝑓 , 𝑓𝑟𝑒𝑠 = 1⁄𝑡 and 𝑡𝑒𝑛𝑑 = 𝑁𝑡𝑠 , 𝑓𝑠 = 𝑁𝑓𝑟𝑒𝑠 where N is the number of samples of the
𝑠 𝑒𝑛𝑑
time/frequency vector. See Figure 5 for clarity (N=10000).

Figure 5.
1.4 Calculate the Fourier transform of the records of Loma Prieta (1989), and plot the
amplitude and the phase of the Fourier transform (like in the point 1.3, DOUBLE-
SIDED SPECTRUM WITH NEGATIVE PART, see Figure 4).
The sampling frequency of the records is 200 Hz (ts=0.005 s) and the duration is 50 s. Rescale the
accelerations to get the measures in (m/s2) and then evaluate the FFT.
MATLAB help:
1) To load the Loma Prieta records use: load quake;
2) You can transpose the column vectors e, n and v obtained by the command quake using: e = e’; n =
n’; v = v’;
3) To rescale the records use: record_resc = (1/(g*100)) * record;
4) Compute the FFT for each component e, n and v (est, north and vertical) as in the point 1.3
5) If you want to save a graphic follow the step of Figure 6

a b

d
c
Figure 6: File\Export Setup…\Fonts\change the font (between 11 and 16)\Apply to Figure\Export…\save.

Plot the accelerations recorded and the amplitude and phase of the FFT for each record. Comments the
results. What is the difference between the FFT of point 1.3 and 1.4?

You might also like