The pwm curve is not straight

Hello everyone,

I want to build a new model in PLECS Box, which is same with “Configuring Digital In and PWM Capture on PLECS RT Box 1”(https://www.youtube.com/watch?v=Xs_PYde0Oko). But the output result is different.

The output curves of the “pwm capture” and "digital in " is sloped. But the curves in the video rise and fall straightly.

I’m so confused about it. Any help would be greatly appreciated.

Best regards

The sloped curves occur because the trace’s “Signal Type” is set to Continuous, where the samples are connected by straight lines. In the video the traces are configured as Discrete, meaning the sample values are held constant until the next sample. You can manually change the signal type to discrete by activating the cursors, and then clicking on the signal type icon next to the trace name. Note that in both cases, the signal values are the same, it’s merely a change in how they are displayed.

The figure below shows two PWM signals, the upper is continuous and the bottom is discrete. Clicking the icon opens the menu shown below.