MATLAB: 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.

pwmsimulink

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.

Best 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.