How can I limit in time a sine wave in Simulink
6 次查看(过去 30 天)
显示 更早的评论
Hello everyone !
I have to face a problem and I cannot find a solution. Could you help me ? Actually, in simulink, I would like to use a sine wave but just during a precise time. Let's say I want to do a simulation during 100s and I would like to use the sine wave just during 10s and then stop. How can I do that ? How can I control in time my sine wave ?
Thank you very much for your help !
- Mike
1 个评论
回答(1 个)
Gojo
2024-8-31
编辑:Gojo
2024-8-31
Hey Mike,
I understand that you want to use sine waves only for some specified time steps. I believe you could achieve this functionality by using a Switch Block. You can pass a control signal which would have a True value when you would want to use the sine wave and else it would have a False value. You can generate this signal as an array in your MATLAB workspace if you know ahead in time at which time steps you would require to use the sine wave. Otherwise you could generate this control signal by using a Clock Block and your logic in Simulink itself.
Once you have the above mentioned control signal, you can use the Switch Block to output the Sine wave when the control signal has a True value, otherwise you may output a constant signal from the block. You can create your own subsystem as below:

I hope this helps!
1 个评论
Gojo
2024-8-31
Enabled Subsystems could also be helpful in this scenario: https://www.mathworks.com/help/simulink/ug/enabled-subsystems.html
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!