Adding random noise in different timestep while numerical integration
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How can I add a "random factor" only in every second integration step?
Because maybe I don't want to add the Random all the time - for example I Want to add it in time steps = 0.004 or maybe 0.008.
dt = 0.002;
end_1 = 2.0;
time = 0:dt:end_1;
Matrix = zeros(10,length(time);
Matrix(:,0.5/dt:0.6/dt) = repmat(...);
Random = randn(10,length(time);
Matrix = Matrix + Random;
what is the best way to add Random in a different tilmestep than dt?
This dt = 0.002 will later serve as an integration step for solving a differential equation where matrix occurs - now, however, I would like to add the random component in, for example, coarser time steps (every 2nd ... or possibly only every 10th step).
0 comentarios
Respuestas (1)
Dongyue
el 18 de Nov. de 2022
Hi Thomas,
You can use mod() function as a flag, to trigger the adding ramdom process.
if mod(time, 0.04)==0
Matrix = Matrix + Random;
end
For detailed information of mod() function, please go through the link below:
Best,
Dongyue
0 comentarios
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!