This repository was archived by the owner on Jun 7, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_norm_matrix.m
More file actions
67 lines (61 loc) · 1.87 KB
/
plot_norm_matrix.m
File metadata and controls
67 lines (61 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function plot_norm_matrix(m, mt, mf, t, acc, regname)
% PLOT_NORM_MATRIX Plot normalized spectrogram alonside acceleration
% data.
%
% Usage:
% plot_norm_matrix(m, mt, mf, t, acc, regname)
%
% Where:
% m: Normalized matrix
% mt: Time array from matrix
% mf: Frequency array from matrix
% t: Time of the seismic data
% acc: Acceleration of seismic data
% regname: Name of the seismic data (plot title)
%
% Author: Pablo Pizarro @ppizarror.com, 2017.
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%% If regname is not defined
if ~exist('regname', 'var')
regname = '';
end
%% Plot matrix
f = figure();
set(f, 'Visible', 'off');
%% Plot matrix
handle(1)=subplot(2, 1, 1);
title(regname);
hold on;
pcolor(mt, mf, m); shading interp; % Plot colormap
[~, h] = contour(mt, mf, m, [0.8, 0.8]); % Plot contour at 80%
h.LineWidth = 0.5;
h.LineColor = 'red';
hold off;
ylabel('frequency (Hz)');
xlim([0, mt(end)]);
ylim([0.4, mf(end)]);
%% Plot seismic
handle(2)=subplot(2, 1, 2);
plot(t, acc, 'k');
xlabel('Time (s)');
ylabel('a (g)');
xlim([0, t(end)]);
grid on;
%% Show plot
set(f, 'Visible', 'on');
movegui(f, 'center');
linkaxes(handle,'x')
end