Creating a Seismogram record section
조회 수: 11 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!