Skip to content
This repository was archived by the owner on Jun 7, 2025. It is now read-only.

Commit 1dfceee

Browse files
committed
Update README
1 parent b2a26a7 commit 1dfceee

File tree

1 file changed

+62
-3
lines changed

1 file changed

+62
-3
lines changed

README.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Normalized spectrogram to seismic acceleration written in *Matlab*. The algorith
1414
The normalized spectrogram function is defined by:
1515

1616
```matlab
17-
matrix = normspectrogram(t, acc, regname)
17+
[matrix, matrix_t, matrix_f] = norm_spectrogram(t, acc)
1818
```
1919

2020
Where:
@@ -23,10 +23,69 @@ Where:
2323
| :-: | :--|
2424
| t | Time of the seismic accelerogram |
2525
| acc | Acceleration (g) of the seismic accelerogram |
26-
| regname | Name of the seismic accelerogram |
2726

2827

29-
This function returns a matrix in where columns refer to mean window time, rows are the frequency of the spectrogram and the value of the matrix are the amplitude of the spectrogram from each time-window on each frequency.
28+
This function returns a **matrix** in where columns refer to mean window time (**matrix_t**), rows are the frequency of the spectrogram (**matrix_f**) and the value of the matrix are the amplitude of the spectrogram from each time-window on each frequency.
29+
30+
To print matrix you should use:
31+
32+
```matlab
33+
[matrix, matrix_t, matrix_f] = plot_norm_matrix(m, mt, mf, t, acc, regname)
34+
```
35+
36+
Where:
37+
38+
| Variable | Description |
39+
| :-: | :--|
40+
| m | Normalized matrix |
41+
| mt| Time array from matrix|
42+
| mf| Frequency array from matrix|
43+
| t| Time of the seismic data|
44+
| acc| Acceleration of seismic data|
45+
| regname|Name of the seismic data (plot title)|
46+
47+
## Example
48+
49+
Lets suppose that a seismic registry is stored on *data/CNV_APED_201604162359_N_100.txt*, the file structure is like:
50+
51+
```
52+
0.000000 -6.329500
53+
0.010000 2.539600
54+
0.020000 12.822900
55+
0.030000 9.435300
56+
0.040000 -5.397100
57+
0.050000 -14.233900
58+
...
59+
```
60+
61+
Then:
62+
63+
```matlab
64+
$ Load the data
65+
data = load('data/CNV_APED_201604162359_N_100.txt');
66+
67+
% Set time and acceleration array
68+
t = data(:, 1);
69+
acc = data(:, 2) ./ 980; % Convert from cm/s2 to g
70+
```
71+
72+
After that we will use ```norm_spectrogram``` function
73+
74+
```matlab
75+
[m, mt, mf] = norm_spectrogram(t, acc);
76+
```
77+
78+
Then plot:
79+
80+
```matlab
81+
plot_norm_matrix(m, mt, mf, t, acc, 'APED 2016/04/16 23:59 N-S');
82+
```
83+
84+
Obtaining:
85+
86+
<p align="center">
87+
<img src="https://raw.githubusercontent.com/ppizarror/ppizarror.github.io/master/resources/images/normalized-spectrogram/figure.png" width="50%px" height="50%px">
88+
</p>
3089

3190
## Licence
3291
This project is licenced under GPLv2 (GNU General Public License, version 2) [https://www.gnu.org/licenses/gpl-2.0.html].

0 commit comments

Comments
 (0)