Error propagation through a function
Versión 1.01 (8,29 KB) por
Adam Avedissian
Calculates the error propagation through a function NEEDS : Symbolic Math Toolbox
The function takes 4 entries :
1) The function f written with symbolic variables
2) A 1*n matrix of the symbolic variables of the function
3) A 1*n matrix of the values of the variables to evaluate the function at (IMPORTANT : must be in the same order as the variables in 2))
4) A 1*n matrix of the values of the errors of the variables at the point given in 3) (IMPORTANT : must be in the same order as the variables in 2))
It then returns a 1*3 matrix containing the value of the function at this point in the first cell, the absolute error in the second cell and the relative error in the third one (in percentage!!)
See an example below :
syms A B C % We define the symbolic variables
f = 3*A*exp(B-C^2); % We define the function we are looking to propagate the error through
varlist = [A B C]; % The list of variables
vals = [2 4 0.1]; % The list of the values of the variables to evaluate the function at
errs = [0.2 0.1 0.001]; % The errors of the variables at this point
F_and_errors = propagErreur(f, varlist, vals, errs); % Calls the function to evaluate the function at the given point and propagate the error
Citar como
Adam Avedissian (2026). Error propagation through a function (https://es.mathworks.com/matlabcentral/fileexchange/119653-error-propagation-through-a-function), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2022a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
| Versión | Publicado | Notas de la versión | |
|---|---|---|---|
| 1.01 | Changed slight error in the description |
|
|
| 1.0 |
|
