Uncertainty Propagation Class (UC)
The UC class overloads basic Matlab operations to allow error propagation through calculations.
Main features include:
1. Proper self-correlation tracking. In the following example, x1, x2, and x3 will all return the same value
a = UC(10,4,'a');
b = UC(100,1,'b');
c = UC(95,2,'c');
x1 = a*(b - c);
x2 = a*b - a*c;
y1 = a*b;
y2 = a*c;
x3 = y1 - y2;
and a/a will return 1 +/- 0 as it ought.
2. Complete contribution tracking through operations. The fractional contribution of each input to the final uncertainty is reported for derived quantities. UC objects can be created with a name, which will be used in this contribution tracking. Those created without a name get assigned a random name.
3. Unified definitions for unary and binary functions make it easy to add new functions to the UC class. For example, the definition for the tangent function is:
function y = tan(x)
y = UC.UnaryFunction(x, @tan, @(v) sec(v).^2);
end
4. Compatible with scalar multiplication, so it can be integrated into existing codes more easily.
5. Built-in plot function to plot UC values with x and y error bars.
Examples:
Ways to create UC objects:
w = UC(10,1); % will be assigned a name
x = UC([10 12 -12],[1 3 4],'x');
y = UC([1 2 3 4]', 2, 'y');
z = UC(15, 10, 'z');
Basic operations (note, all operators use the '.' operators, the matrix version of the operations is not supported yet):
m1 = 4*w;
m2 = y + z;
m3 = atan(m1+z).^w; %.^ and ^ do the same
m4 = y.*w + 5;
The most current version of the class is hosted on GitHub.
Cite As
Tyler V (2026). Uncertainty Propagation Class (UC) (https://github.com/tgvoskuilen/MatlabTools), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
@DimVar
@Fluid
@UC
Versions that use the GitHub default branch cannot be downloaded
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.2.0.0 | Changed title and description |
|
|
| 1.0.0.0 |
|
