-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathricker.m
More file actions
executable file
·37 lines (35 loc) · 838 Bytes
/
ricker.m
File metadata and controls
executable file
·37 lines (35 loc) · 838 Bytes
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
function [s] = ricker(npts,freq,dt,timesh,nsw)
% Calculates Ricker wavelet
% s(npts) = wavelet
% dt = sampling interval
% freq = predominate frequency of wavelet
% timesh = time shift to the left (s)
% nsw = number of points on each side of wavelet to be tapered
% by half of a cosine bell window
if timesh<.0001; timesh=npts*dt/2; end
pi2 = sqrt(pi)/2;
b = sqrt(6)/(pi*freq);
const = 2*sqrt(6)/b;
for i = 1:npts
tim1 = (i-1)*dt;
tim2 = tim1 - timesh;
u = const*tim2;
amp = ((u*u)/4 - 0.5)*pi2*(exp(-u*u/4));
s(i) = amp;
end
smax = max(abs(s));
smax=smax*2;
s = s/smax;
if nsw~=0
for i = 1:nsw
j = nsw-i;
fac = 0.5*(cos(pi*j/nsw) + 1);
s(i) = s(i)*fac;
end
for i = 1:nsw
j = i-1;
fac = 0.5*(cos(pi*j/nsw) + 1);
k = npts-nsw+i;
s(k) = s(k)*fac;
end
end