-
Notifications
You must be signed in to change notification settings - Fork 0
/
suggestedorder.m
50 lines (44 loc) · 1.5 KB
/
suggestedorder.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
% Suggested order for wavefunction expansion
%
% n = suggestedorder(k,r) returns the suggested order n for a regular
% wavefunction expansion of a plane wave with wavenumber k valid in a ball
% of radius r.
%
% The suggested order is computed from a formula on p1508 of Improved Mie
% Scattering Algorithms, W. J. Wiscombe, Applied Optics Vol 19 No 9, 1980.
%
% See also: regularwavefunctionexpansion.
%
% Stuart C. Hawkins - 12 November 2014
% Copyright 2019-2022 Stuart C. Hawkins
%
% This file is part of TMATROM3
%
% TMATROM3 is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% TMATROM3 is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with TMATROM3. If not, see <http://www.gnu.org/licenses/>.
function val = suggestedorder(kwave,radius)
% This is the strategy from
% Improved Mie Scattering Algorithms,
% W. J. Wiscombe
% Applied Optics, Vol 19 No 9. 1 May 1980.
% Page 1508.
% compute size parameter
x=kwave*radius;
% set default
if x<=8
val=floor(x)+1+ceil(4*x.^(1/3));
elseif x<4200
val=floor(x)+2+ceil(4.05*x.^(1/3));
else
val=floor(x)+2+ceil(4*x.^(1/3));
end