File Exchange

image thumbnail

Earthquake simulation and fitting

version 2.1 (87.8 KB) by E. Cheynet
Ground acceleration records are simulated using the non-stationnary Kanai–Tajimi model


Updated 28 Apr 2020

GitHub view license on GitHub

Ground acceleration records are simulated using the non-stationary Kanai–Tajimi model

Non-stationary ground acceleration records are simulated based on the example proposed in the paper of Guo et al. [3] that I have found well explained. However, the method itself is older, see e.g. [1, 2]. The present submission contains, in addition, a Matlab function to fit the non-stationary Kanai–Tajimi model to ground acceleration records.

The optimization toolbox is required for the fitting procedure (lsqcurvefit). However, other functions may alternatively be used. The signal processing toolbox is used here through the function filtfilt. Any comment, question or suggestions to improve the code is warmly welcomed.


[1] Lin, Y. K., & Yong, Y. (1987). Evolutionary Kanai-Tajimi earthquake models. Journal of engineering mechanics, 113(8), 1119-1137.

[2] Rofooei, F. R., Mobarake, A., & Ahmadi, G. (2001). Generation of artificial earthquake records with a nonstationary Kanai–Tajimi model. Engineering Structures, 23(7), 827-837.

[3] Guo, Y., & Kareem, A. (2016). System identification through nonstationary data using Time-Frequency Blind Source Separation. Journal of Sound and Vibration, 371, 110-131.

Cite As

E. Cheynet (2020). Earthquake simulation and fitting (, GitHub. Retrieved .

Cheynet, E. ECheynet/EarthquakeSim v2.1. Zenodo, 2020, doi:10.5281/ZENODO.3774070.

View more styles

Comments and Ratings (6)

E. Cheynet

Hi Christopher,
The Matlab version you use may be incompatible with the one I used. The present submission was written with Matlab R2013b, and should be compatible with more recent version and the version R2012

hi Cheynet :

First of all thanks for answer my question i really apreciate that jejeje cd. but once again i tried to use the example.m file you joined to the submission and it still gives me the NaN values after filtering. i didnt change anything on your program i just download your file and run it.
i even took the liberty of check the filter you are using and tried with others low pass filters (elliptic and chebysheb type I) but the problem is still the same, i am even having trouble in the narginchk because it said that the function is a undefine function or method for arguments of type double, and well the "y" and "t" values are matrix.

I am working in something very similar that you are using in your program, but i am using it to calculate the vibration produce by a blasting but i have been having some problems to calculate the parameters of my acceleration records because i am been unable to fit the envelope and calculate the exact parameters. i really think with your program you solve this problem but i cant make it work properly i dont know if you would be so sweet to help me with this...

E. Cheynet

Hi Cristopher,
Thanks for the feedback!
If I use the example I have joined to the submission, I do not see any NaN after filtering the envelop of the acceleration records. Did you get NaN values from real ground acceleration records? If yes:
- check if your data contain any NaN values
- This may be because the characteristics of your record is significantly different from the example I have attached. Fitting procedures may be sensitive to the initial values of the parameters to be fitted. That means that for a given acceleration record, the variable "guessEnvelop" has no reason to be exactly the same as in the example I have given.

Best regards,


did you notice that when you try to calculate the "Y = filtfilt(d1.sosMatrix,d1.ScaleValues, abs(hilbert(y)));" in the part of "
%% Get envelop parameters" you are having some NaN values?? i think this could be for the parameters you are using at the begining of the program or what do you think it coul be the problem, i tried to use it with some of the ground aceleration records i have and it didnt work too....

lei lu

Probably good. Let's check.

Jiaqi Xu

Nice code!



See release notes for this release on GitHub:


Created Github repository


Added the project website

Example updated

- updated description


MATLAB Release Compatibility
Created with R2019b
Compatible with R2013b to any release
Platform Compatibility
Windows macOS Linux