-
Notifications
You must be signed in to change notification settings - Fork 0
/
wavelet_scarp.m
46 lines (38 loc) · 1.38 KB
/
wavelet_scarp.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function [W,M,an_x,an_y] = wavelet_scarp(frac,d,gam,kt,x,y)
%% Returns wavelet template for a step function degrading by simple diffusion
%% George Hilley 2010
%% Minor revisions Robert Sare June 2015
%%
%% INPUT: frac - limits of scarp profile fit, argument of erfinv
%% d - out-of-plane dimension of template (m)
%% gam - strike of template scarp
%% kt - morphologic age (m^2)
%% x - vector of x coordinates
%% y - vector of y coordinates
%%
%% OUTPUT: W - wavelet template
%% M - mask for points inside window
%% anx - horizontal window limit in x direction
%% any - horizontal window limit in y direction
% Limits of scarp curvature
c = abs(erfinv(frac) .* 2.*sqrt(kt));
% Set up template grid
[X,Y] = meshgrid(x,y);
alph = -gam.*pi./180;
Xrot = X.*cos(alph)+ Y.*sin(alph);
Yrot = -X.*sin(alph) + Y.*cos(alph);
% Curvature of template scarp
W = -Xrot./(2.*kt.^(3/2).*pi.^(1/2)) .* (exp(-Xrot.^2./(4.*kt)));
M = W;
M(:) = 1;
% Mask template to 0 if we are outside scarp bounds
W = W.*((abs(Xrot) < c) & (abs(Yrot) < d));
M = M.*((abs(Xrot) < c) & (abs(Yrot) < d));
% Template limits, used for clipping
x4 = d.*cos(alph-pi./2);
y4 = d.*sin(alph-pi./2);
x1 = d.*cos(alph);
y1 = d.*sin(alph);
an_y = abs((x4 - x1) + 2.*c.*cos(alph-pi./2));
an_x = abs((y1 - y4) + 2.*c.*sin(alph-pi./2));
end