-
Notifications
You must be signed in to change notification settings - Fork 10
/
iasp91s.m
40 lines (36 loc) · 980 Bytes
/
iasp91s.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
function val=iasp91s(rad,fld,arg)
% val=iasp91S(rad,fld,arg)
%
% Interpolates the IASP91 Earth model pretreated to smooth over
% discontinuities, and its radial gradient
%
% INPUT:
%
% rad Radius [m]
% fld 1 P-velocity [m/s]
% 2 S-velocity [m/s]
% 3 density [kg/m^3]
% arg 1 need the field
% 2 need the field gradient d(fld)/d(radius)
%
% OUTPUT:
%
% val The interpolated fields or gradients
%
% SEE ALSO:
%
% AK135S, PREMISOS, EARTHMODEL, MODPREP
%
% Last modified by fjsimons-at-alum.mit.edu, 06/02/2021
% Specify where you keep them
defval('ddir',fullfile(getenv('IFILES'),'EARTHMODELS','MATFILES'))
% Load specially prepared data which contain radius, psd, psdgrad
load(fullfile(ddir,'iasp91s'))
% Perform the interpolation without thinking about discontinuities
method= 'linear';
switch arg
case 1
val=interp1(radius,psd(:,fld),rad,method);
case 2
val=interp1(radius,psdgrad(:,fld),rad,method);
end