How can I create a random input similar to "band-limited white noise", but in an m-file in an ODE to solve with ode45?

3 views (last 30 days)
I would like to write an m-file in which an ordinary differential equation is defined.
I have to add a gaussian white noise to that. I have created a file in Simulink for that, but I am not able to write similar code.

Answers (2)

Fangjun Jiang
Fangjun Jiang on 10 Aug 2020
rand()
  1 Comment
Ali Hajnayeb
Ali Hajnayeb on 10 Aug 2020
Actually, "randn()" is better and creates numbers with normal distribution, but the variance of the output of the ODE would not match Simulink.

Sign in to comment.


Ali Hajnayeb
Ali Hajnayeb on 10 Aug 2020
Actually, "randn()" is better and creates numbers with normal distribution, but the variance of the output of the ODE would not match Simulink.

Community Treasure Hunt

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

Start Hunting!