Error propagation through a function
Version 1.01 (8,29 ko) par
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
Citation pour cette source
Adam Avedissian (2026). Error propagation through a function (https://fr.mathworks.com/matlabcentral/fileexchange/119653-error-propagation-through-a-function), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Créé avec
R2022a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxTags
Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
| Version | Publié le | Notes de version | |
|---|---|---|---|
| 1.01 | Changed slight error in the description |
|
|
| 1.0 |
|
