You can use this code to (i) compute spectral acceleration response spectrum of a given ground motion, and (ii) compute acceleration, velocity and displacement time histories for a single-degree-of-freedom (SDOF). Numerical integration is implemented by using Newmark-bata method. The code solves the motion equation for a SDOF represented by a mass and dashpot as shown in the Figure below.
The code is object-oriented and includes two main classes:
- class “Spectrum”: calculates acceleration response spectrum of an input ground motion in “g”.
- class “timeHistory”: calculates acceleration, velocity, and displacement time histories of a given SDOF subjected to a given earthquake motion.
You can download the .cpp and .hpp files here: Spectral-Response-Analysis.zip (last updated July 08, 2018)
A sample main file is also included to clarify how to properly use the classes and functions. The code is verified, however it is highly recommended that you carry out your own verification.
I look forward to hearing your feedback.