How can I limit in time a sine wave in Simulink

6 views (last 30 days)
Mike Adwa
Mike Adwa on 7 Feb 2016
Edited: Gojo on 31 Aug 2024
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 Comment
selenaz
selenaz on 30 Aug 2024
hii,am facing the same problem..how did you solve it?
thanks in advance

Sign in to comment.

Answers (1)

Gojo
Gojo on 31 Aug 2024
Edited: Gojo on 31 Aug 2024
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!

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!