by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.0, Creation date: 2021-02-08, Last change: 2025-09-15
See Also: meanGauss
, num2strUP
[xr,sr]=roundgauss([x,s,n])
x: | Mean Value | |
s: | Standard deviation | |
n: | number of measurement; if 1 we use 2 significant numbers |
xr: | mean rounded | |
sr: | standard deviation rounded |
[x,s]=roundgauss(123.45678,34.567890,2)
[x,s]=roundgauss(123.45678,34.567890,10)
[x,s]=roundgauss(123.45678,34.567890,100)
[x,s]=roundgauss(123.45678,3.4567890,1000)
This algorithm is designed to round a mean value and its standard deviation based on the number of measurements. It is part of the SolidGeometry library and was introduced by Tim Lueth.
getfuncparams.res to 0.01.n > 1:
sx = s / sqrt(n).aaa = -sx * erfinvGauss(res).ff = ceil(log10(x / aaa)) + 1.ee = ceil(log10(x)).x to ff - ee significant figures and assign to xr.s to ff - ee + 1 significant figures and assign to sr.n = 1:
ee = ceil(log10(x)).xn = 3 - ee and sn = 4 - ee.x to xn significant figures and assign to xr.s to sn significant figures and assign to sr.[x,s]=roundgauss(123.45678,34.567890,2)[x,s]=roundgauss(123.45678,34.567890,10)[x,s]=roundgauss(123.45678,34.567890,100)[x,s]=roundgauss(123.45678,3.4567890,1000)