Simulation Time in Simulink
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I describe the general scenario of my problem below:
I used the sine wave formula to generate a sequence of points which follow a sinewave shape (using a period of 20s and dividing this into 880 linearly space points). Plotting the values of the time variable (used for this computation) against the output (sinewave function) gives a sinewave shape, as expected.
Then I used the repeating sequence block in Simulink to try to repeat this shape as many times as possible. However, the resulting shapes are bizzare as I increase the Simulation time in Simulink. The only time when it is the same as the original shape is when the Simulation time in Simulink is the same as the total time I used in the computation of the Sine wave, as its period. The figures are attached below.
- plot using matlab
- figure from the scope connected to Simulink Repeating Sequence Block with the Simulation time set to 20s
- figure from the scope connected to Simulink Repeating Sequence Block with the Simulation time set to 100s
- figure from the scope connected to Simulink Repeating Sequence Block with the Simulation time set to 200s (zoomed into a couple of cycles in order to show the non-smoothness of the curve)
Please help me understand this. Is there some downsampling taking place somewhere, and where if so?
I will appreciate your help in making me understand this behaviour. Thank you.
0 commentaires
Réponses (1)
Vinay
le 24 Sep 2024
Hi Williams,
The problem with the repeating sequence block arises because the solver's step size changes when the simulation time of the model is adjusted.
The variable step solver chooses a step size that exceeds the data's sampling period, causing it to miss data points and resulting in a distorted plot.The issue can be resolved by using a fixed step solver with step size less than the sampling period of the data.
Kindly refer to the below documentation of “solver” for more details:
I hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!