block Tanh "Output the hyperbolic tangent of the input"
extends Interfaces.SISO;
equation
y = Modelica.Math.tanh(u);
annotation (
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{0, -90},
{0, 84}},
color = {192, 192, 192}),
Line(
points = {
{-100, 0},
{84, 0}},
color = {192, 192, 192}),
Line(
points = {
{-80, -80},
{-47.8, -78.7},
{-35.8, -75.7},
{-27.7, -70.6},
{-22.1, -64.2},
{-17.3, -55.9},
{-12.5, -44.3},
{-7.64, -29.2},
{-1.21, -4.82},
{6.83, 26.3},
{11.7, 42},
{16.5, 54.2},
{21.3, 63.1},
{26.9, 69.9},
{34.2, 75},
{45.4, 78.4},
{72, 79.9},
{80, 80}},
smooth = Smooth.Bezier),
Polygon(
points = {
{0, 90},
{-8, 68},
{8, 68},
{0, 90}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Text(
extent = {
{-88, 72},
{-16, 24}},
lineColor = {192, 192, 192},
textString = "tanh"),
Polygon(
points = {
{90, 0},
{68, 8},
{68, -8},
{90, 0}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid)}),
Diagram(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{0, 80},
{-8, 80}},
color = {192, 192, 192}),
Line(
points = {
{0, -80},
{-8, -80}},
color = {192, 192, 192}),
Line(
points = {
{0, -90},
{0, 84}},
color = {192, 192, 192}),
Text(
extent = {
{9, 98},
{42, 80}},
lineColor = {160, 160, 164},
textString = "y"),
Polygon(
points = {
{0, 100},
{-6, 84},
{6, 84},
{0, 100}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Line(
points = {
{-100, 0},
{84, 0}},
color = {192, 192, 192}),
Polygon(
points = {
{100, 0},
{84, 6},
{84, -6},
{100, 0}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Line(
points = {
{-80, -80},
{-47.8, -78.7},
{-35.8, -75.7},
{-27.7, -70.6},
{-22.1, -64.2},
{-17.3, -55.9},
{-12.5, -44.3},
{-7.64, -29.2},
{-1.21, -4.82},
{6.83, 26.3},
{11.7, 42},
{16.5, 54.2},
{21.3, 63.1},
{26.9, 69.9},
{34.2, 75},
{45.4, 78.4},
{72, 79.9},
{80, 80}},
color = {0, 0, 0}),
Text(
extent = {
{70, 25},
{90, 5}},
textString = "4",
lineColor = {0, 0, 255}),
Text(
extent = {
{-106, 21},
{-86, 1}},
textString = "-4",
lineColor = {0, 0, 255}),
Text(
extent = {
{-29, 72},
{-9, 88}},
textString = "1",
lineColor = {0, 0, 255}),
Text(
extent = {
{3, -72},
{23, -88}},
textString = "-1",
lineColor = {0, 0, 255}),
Text(
extent = {
{72, -8},
{98, -26}},
lineColor = {160, 160, 164},
textString = "u")}),
Documentation(info = "<html>\n<p>\nThis blocks computes the output <strong>y</strong> as the\n<em>hyperbolic tangent</em> of the input <strong>u</strong>:\n</p>\n<pre>\n y = <strong>tanh</strong>( u );\n</pre>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Math/tanh.png\"\n alt=\"tanh.png\">\n</p>\n\n</html>"));
end Tanh;