How to introduce a random variable in ode45?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
J Alonso
el 2 de Mzo. de 2014
Comentada: J Alonso
el 2 de Mzo. de 2014
Hi to all, I am quite new in Matlab, thanks in advance for your help. I am trying to solve a system of differential equations similar to:
r1'(t)=f(r1,r2,t)+g(r1,r2,t)*z(t);
r2'(t)=j(r1,r2,t)+h(r1,r2,t)*z(t);
I am using ode45 by defining a function file with f, g, j and h. Now my problem is to introduce z(t) as a random number for a normal distribution. This random numbers can be obtained using normrnd(mu,sigma), however, I need my program to take on different random number for each time but use the same at each time for r1' and r2'. Thanks a lot for your help.
0 comentarios
Respuesta aceptada
Paul
el 2 de Mzo. de 2014
Editada: Paul
el 2 de Mzo. de 2014
Add
rng('shuffle')
before calling normrnd.
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations 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!