inkscapeCartesianPlotFunction2D
inkscapeCartesianPlotFunction2D copied to clipboard
[Enhancement] Adding some PWM functions in the cartesianPlotFunction2D.py
Hi, Thanks for this amazing tool. We had to generate plots with PWM signals recently and it took us quite a long time to figure out how to define them from the squareWave function that is defined by default. Below are a suggestion of functions that may be quite useful to the electronics crowd.
def pwm(x, amplitude, offset, period, duty, deadtime, phase):
return amplitude * (u(((x-phase) % period)) - u(((x-phase) % period) - period*(duty-deadtime))) + offset
def pwmComp(x, amplitude, offset, period, duty, deadtime, phase):
return amplitude * (u(((x-(duty+phase)) % period)) - u(((x-(duty+phase)) % period) - period*((1-duty)-deadtime))) + offset