Pulse Generator/Square Wave with Controllable Rise Time and Fall Time

Hello,

How could a rectangular signal/square wave/pulse wave be generated in Plecs 4.1 in which the RISE TIME and the FALL TIME can be adjusted, besides the frequency, duty cycle, phase shift, lower and upper amplitude, as is shown in the figure below?

Thank you.
Best regards.

using C-script?

Any solution is welcome.

I would have liked it to be something of a block like Pulse Generator, but if there are other variants there is no upset or to say no.

Here is an easy and efficient way to produce arbitrary periodic, piece-wise linear signals:

Use a Triangular Wave Generator to produce a rising sawtooth signal from 0 to 1 with the desired period.Use a 1D Look-Up Table to map the range [0, 1] to your desired signal shape. You’ll need to do some math in order to calculate the coordinates of the corner points from your input parameters. Set the parameter Locate discontinuities to on in order to ensure that a variable-step solver will make a simulation step at the important points.Wrap this into a masked subsystem as desired.