Hi all, I am having a difficulty in switching a signal, I need a switch in simulink that must be ON for 0 to 0.00001s and from 0.00001s to 0.1s it must be given a PWM signal. This cycle must run for a simulation time of 1s.

I need a switch in simulink such that it should be closed from 0 to 0.0001seconds and later must be operated by a PWM signal I give from 0.0001s to 0.1s. This 2 parts consists 1 cycle. I need this cycle to repeat 10 times, means for 1s.cycle(switch close from 0 to 0.0001s and opearted by PWM signal from 0.0001 to 0.1s).
Could some one please help.

 Accepted Answer

If your PWM signal is fixed, I mean, if they are exactly the same from 0.0001 to 0.1, from 0.1001 to 0.2, from 0.2001 to 0.3,..., then you can combine these two-parts signal into one using the "Repeating Sequence" block from "Sources" library. Just specify every exact time and value from 0 to 0.1 and it will repeat from 0.1 to 0.2, 0.2 to 0.3 etc.
If the PWM signal is different, then still use a "Repeating Sequence" block. Specify its value to be 0 from time 0 to 0.0001, value to be 1 from 0.0001 to 0.1. Then use a "Logical Operator" block to make an "AND" operation on this signal and your PWM signal.
I want to remind you that your simulation step need to be very small, like 1e-5 because you need to be able to change value at 1e-4.

1 Comment

Hi fang, Thanks for the help, I got what I want, but I changed the model a bit, got the idea through your suggestion, thank you.

Sign in to comment.

More Answers (0)

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!