# Piecewise smooth rectangular pulse

I am wondering how to create a rectangular pulse with a non linear falling edge on one side, and straight line sloping from the falling edge (the red line).

So far I have managed to get the plot without the falling edge by using the ListStepPlot function, but I would like to have one continuous function as I will be applying a Fourier Transform to it. I have seen some ways of making a rectangular pulse with non-linear edges by using Convolve and implementing a Gaussian function, but after playing around with it I can't replicate the graph exactly.

I would also like to be able to change the height of the step as well as the sloping line, and the steepness of the falling edge.

Any help is appreciated! Thanks!

• mathematica.stackexchange.com/a/234067/72111 Mar 24, 2022 at 10:46
• Do you know the equation that the trailing edge is supposed to conform to? Mar 24, 2022 at 10:48
• Thanks for the comment @cvgmt! I checked the link, but I would like to have one continuous function instead of a piecewise so that I can perform a Fourier transform on the function. Mar 24, 2022 at 10:51
• @image_doctor Do you mean the right side of the graph that is sloping? It is supposed to attenuate with a factor of $e^{-\eta z}$ where $\eta$ is an attenuation constant. Mar 24, 2022 at 10:53
• Thank you @halce, is there a reason you don't use that equation directly to form the right hand ( trailing edge ) of the pulse ? Mar 24, 2022 at 11:24

I wrote this for this sort of thing. First make a list of points that the function should go through. Then use my MonotonicInterpolation.

points={{-8230.0,1.2},{-8060.0,1.2},{-8050.0,1.1985},{-8042.4,1.19},{-8035.8,1.1701},{-8027.7,1.119},{-8020.3,1.059},{-8012.3,1.0167},{-8007.4,1.006},{-8000.0,1.0},{-7990.0,0.9965},{-7980.0,0.9936},{-7700.0,0.91}};
funct=ResourceFunction["MonotonicInterpolation"][points];
Plot[funct[a],{a,-8230,-7700}]


Plot up close to see how smooth the function above is.

Plot[funct[a],{a,-8060,-7980}]


In Properties and Relations for the MonotonicInterpolation documentation I show how you can ensure linear extrapolation is used beyound the interpolation interval. If you want to convert the InterpolatingFunction above to a Piecewise function use this.