Uncertainty Propagation Class (UC)

Version 1.2.0.0 (36.9 KB) by Tyler V
A class for handling propagated uncertainty in Matlab
227 Downloads
Updated 17 Aug 2015

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 (2024). Uncertainty Propagation Class (UC) (https://github.com/tgvoskuilen/MatlabTools), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Programming in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

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

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.