Creating a Seismogram record section

11 views (last 30 days)
Hello, I would like to create a record section for a number of seismic records. I have attached a zip file containing 4 dataset (in folder called data) as an example and the code (section_record.m) that I managed to create. I have also added a .png file (section_record.png) as an example. Suppose the epicenter distances of the records are 8, 27, 36 and 44km, I would wish to plot display 3 datasets (ie time, amplitude and distance) on a 2D plot as shown in the .png file. Kindly assist on how to go around this.

Accepted Answer

Mathieu NOE
Mathieu NOE on 27 Jan 2021
hello arthur
this is a modified code - check it out
play with "a" factor to increase / decrease vertical offset between lines
clc
clear
close all
folder = [cd '\data\'];
filenames = {'data1.dat', 'data2.dat', 'data3.dat', 'data4.dat'};
L = figure(1);
B=1;
E=6000;
dt = 0.01;
nf = numel(filenames);
y_ticks_labels = {'0', '8' , '27' '36' , '44'}; % kms
% lines vertical offset
a = 1.15; %%% here !!
y_offset = [a; 2*a*ones(nf-1,1)];
y_offset = [0;cumsum(y_offset)];
for k = 1:nf
data = load(fullfile(folder, filenames{k}));
M=length(data);
tim=linspace(0,dt*M,M);
%Normalizing
meanData = mean(data);
normData = data-meanData;
maxData = max(abs(normData));
data2= normData/maxData;
plot(tim,data2+y_offset(k+1),'r');
hold on
end
set(gca, 'YTick', y_offset , 'Yticklabel', y_ticks_labels);
ylabel('Distance [km] ','FontWeight','normal','FontSize',13)
xlabel('Time [s]','FontWeight','normal','FontSize',12)
set(gca,'visible','on','FontSize',12,'FontWeight','normal',...
'LineWidth',1,...
'Box','on', 'XTick', (B*dt:20:E*dt), 'XLim', [B*dt E*dt])
% axis([tim(B),tim(E), -1,1])
% ylim = get(gca, 'ylim');
% xlim = get(gca, 'xlim');
% pos = get(L, 'Position');
% set(L, 'Position', [pos(1), pos(2), pos(3)+200, pos(4)-150])
set(gcf,'color','w')
% temp = [filenames{k}, '.eps'];
% print (L, temp, '-depsc')
%fclose('all');

More Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!