Creating a Seismogram record section

17 vues (au cours des 30 derniers jours)
Arthur Batte
Arthur Batte le 25 Jan 2021
Commenté : Mathieu NOE le 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.

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Just for fun dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by