ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
logrange.m
Go to the documentation of this file.
1%> \brief
2%> Return a set of maximum ``sizemax`` unique integer spacings almost
3%> linearly spaced in the natural logarithmic scale between the
4%> specified ``start`` and ``stop`` of the output range.
5%>
6%> \param[in] start : The input scalar MATLAB whole-number (integer)
7%> representing the starting point of the output range.
8%> \param[in] stop : The input scalar MATLAB whole-number (integer)
9%> representing the stopping point of the output range.
10%> \param[in] sizemax : The input scalar MATLAB whole-number (integer)
11%> representing the maximum size of the output range.<br>
12%> Due to rounding operation involved in creating the
13%> output range, it is impossible to prespecify the
14%> output range size, only the maximum.<br>
15%> (**optional**, default = ``100``)
16%>
17%> \return
18%> ``array`` : The output vector of MATLAB real values containing
19%> the set of naturally logarithmically-spaced integer
20%> values in the specified input range.
21%>
22%> \interface{logrange}
23%> \code{.m}
24%>
25%> array = pm.array.logrange(start, stop)
26%> array = pm.array.logrange(start, stop, [])
27%> array = pm.array.logrange(start, stop, sizemax)
28%>
29%> \endcode
30%>
31%> \example{logrange}
32%> \include{lineno} example/array/logrange/main.m
33%> \output{logrange}
34%> \include{lineno} example/array/logrange/main.out.m
35%>
36%> \final{logrange}
37%>
38%> \author
39%> \JoshuaOsborne, May 21 2024, 4:29 PM, University of Texas at Arlington<br>
40%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
41%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
42function array = logrange(start, stop, sizemax)
43 if nargin < 3
44 sizemax = [];
45 end
46 if isempty(sizemax)
47 sizemax = 100;
48 end
49 logub = log(stop);
50 loglb = log(start);
51 logskip = (logub - loglb) / sizemax;
52 array = unique(round(pm.array.logspace(loglb, logub, logskip)));
53end
function logrange(in start, in stop, in sizemax)
Return a set of maximum sizemax unique integer spacings almost linearly spaced in the natural logarit...