Azzera filtri
Azzera filtri

introduce random variable in ode at specfic range

3 visualizzazioni (ultimi 30 giorni)
I am trying to solve a differential equation similar to:
x"=(c+z(t))x'+kx
my problem is how can I introduce z(t) as a random number for a normal distribution (0,0.1^2) at the range (-0.4,0.4)
This random numbers can be obtained using normrnd(mu,sigma)
  1 Commento
Torsten
Torsten il 3 Apr 2017
https://de.mathworks.com/help/finance/stochastic-differential-equation-sde-models.html
Best wishes
Torsten.

Accedi per commentare.

Risposte (1)

Jan
Jan il 3 Apr 2017
Modificato: Jan il 3 Apr 2017
This will not work. Matlab's integrators handle smooth functions only, see http://www.mathworks.com/matlabcentral/answers/59582#answer_72047 . Otherwise the stepsize controller drives mad.
Imagine that a stepsize was selected to large to match the goven tolerances. Now the stepsize is reduced according the method implemented in the integrator. But in the re-evaluation of the step, the function to be integrated replies a completely different value due to the random part.
ODE45 needs several function evaluations to determine one step. Therefore it is required also, that the function is smooth. Otherwise the design of the integrator is completely wrong. This means that you get a final value perhaps, but it cannot be called "result", because it is random and based on random rounding and truncation errors based on randomly chosen step sizes.
  2 Commenti
Walter Roberson
Walter Roberson il 8 Apr 2017
If your function is not smooth at one derivative more than you use in your equation, then any integration answer you get back might be wrong.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by