- step 1: transpose data

- step 2: do calculations only if data exists

1 view (last 30 days)

Show older comments

I am trying to execute a two-part analysis on Earthquake distribution. The first is the Earthquake Kernel Density Estiamtion (Eqn.1) which is done already by the script beneath. The second part I'm struggling with is the Seismic Moment Kernel Density Estimation. In theory, the equations for both is almost identical, with only the seismic moment being added to the numerator (Eqn.3)

Principle (After Sharon et al., 2020):

A regional scan is carried out in a 1 km (0.009 decimal degrees) interval 2-D grid, in the horizontal coordinates. For each grid point, both parameters are calculated utilising all recorded events within a 6 km (0.05 decimal degrees) radius. The parameters are calculated based on the kernel density estimation as an approach to obtain the spatial distribution through a probability density function, using the distance to weight each event from a reference point (each grid point, the common centre of its adjacent events).

where N is the total number of events within the radius r, M0(n) is the seismic moment released from an event n ac- cording to Eq. (2), d(n) is the distance between an event n and the circle centre, σ is the standard deviation of the Gaussian function and T is the duration of the earthquake catalogue; units are joules per squared kilometre per year (J km−2 yr−1).

For simplicity, I have reduced my dataset to 10 events (attached in this post), which are long5 and lat5. These are coordinates of the earthquake events in decimal degrees (North and East). I have also attached a file that contains the seismic moment released by each of these events.

My question is: How to account for the seismic moment of each earthquake inside the script, to make it calculate the new density automatically while accounting for seismic moment?

clc,clear

% load latfull

% load longfull

% load longmatrix

% load latmatrix

% load coord

load long5

load lat5

% AA = importdata('completenondecl3.csv');

long = (long5);

lat = (lat5);

step = 0.009;

x = min(long):step:max(long);

y = min(lat):step:max(lat);

[X,Y]= ndgrid(x,y); % creates grid

R = 0.05; % circle radius

plot(long,lat,'.r') % plot data

P = X*0; % no. of points inside each circle

T = 2019-1916+1;

sig = 2;

scale = (pi/180*earthRadius/1000)^2;

hold on

for i= 1:length(x)

for j=1:length(y)

D2 = (long-x(i)).^2 + (lat-y(j)).^2;

ix = D2 < R^2; % find smaller distances

D(ix) = scale*D2(ix); % write smaller distances

P(i,j) = sum(exp(-D(ix)/2/sig^2))/T; %write ID

N(i,j) = sum(ix); % no. of points inside (i,j) circle

% plot(long(ix),lat(ix),'ob') %plot data inside circle (if exists)

if sum(ix) % if there are points inside

viscircles([x(i),y(j)], R,'edgeColor','g'); % plot circle

else

% viscircles([x(i),y(j)], R,'edgecolor','r'); % plot circle

end

end

end

p = P/(pi*6.^2);

G = rot90(flip(p),3);

imagesc(x,y,G);

colorbar

hold off

axis equal

darova
on 12 Apr 2020

Edited: darova
on 13 Apr 2020

I think the question is too hard. Don't know if someone on this forum could handle it

But i'll take a shot: what about this smart step?

EDITED:

It happens because of different sizes of arrays you multiplies

Here are some steps to success

- step 1: transpose data

load Mo5

Mo5 = Mo5'; % sesmic moment is a column - make a row

% D(ix) is a row

- step 2: do calculations only if data exists

karim
on 7 Nov 2022

Please can i ask your help, after you obtain results, how did you plot the data?

karim
on 10 Nov 2022

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

Start Hunting!