Creating a Seismogram record section

10 ビュー (過去 30 日間)
Arthur Batte
Arthur Batte 2021 年 1 月 25 日
コメント済み: Mathieu NOE 2021 年 1 月 27 日
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.

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 1 月 27 日
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 件のコメント
Arthur Batte
Arthur Batte 2021 年 1 月 27 日
You are the best. thank you very much
Mathieu NOE
Mathieu NOE 2021 年 1 月 27 日
You're welcome !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by