To specify a discontinuous function, such as a step in space or time, you can use logical functions that evaluate to 1 if true and
0 otherwise. For instance, the following function defines a sine wave that exists for 10 seconds and afterward takes the value 0:
To create a smoothed rectangle over an interval [a, b] with one continuous derivative and a smoothing zone
s, use
flc1hs(x-a,0.5*s))-flc1hs(x-b,0.5*s). Similarly, you define a smoothed rectangle over an interval
[a, b] with two continuous derivatives and a smoothing zone
s using
flc2hs(x-a,0.5*s))-flc2hs(x-b,0.5*s).
These functions can be useful as a complement and extension to the predefined Step function. In the interval -scale<x<scale, the functions
flsmhs and
flsmsign are defined by a 7th-degree polynomial chosen so that the 2nd derivative is continuous. Moreover, the moments of order 0, 1, and 2 agree with those for the Heaviside function and the sign function, respectively. This implies that the functions have small overshoots.
Now consider an example. Use flc1hs to model the heat capacity
Cp of a phase-changing material. Assume that a crystalline material has a heat capacity of
1 kJ/kg. Its melting point at the present pressure is 273.15 K. The liquid phase has a heat capacity of
2 kJ/kg. Create a parameter
scale with a value of 0.1 and then an
Analytic node where an analytic function HeatCapacity is defined using the following expression with an argument
T:
1+flc1hs(T-273,scale); then define a plot range of 272.5–273.5 K under
Plot Parameters and click the
Plot button in the
Settings window for
Analytic to plot
Cp around the melting point.