# Piecewise smooth rectangle pulse

I am wondering how to create a single rectangle pulse with nonlinear riding and falling edges on both sides.
I don't know whether it is better to do it piecewise or to mathematically transform the original rectangle with some function (e.g. a convolution).

So far, I' ve constructed my pulse with UnitStep functions :

trapezoid[t_] :=
622.4*10^6*(t - 0.6*10^-12)*UnitStep[t - 0.6*10^-12] -
622.4*10^6*(t - 7.83*10^-12)*UnitStep[t - 7.83*10^-12] -
493.7*10^6*(t - 96.235*10^-12)*UnitStep[t - 96.235*10^-12] +
493.7*10^6*(t - 105.12*10^-12)*UnitStep[t - 105.12*10^-12]

Plot[trapezoid[t], {t, 0, 130*10^-12}, PlotRange -> {0, 5*10^-3}] The point is that I need a preferably continuous shape so that I can Laplace transform it eventually.

Any help is welcome, because I am stuck defining the edges between the flat top and the 0 values before the rise.

Note: this is a very short pulse (100 ps long), if that is relevant, and the rise time is around 6 ps.

Thank you!

Tamás

• Welcome! Please provide any already existing code (if available), so we can build on that. Do you have any more specific info on what you mean by "nonlinear"? Dec 12 '14 at 9:55
• So far, I've constructed my pulse with UnitStep functions: trapezoid[t_] := 622.4*10^6*(t - 0.6*10^-12)*UnitStep[t - 0.6*10^-12] - 622.4*10^6*(t - 7.83*10^-12)*UnitStep[t - 7.83*10^-12] - 493.7*10^6*(t - 96.235*10^-12)*UnitStep[t - 96.235*10^-12] + 493.7*10^6*(t - 105.12*10^-12)*UnitStep[t - 105.12*10^-12] I'd like to make the edges not straight lines, rather "smooth" lines. Thank you! Dec 12 '14 at 10:27
• Here is the plot command and range: Plot[trapezoid[t], {t, 0, 130*10^-12}, PlotRange -> {0, 5*10^-3}] Thank you in advance! Dec 12 '14 at 10:36
• Hyperbolic tangents are useful for smooth step functions, e.g. Plot[0.5 (Tanh[10 (x - 1)] - Tanh[10 (x - 3)]), {x, 0, 4}] Dec 12 '14 at 13:44
• At least closely related: 38293
– Kuba
Dec 12 '14 at 16:03

The convolution approach is quite flexible. For example, here a Gaussian function is used to round the edges of the rectangle:

f[y_] = Convolve[Exp[-100 x^2], UnitStep[x - 1] - UnitStep[x - 2], x, y];
Plot[f[y], {y, 0, 3}] One nice thing about the Gaussian is that it gives an analytic form, as you can see by querying f[y]

1/20 Sqrt[π] Erfc[10 - 10 y] - 1/20 Sqrt[π] Erfc[20 - 10 y]


You can find the Laplace Transform using:

LaplaceTransform[f[y], y, s]

• Hello. Thanks for your answer. I am wondering how I can transform the above to the tiny pulse I need (see original question). I've tried a few things, but I lose the rectangle shape unfortunately. Thank you! P.S.: Have a wonderful new year! Jan 7 '15 at 8:52
• To get a tiny pulse, use a very narrow distance between the unit steps and a very narrow Gaussian. Nov 8 '19 at 15:34
• Can you provide any reference to the analytical solution or its derivation? Thanks Apr 28 at 14:36
• @Asheesh Sharma -- I don't know how Mathematica does the integration, but the answer is in f[y] above, containing a couple of Error functions and a couple of square roots. Apr 28 at 18:58