Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

clc

clear all

%koordinat stasiun
xs = [5 15 20 30];
ys = [15 20 35 45];
N = length(xs);

%kecepatan gelombang
v = 2;

%koordinat episenter
x = 30;
y = 40;

%grid
x_grid = 1:2:50;
y_grid = 1:2:50;

%arrival time (true model)


for i = 1:N;
t(i) = sqrt((x-xs(i))^2+(y-ys(i))^2)/v;
end
%arrival time (synthetic model)
tsynth = t + randn*0.05;

%arrival time (calculated model)


rms_fin = inf;
for i = 1:length(x_grid);
for j = 1:length(y_grid);
for k = 1:N
tcal(k) = sqrt((x_grid(i)-xs(k))^2+(y_grid(j)-ys(k))^2)/v;
end
misfit = tcal-t;
rms_plot(j,i) = sqrt(sum(misfit.^2)/N);
rms = sqrt(sum(misfit.^2)/N);
if rms < rms_fin
rms_fin = rms;
x_inv = x_grid(i);
y_inv = y_grid(j);
end
end
end

fprintf('Episenter Grid Search: X = %f Y = %f',x_inv,y_inv);

figure
hold on
contourf(x_grid,y_grid,rms_plot)
xlabel('X (m)')
ylabel('Y (m)')

1
colorbar
stasiun = plot(xs,ys,'v','MarkerSize',10,'Color','k','MarkerFaceColor','r');
true_epi = plot(x,y,'p','MarkerSize',10,'Color','k','MarkerFaceColor','y');
inv_epi =
plot(x_inv,y_inv,'p','MarkerSize',10,'Color','k','MarkerFaceColor','c');
legend([stasiun, true_epi, inv_epi],'stasiun','true episenter','grid
episenter')
title('Penentuan Episenter menggunakan Grid Search')

Episenter Grid Search: X = 29.000000 Y = 41.000000

Published with MATLAB® R2022b

You might also like