Filter löschen
Filter löschen

Creating a Seismogram record section

12 Ansichten (letzte 30 Tage)
Arthur Batte
Arthur Batte am 25 Jan. 2021
Kommentiert: Mathieu NOE am 27 Jan. 2021
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.

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 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');
  2 Kommentare
Arthur Batte
Arthur Batte am 27 Jan. 2021
You are the best. thank you very much
Mathieu NOE
Mathieu NOE am 27 Jan. 2021
You're welcome !

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by