ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
logspace.m
Go to the documentation of this file.
1%> \brief
2%> Return a set of unique real spacings linearly-spaced
3%> in the logarithmic scale in the input given base,
4%> between the specified lower and upper bounds.
5%>
6%> \param[in] loglb : The input scalar MATLAB real containing
7%> the natural logarithm of the lower bound
8%> of the output logarithmically-linear spaced vector.
9%> \param[in] logub : The input scalar MATLAB real containing
10%> the natural logarithm of the upper bound
11%> of the output logarithmically-linear spaced vector.
12%> \param[in] logskip : The input scalar MATLAB real of value larger than ``1``
13%> containing the natural logarithm of the spacing between
14%> the natural logarithm of the output values.<br>
15%> (**optional**, default = ``(logub - loglb) / 100``)
16%> \param[in] base : The input scalar MATLAB real
17%> containing the base of the logarithmic space.<br>
18%> (**optional**, default = ``exp(1)``)
19%>
20%> \return
21%> ``array`` : The output vector of MATLAB real values containing
22%> the set of logarithmically-spaced values in the
23%> specified input range with the specified ``base``.
24%>
25%> \interface{logspace}
26%> \code{.m}
27%>
28%> array = pm.array.logspace(loglb, logub)
29%> array = pm.array.logspace(loglb, logub, logskip)
30%> array = pm.array.logspace(loglb, logub, [], base)
31%> array = pm.array.logspace(loglb, logub, logskip, base)
32%>
33%> \endcode
34%>
35%> \example{logspace}
36%> \include{lineno} example/array/logspace/main.m
37%> \output{logspace}
38%> \include{lineno} example/array/logspace/main.out.m
39%>
40%> \final{logspace}
41%>
42%> \author
43%> \JoshuaOsborne, May 21 2024, 4:33 PM, University of Texas at Arlington<br>
44%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
45%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
46function array = logspace(loglb, logub, logskip, base)
47 if nargin < 4
48 base = [];
49 end
50 if nargin < 3
51 logskip = [];
52 end
53 if isempty(logskip)
54 logskip = (logub - loglb) / 100;
55 end
56 if ~isempty(base)
57 array = base .^ (loglb : logskip : logub);
58 %array = base .^ ((loglb : logskip : logub) ./ log(base));
59 else
60 array = exp(loglb : logskip : logub);
61 end
62end
function logspace(in loglb, in logub, in logskip, in base)
Return a set of unique real spacings linearly-spaced in the logarithmic scale in the input given base...