-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathequiv_dist.m
62 lines (47 loc) · 1.5 KB
/
equiv_dist.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% EQUIV_DIST An adaptive function to determine equivalent lognormal distribution properties.
%
% By default, takes mobility diameter parameters as inputs and converts
% to aerodynamic diameter, volume-equivalent diameter, and mass.
%
% AUTHOR: Timothy Sipkens, 2022-04-14
function tb = equiv_dist(cmd, sg, prop, type)
if ~exist('type', 'var'); type = ''; end
% type = 'dm';
f_aero = 0;
if strcmp(type, 'mp')
sg = exp( ...
(log(mp2dm(exp(log(cmd) .* 1.05), prop)) - ...
log(mp2dm(exp(log(cmd) .* 0.95), prop))) ./ ...
(0.1 .* log(cmd)) .* ...
log(sg)); % mass
cmd = mp2dm(cmd, prop);
end
rho = dm2rhoeff(cmd, prop);
chi = prop.chi;
% Transform CMDs.
[cmad, cmvd] = dm2da(cmd, rho, chi, f_aero);
mg = dm2mp(cmd, prop);
% Transform GSDs.
[dau, vdu] = dm2da(exp(log(cmd) .* 1.05), rho, chi, f_aero);
[dad, vdd] = dm2da(exp(log(cmd) .* 0.95), rho, chi, f_aero);
sga = exp( ...
(log(dau) - ...
log(dad)) ./ ...
(0.1 .* log(cmd)) .* ...
log(sg)); % aerodynamic diameter
sgv = exp((log(vdu) - log(vdd)) ./ ...
(0.1 .* log(cmd)) .* ...
log(sg)); % aerodynamic diameter
sgm = exp( ...
(log(dm2mp(exp(log(cmd) .* 1.05), prop)) - ...
log(dm2mp(exp(log(cmd) .* 0.95), prop))) ./ ...
(0.1 .* log(cmd)) .* ...
log(sg)); % mass
% Get table of values.
s.Mobility = [cmd .* 1e9; sg];
s.Aerodynamic = [cmad .* 1e9; sga];
s.Volume = [cmvd .* 1e9; sgv];
s.Mass = [mg .* 1e18; sgm];
tb = struct2table(s);
tb.Properties.RowNames = {'GMD', 'GSD'};
end