(x,y) = Plot.Examples.Utilities.dampedSine(freqHz, damping, nPeriod=5, nPoints=500);
This function computes nPoints points x[i], y[i] of a sine-curve
y = exp(-x*damping)*sin(2*pi*freqHz*x)
where the abszissa values x[i] are in the range 0 .. nPeriod*T, where T = 1/freqHz is the period of the sine wave.
With the default options and freqHz=2 Hz and damping=0.8, the following curve is generated:
function dampedSine extends Modelica.Icons.Function; input Modelica.Units.SI.Frequency freqHz "Frequency of sine wave"; input Modelica.Units.SI.Damping damping "Damping coefficient of sine wave"; input Integer nPeriod = 5 "Number of periods to show"; input Integer nPoints(min = 2) = 500 "Number of points"; output Real x[nPoints]; output Real y[nPoints]; end dampedSine;