introduce random variable in ode at specfic range
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Torsten
2017-4-3
https://de.mathworks.com/help/finance/stochastic-differential-equation-sde-models.html
Best wishes
Torsten.
回答(1 个)
Jan
2017-4-3
编辑:Jan
2017-4-3
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 个评论
Walter Roberson
2017-4-8
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!