Code covered by the BSD License  

Highlights from
Error Propagation Class

5.0

5.0 | 4 ratings Rate this file 24 Downloads (last 30 days) File Size: 5.7 KB File ID: #16606

Error Propagation Class

by

 

26 Sep 2007 (Updated )

This class automatically performs error propagation in Matlab expressions.

| Watch this File

File Information
Description

This class, called "meas" (meaning measurement with uncorrelated error), contains two elements. A "meas" can be created with the constructor function:

>> d = meas();

and values can be assigned to the two elements.

>> d.value = 1;
>> d.error = .3;

The values can also be displayed:

>> d
1 +/- 0.3

I overloaded the +,-,*,/,^,>,<,==,>=,<= operators to perform the error propagation for each of these operators. The comparison operators work to within 1-sigma. For example, (1.0 +/- .3) == (.9 +/- .3) would return "true".

In this early version, this only works for single numbers, and just for the operators listed above. In the future, I plan to overload many common functions (sin(x) and such...), and make support for matrices and arrays. Comments and changes are most welcome, especially since this is my first Matlab code in which I have made my own class.

Thanks to Kevin Murphy's site,
http://www.cs.ubc.ca/~murphyk/Software/matlabObjects.html
for helpful basic information on writing a class.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Should be platform-independent, although I wrote this in Windows XP. To install, unzip the archive, and put the directory into which it is unzipped into the Path. Make sure the directory is named "@meas"
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
26 May 2009 Stefan Bollmann

Thank you for this class. But I think there are some things to watch. Try z=meas(3,1) and then z/z.

08 Oct 2008 belhaoua abdelkrim

Thank you! It's a very interesting class and very useful.

22 Sep 2008 Kenneth Wong

Thank you for this useful class!

May I suggest adding functionality to perform multiplication of scalars with "meas"s? i.e. 10 * d = 1 +/- 3

Thanks again!

27 Sep 2007 Thomas Pieper

Excellent idea! Please, please continue to expand the class furthermore. Thank you!

26 Sep 2007 Dimitri Shvorob

It's 'propAgation'.

Contact us