Question:I have a problem in understanding a simple matlab property. If you have this simple model with the clock, a matlab function and a scope. Why does the fuction is just run every 0.2 seconds in the simulation time? Same when you use 100 as Stop time. Then the function will be run every 2 seconds. In between the random values generated by the funtion, Simulink connects the values linearzed. Next question is why is simulink generating alwys the same “random”signal? I want to implement a random noise signal in a bigger model, but i think i did not understand how it works.
Answer:Change the solver type to fixedstep and set the timestep to whichever value you want in order to obtain the results at the desired time intervals.
Regarding the result of the rand function, you can initiate it each time with a different seed (based on the current time) by calling the rng function before rand with the mode shuffle:
If you have better answer, please add a comment about this, thank you!