MATLAB Examples

# Chopra (2012): Elastic response spectrum for Elcentro earthquake (California, May 18, 1940, NS component)

## Initial definitions

The following initial definitions are made (in the order presented below):

Open file elcentro.dat.

fid=fopen('elcentro.dat','r'); 

Read the text contained in the file elcentro.dat.

text=textscan(fid,'%f %f'); 

Close file elcentro.dat.

fclose(fid); 

Set the time step of the input acceleration time history.

time=text{1,1}; dt=time(2)-time(1); 

Set the input acceleration time history ().

xgtt=text{1,2}; 

Set the eigenperiod of an ideally zero-stiffness SDOF oscillator, in order to calculate the maximum velocity of the earthquake.

Tsoft=1000; 

Set the eigenperiod range for which the response spectra will be calculated.

Tspectra=logspace(log10(0.02),log10(50),1000)'; 

Set three distinct values for the critical damping ratio () of the response spectra to be calculated.

ksi1=0; ksi2=0.1; ksi3=0.2; 

Set the minimum absolute value of the eigenvalues of the amplification matrix.

rinf=1; 

Set the algorithm to be used for the integration.

AlgID='U0-V0-Opt'; 

Set the initial displacement of all SDOF oscillators analysed.

u0=0; 

Set the initial velocity of all SDOF oscillators analysed.

ut0=0; 

Take the maximum ground acceleration.

maxxgtt=max(abs(xgtt)); 

## Processing

Calculation of the maximum velocity of the earthquake.

[~,~,~,maxxgt,~]=LERS(dt,xgtt,Tsoft,0) 
maxxgt = 0.0368 

Extraction of the elastic response spectra and pseudospectra for the three values of the critical damping ratio.

[PSa1,PSv1,Sd1,Sv1,Sa1]=LERS(dt,xgtt,Tspectra,ksi1); [PSa2,PSv2,Sd2,Sv2,Sa2]=LERS(dt,xgtt,Tspectra,ksi2); [PSa3,PSv3,Sd3,Sv3,Sa3]=LERS(dt,xgtt,Tspectra,ksi3); 

## Validation

• Verification of figure 6.12.1 of Chopra (Dynamics of Structures, 2012).

Plot relative velocity and pseudo velocity spectra for .

figure('Name','Figure 6.12.1(a)','NumberTitle','off') semilogx(Tspectra,Sv2/maxxgt,'-b','LineWidth',1.) hold on semilogx(Tspectra,PSv2/maxxgt,'-r','LineWidth',1.) hold off grid on xlabel('T_n','FontSize',13); ylabel('S_V/maxv or PS_V/maxv','FontSize',13); title('Figure 6.12.1(a) of Chopra','FontSize',13) xlim([0.02,50]); legend('S_V/maxv','PS_V/maxv') 

Plot the pseudo-velocity/relative velocity ratio for the three values of the critical damping ratio ().

figure('Name','Figure 6.12.1(b)','NumberTitle','off') semilogx(Tspectra,PSv1./Sv1,'-b','LineWidth',1.) hold on semilogx(Tspectra,PSv2./Sv2,'-r','LineWidth',1.) semilogx(Tspectra,PSv3./Sv3,'-g','LineWidth',1.) hold off grid on xlabel('T_n','FontSize',13); ylabel('PS_V/S_V','FontSize',13); title('Figure 6.12.1(b) of Chopra','FontSize',13) xlim([0.02,50]); legend('\xi=0','\xi=0.1','\xi=0.2') 

Original figure 6.12.1 of Chopra (Dynamics of Structures, 2012).

• Verification of figure 6.12.2 of Chopra (Dynamics of Structures, 2012).

Plot acceleration and pseudo acceleration spectra for .

figure('Name','Figure 6.12.2(a)','NumberTitle','off') semilogx(Tspectra,Sa2/maxxgtt,'-b','LineWidth',1.) hold on semilogx(Tspectra,PSa2/maxxgtt,'-r','LineWidth',1.) hold off grid on xlabel('T_n','FontSize',13); ylabel('S_A/maxa or PS_A/maxa','FontSize',13); title('Figure 6.12.2(a) of Chopra','FontSize',13) xlim([0.02,50]); legend('S_A/maxa','PS_A/maxa') 

Plot the pseudo-acceleration/acceleration ratio for the three values of the critical damping ratio ().

figure('Name','Figure 6.12.2(b)','NumberTitle','off') semilogx(Tspectra,PSa1./Sa1,'-b','LineWidth',1.) hold on semilogx(Tspectra,PSa2./Sa2,'-r','LineWidth',1.) semilogx(Tspectra,PSa3./Sa3,'-g','LineWidth',1.) hold off grid on xlabel('T_n','FontSize',13); ylabel('PS_A/S_A','FontSize',13); title('Figure 6.12.2(b) of Chopra','FontSize',13) xlim([0.02,50]); legend('\xi=0','\xi=0.1','\xi=0.2','Location','SouthWest') 

Original figure 6.12.2 of Chopra (Dynamics of Structures, 2012).