Simulate a random walk that starts at a certain time and then stops before the end of the simulation

7 Ansichten (letzte 30 Tage)
I want to simulate a white noise that begins at a certain time and then stops at another time before the end of the simulation. The goal is to generate a random-walk disturbance but I want to have a period at the beginning where the disturbance is zero and a final period where the disturbance is static.
Based on this answer I did it using two switches:
Is this the best way or is there something simpler?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Mai 2023
Bearbeitet: Walter Roberson am 16 Mai 2023
You can use an if action block https://www.mathworks.com/help/simulink/slref/if.html as that permits you to use the & operator. So if time > 300 & time < 1000 ...
Or, use two relational operator blocks https://www.mathworks.com/help/simulink/slref/relationaloperator.html with their output type set as 'double', and multiply the two results, and multiply that by the output of the noise signal: the result will be 0 where either or both of the comparisons is false, and will otherwise be the noise.
  8 Kommentare
Walter Roberson
Walter Roberson am 18 Mai 2023
I recall that there was a post a few months ago to the effect that the different streams of if/then/else all kept running at the same time, unless you did specific things, and therefore you could end up with an error arising from a grouping that was not selected. I didn't really catch the details, unfortunately.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by