how to add noise for integral solution
Afficher commentaires plus anciens
Dear Matlab associates, Dear Matlab users,
I would like to add noise to check how the integral solves for simulation purposes.
Example given:
A = 1;
t1 = 100;
fun = @(x)(A+sin(x));
q = integral(fun,0,t1);
In the example above I would like to add a noise to the sinusoidal signal A+sin(x) (e.g.) and check the result of the integral.
BR,
Mihail
Réponses (1)
Walter Roberson
le 11 Juin 2015
Constant noise, or noise that might differ between calls?
Constant noise:
An = A + randn();
fun = @(x)(An+sin(x));
Noise that might vary as it goes:
fun = @(x)(A+sin(x)+randn(size(x)));
this would use constant noise for any one call but the noise would differ between calls. Note: I coded the routine to work with ArrayValued in case you wanted to use that.
Noise that varies across calls is effectively a discontinuity in the function and you could expect difficulty in integration.
2 commentaires
Mihail Georgiev
le 11 Juin 2015
Walter Roberson
le 11 Juin 2015
The biggest difference between the two is what would happen if the function were called twice for the same x. In the first version I gave, the two calls would return the same value. In the second version I gave, the two calls would return different values.
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!