how to add noise for integral solution
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 11 Jun 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 Comments
Walter Roberson
on 11 Jun 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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!