{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Universidade Federal do Rio Grande do Sul (UFRGS) \n", "Programa de Pós-Graduação em Engenharia Civil (PPGEC) \n", "\n", "# PEC00025: Introduction to Vibration Theory\n", "\n", "\n", "### Class 03 - Laplace Transform\n", "\n", "[1. Introduction](#section_1) \n", "[2. Formal definition](#section_2) \n", "[3. Laplace transform of some basic functions](#section_3) \n", "[3.1. Unit step (Heaviside's) function](#section_31) \n", "[3.2. Unit impulse (Dirac's Delta) function](#section_32) \n", "[3.3. Sine and cosine functions](#section_33) \n", "[4. Translation theorems](#section_4) \n", "[5. Transform of derivatives](#section_5) \n", "[6. Transform of integrals](#section_6) \n", "[7. Convolution theorem](#section_7) \n", "[8. Assignment](#section8)\n", "\n", "---\n", "_Prof. Marcelo M. Rocha, Dr.techn._ [(ORCID)](https://orcid.org/0000-0001-5640-1020) \n", "_Porto Alegre, RS, Brazil_ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Introduction <a name=\"section_1\"></a> \n", "\n", "Whenever a function $f(t)$ is defined by means of a differential equation \n", "and a suitable set of boundary conditions, it may be convenient to \n", "transform the problem of finding $f(t)$, a function of an independent\n", "variable $t$ (time), into a new problem of finding $\\bar{f}(s)$, function \n", "of a transformed independent variable $s$ (complex frequency). \n", "This linear operation may be generically expressed as:\n", "\n", "$$\\bar{f}(s) = \\int_{a}^{b} K(s,t) \\; f(t) \\; dt $$\n", "\n", "where the function $K(s,t)$ is called _transform kernel_.\n", "If the integral limits $a$ and $b$ are finites, the function \n", "$\\bar{f}(s)$ is a _finite transformation_.\n", "Among many possibilities, we shall study the two most important kernels \n", "in our context of vibration analysis, namely the _Laplace_ and the \n", "_Fourier_ transforms.\n", "These transforms feature the possibility of being reversed in a unique\n", "way and can be used to find solutions of linear systems (differential\n", "equations) both algebraically or numerically.\n", "\n", "In the particular case of _Laplace Transform_, we are concerned with the\n", "time domain solutions of the dynamic equilibrium equation for some \n", "special loading functions, such as the _unit impulse_ and the _unit step_ \n", "functions, which are of fundamental importance for understanding the\n", "dynamic behavior of structural systems.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Formal definition <a name=\"section_2\"></a> \n", "\n", "Let $f(t)$ be a function defined for all $t > 0$. \n", "The _Laplace Transform_ of $f(t)$ is defined as:\n", "\n", "$$ \\mathscr{L}\\left\\{ f(t) \\right\\} = \\bar{f}(s) = \\int_{0}^{\\infty} e^{-st}\\; f(t) \\; dt $$\n", "\n", "The transform kernel in this case is\n", "\n", "$$ K(s,t) = e^{-st} $$\n", "\n", "with $s$ being a complex frequency $s = \\sigma + i\\omega$, with units in \n", "radians per second for $t$ in seconds.\n", "Observing that one of the integral bounds is infinite, the function $f(t)$ \n", "must fulfill some special conditions such that the integral convergence\n", "can be ensured.\n", "For instance, the function $f(t)$ must have a finite number of finite \n", "descontinuities and no infinite descontinuity (be piecewise continuous) \n", "along the integration interval.\n", "We will not give further details about these conditions, for there will be\n", "no issues regarding the functions we will be addressing here.\n", "\n", "Although the Laplace transform can be reversed in a unique way, its inverse form\n", "cannot be expressed in a closed form as the direct transform. \n", "The transform of a given function and its inverse constitutes a so-called\n", "_transform pair_, usually represented as:\n", "\n", "$$ f(t) \\Longleftrightarrow \\bar{f}(s) $$\n", "\n", "The most straightforward way of using Laplace transforms is by means of \n", "_lookup tables_ or CAS (_Computer Algebra Systems_).\n", "However, some fundamental functions and theorems must receive special attention \n", "as follows.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Laplace transform of some basic functions <a name=\"section_3\"></a> \n", "\n", "### 3.1. Unit step (Heaviside's) function <a name=\"section_31\"></a> \n", "\n", "The _unit step_, also known as _Heaviside's function_, is defined as \n", "\n", "$$ H(t-\\tau) = \\left\\{ \n", " \\begin{array}{lll}\n", " 0 & \\mbox{if} &t < \\tau \\\\\n", " 1 & \\mbox{if} &t \\geq \\tau\n", " \\end{array} \n", " \\right . $$\n", "\n", "and is depicted in the figure below (for $\\tau = 0$): \n", "\n", "<img src=\"images/heaviside.png\" alt=\"Heaviside\" width=\"480px\"/>\n", "\n", "By applying the Laplace transform to this function and adjusting integral limits gives:\n", "\n", "$$ \\mathscr{L}\\left\\{ H(t-\\tau) \\right\\} = \\bar{H}(s) \n", " = \\int_{\\tau}^{\\infty} e^{-st} \\cdot 1 \\cdot dt $$\n", "\n", "and hence:\n", "\n", "$$ \\bar{H}(s) = \\frac {e^{-s\\tau }}{s} $$\n", "\n", "For the particular case where the discontinuity occurs for $t = \\tau = 0$, it results:\n", "\n", "$$ \\bar{H}(s) = \\frac{1}{s} $$\n", "\n", "The Heaviside's function usually represents a sudden change in a otherwise static load, \n", "which may cause some significant dynamic response.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2. Unit impulse (Dirac's Delta) function <a name=\"section_32\"></a> \n", "\n", "The _unit impulse_, also known as _Dirac's Delta function_, is defined as \n", "\n", "$$ \\delta(t-\\tau ) = \\left\\{ \n", " \\begin{array}{lll}\n", " 0 & \\mbox{if} &t \\neq \\tau \\\\\n", " \\infty & \\mbox{if} &t = \\tau \n", " \\end{array} \n", " \\right . $$\n", "\n", "and is depicted in the figure below (for $\\tau = 0$): \n", "\n", "<img src=\"images/dirac.png\" alt=\"Dirac's Delta\" width=\"480px\"/>\n", "\n", "The main point about Dirac's function is that, although the function goes to\n", "infinity at $t = \\tau$, the function has a finite integral:\n", "\n", "$$ \\int_{-\\infty}^{\\infty} \\delta(t-\\tau) \\; dt = 1 $$\n", "\n", "and this implies that for any function $f(t)$:\n", "\n", "$$ \\int_{-\\infty}^{\\infty} f(t) \\; \\delta(t-\\tau) \\; dt = f(\\tau) $$\n", "\n", "It can be observed that the Dirac's Delta is not a function in the\n", "classical sense, but rather a _distribution_, like the Gaussian probability\n", "density function. \n", "In fact, Dirac's Delta can be understood as a Gaussian density function \n", "with standard deviation equal to zero and mean value equal to $\\tau$ or,\n", "in order words, a _deterministic_ distribution.\n", "From this viewpoint, the integral above corresponds to the definition of\n", "the expected value of $f(t)$, calculated as the function $f(\\tau)$ at the \n", "deterministic time instant $t=\\tau$.\n", "\n", "By applying the Laplace transform to this function it results:\n", "\n", "$$ \\mathscr{L}\\left\\{ \\delta(t-\\tau) \\right\\} = \\bar{\\delta}(s) = \n", " \\int_{0}^{\\infty} e^{-st} \\; \\delta(t-\\tau) \\; dt $$\n", "\n", "and hence:\n", "\n", "$$ \\bar{\\delta}(s) = e^{-s\\tau} $$\n", "\n", "For the particular case where the discontinuity occurs for $t = \\tau = 0$:\n", "\n", "$$ \\bar{\\delta}(s) = 1 $$\n", "\n", "The Dirac's Delta function usually represents an impulsive load with very short\n", "duration, which also may cause some significant dynamic response.\n", "By comparing the above plots for both the Heaviside's and the Dirac's Delta \n", "functions, it can be readily observed that they are related by integration or\n", "derivation as:\n", "\n", "\\begin{align*}\n", " H(t-\\tau) &= \\int \\delta(t-\\tau) \\; dt \\\\\n", "\\delta(t-\\tau) &= \\frac{d H(t-\\tau)}{dt} \n", "\\end{align*}\n", "\n", "We will come back later on this relation.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.3. Sine and cosine functions <a name=\"section_33\"></a> \n", "\n", "The well known functions $\\sin(\\omega t)$ and $\\cos(\\omega t)$ can also undergo \n", "a Laplace transform, as shown in the following.\n", "The parameter $\\omega$ is a frequency, usually in radians per second with time \n", "$t$ in seconds, as depicted below for $x = \\omega t$.\n", "\n", "<img src=\"images/sine_cosine.png\" alt=\"Sine and Cosine\" width=\"480px\"/>\n", "\n", "Applying the Laplace transform to the sine function gives:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\sin (\\omega t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\; \\sin(\\omega t) \\; dt = \\frac{\\omega}{s^2 + \\omega^2} $$\n", "\n", "and similarly for the cosine function:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\cos (\\omega t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\; \\cos(\\omega t) \\; dt = \\frac{s}{s^2 + \\omega^2} $$\n", "\n", "In vibration analysis, the sine and cosine functions are used to represent both loadings and system response. \n", "\n", "---\n", "\n", "_Note: Laplace transforms, both direct and inverse, are available at the \n", "HP Prime calculator operating in CAS mode. \n", "For instance, for cosine transform by typing_ ```laplace(cos(s*w),s)``` _will result in_\n", "```s/(s^2 + w^2)```_, while by typing_ ```invlaplace(s/(s^2 + w^2),s)``` _will result in_\n", "```cos(s*|w|)```_. \n", "Hence, this calculator is a nice replacement for Laplace transform lookup tables._\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Translation theorems <a name=\"section_4\"></a> \n", "\n", "Translation theorems are available both in time and in frequency domain. \n", "Let us start by calculating the Laplace transform of a function $e^{\\omega t} f(t)$:\n", "\n", "$$ \\mathscr{L} \\left\\{ e^{\\omega t} f(t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\; e^{\\omega t} f(t) \\; dt = \n", " \\int_{0}^{\\infty} e^{-(s - \\omega)t} \\; f(t) \\; dt $$\n", " \n", "Hence:\n", "\n", "$$ \\mathscr{L} \\left\\{ e^{\\omega t} f(t) \\right\\} = \\bar{f}(s - \\omega) $$\n", "\n", "which is the translation theorem in frequency domain. \n", "It means that a shift of $s$ by $\\omega$ corresponds, in time domain,\n", "to multiplying the function $f(t)$ by the exponential function $e^{\\omega t} f(t)$.\n", "\n", "The other way around, let us replace the dummy variable $t$ by $\\xi = t - \\tau$ in\n", "the definition of Laplace transform. Recognizing that $d\\xi = dt$ and that \n", "for $\\xi = 0$ one has $t = \\tau$ gives:\n", "\n", "$$ \\int_{\\tau}^{\\infty} e^{-s(t - \\tau)} \\; f(t - \\tau) \\; dt = \n", " e^{s \\tau} \\; \\int_{0}^{\\infty} e^{-st} \\; H(t - \\tau) \\; f(t - \\tau) \\; dt $$\n", "\n", "and consequently:\n", "\n", "$$ \\mathscr{L} \\left\\{ H(t - \\tau) f(t - \\tau) \\right\\} = e^{-s\\tau} \\; \\bar{f}(s) $$\n", "\n", "which is the translation theorem in time domain. \n", "It means that by multiplying the transformed function $\\bar{f}(s)$ by $e^{-s\\tau}$ \n", "corresponds to shifting the time domain by $\\tau$ and zeroing all function values \n", "before the instant $\\tau$.\n", "\n", "It will be seen that the translation theorem in frequency domain is used to \n", "solve the equilibrium equation of linear damped systems.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Transform of derivatives <a name=\"section_5\"></a> \n", "\n", "The Laplace transform applied to derivatives is essential for solving \n", "differential equations.\n", "It is expressed as:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\dot{f}(t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\; \\dot{f}(t) \\; dt $$\n", "\n", "where the dot notation is used for time derivative:\n", "\n", "$$ \\dot{f}(t) = \\frac{df}{dt} $$\n", "\n", "This can be solved through integration by parts by defining:\n", "\n", "\\begin{array}{ll}\n", " u &= e^{-st} \\hspace{2cm} &dv = \\dot{f}(t) \\; dt \\\\\n", " du &= -s e^{-st} dt &v = f(t) \n", "\\end{array}\n", "\n", "and replacing in:\n", "\n", "$$ \\int u \\; dv = uv - \\int v \\; du$$\n", "\n", "to get:\n", "\n", "$$ \\int_{0}^{\\infty} e^{-st} \\; \\dot{f}(t) \\; dt = \n", " -f(0) + s \\int_{0}^{\\infty} e^{-st} \\; f(t) \\; dt$$\n", "\n", "and hence:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\dot{f}(t) \\right\\} = -f(0) + s \\bar{f}(s)$$\n", "\n", "where $f(0)$ is the initial value of $f(t)$ in time domain.\n", "For solving the dynamic equilibrium equation of linear systems, the second time\n", "derivative of $f(t)$ will also be necessary. \n", "Applying again the derivation rule results:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\ddot{f}(t) \\right\\} = -s f(0) - \\dot{f}(0) + s^2 \\bar{f}(s)$$\n", "\n", "Time derivatives of higher order can be calculated but will not be necessary in the\n", "present context.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Transform of integrals <a name=\"section_6\"></a> \n", "\n", "Although it is not necessary for solving the basic form of the dynamic equilibrium equation,\n", "the same technique used in the previous section can be used for transforming integrals as:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\int_0^t f(\\tau) \\; d\\tau \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\; \\int_0^t f(\\tau) \\; d\\tau \\; dt $$\n", "\n", "This can be also be solved through integration by parts by defining:\n", "\n", "\\begin{array}{ll}\n", " u &= \\int_0^t f(\\tau) \\; d\\tau \\hspace{2cm} &dv = e^{-st} \\; dt \\\\\n", " du &= f(t) \\; dt &v = -e^{-st} / s \n", "\\end{array} \n", "\n", "and replacing in:\n", "\n", "$$ \\int u \\; dv = uv - \\int v \\; du$$\n", "\n", "to get: \n", "\n", "$$ \\int_{0}^{\\infty} e^{-st} \\; \\int_{0}^{t} f(\\tau) \\; d\\tau \\; dt = \n", " 0 + \\frac{1}{s} \\int_{0}^{\\infty} e^{-st} \\; f(t) \\; dt $$\n", "\n", "and hence:\n", "\n", "$$ \\mathscr{L} \\left\\{ \\int_0^t f(\\tau) \\; d\\tau \\right\\} = \\frac{\\bar{f}(s)}{s}$$\n", "\n", "It can be observed that integration or derivation in frequency domain is simply a matter\n", "of dividing or multiplying by complex frequency $s$, respectivelly.\n", "This can be exemplified by the Heaviside's and Dirac's Delta function by observing that:\n", "\n", "$$ \\bar{H}(s) = \\frac{\\bar{\\delta}(s)}{s} $$\n", "\n", "in agreement to the fact that:\n", "\n", "$$ H(t-\\tau) = \\int \\delta(t-\\tau) \\; dt $$\n", "\n", "as stated at the end of [section 3.2](#section_32).\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 7. Convolution theorem <a name=\"section_7\"></a> \n", "\n", "\n", "The _convolution_ between two functions $f(t)$ e $g(t)$ is defined as the integral:\n", "\n", "$$ f(t) * g(t) \\hspace{3mm} = \\int_{0}^{t} f(\\tau) g(t - \\tau) \\; d\\tau $$\n", " \n", "It can be easily verified that this operation is both commutative and associative:\n", "\n", "\\begin{align*}\n", "f(t) * g(t) &= g(t) * f(t) \\\\\n", "\\left[ f(t) * g(t) \\right] * h(t) &= f(t) * \\left[ g(t) * h(t) \\right]\n", "\\end{align*}\n", "\n", "The convolution operation is graphically depicted in the figure below.\n", "\n", "<img src=\"images/convolution.png\" alt=\"Convolution\" width=\"480px\"/>\n", "\n", "Applying the Laplace transform to the convolution gives:\n", "\n", "$$ \\mathscr{L} \\left\\{ f(t) * g(t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\int_{0}^{t} f(\\tau) g(t - \\tau) \\; d\\tau \\; dt $$\n", "\n", "The upper limit for the inner integral can be changed by multiplying the\n", "integrand by the Heaviside's function:\n", "\n", "$$ g(t - \\tau) H(t - \\tau) = \\left\\{ \n", " \\begin{array}{lll}\n", " g(t - \\tau) & \\mbox{if} &\\tau \\leq t \\\\\n", " 0 & \\mbox{if} &\\tau > t \n", " \\end{array} \n", " \\right . $$\n", "what gives:\n", "\n", "$$ \\mathscr{L} \\left\\{ f(t) * g(t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-st} \\int_{0}^{\\infty} f(\\tau) g(t - \\tau) H(t - \\tau) \\; d\\tau \\; dt $$\n", "\n", "By re-ordering the terms and introducing a variable change $\\xi = t - \\tau$ gives:\n", "\n", "$$ \\mathscr{L} \\left\\{ f(t) * g(t) \\right\\} = \n", " \\int_{0}^{\\infty} f(\\tau) \\int_{0}^{\\infty} e^{-s(\\tau + \\xi)} g(\\xi) H(\\xi) \\; d\\xi \\; d\\tau $$\n", "\n", "Recognizing now that $H(\\xi) = 1$ for all domain allows the integration variables to be separated:\n", "\n", "$$ \\mathscr{L} \\left\\{ f(t) * g(t) \\right\\} = \n", " \\int_{0}^{\\infty} e^{-s\\tau} f(\\tau) \\; d\\tau \\cdot \n", " \\int_{0}^{\\infty} e^{-s\\xi} g(\\xi) \\; d\\xi $$\n", "\n", "what finally implies that:\n", "\n", "$$ \\mathscr{L} \\left\\{ f(t) * g(t) \\right\\} = \\bar{f}(s) \\; \\bar{g}(s) $$\n", "\n", "This is the _Convolution Theorem_ for Laplace transform. \n", "It implies that whenever a Laplace transform can be expressed as the product of\n", "two functions in the complex frequency $s$, the inverse Laplace of this\n", "product is the convolution between the inverse transform of each single function.\n", "This theorem will be used to solve the differential equilibrium equations of\n", "dynamic systems subjected to forced vibration.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 8. Assignment <a name=\"section_8\"></a> \n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[1 2 3 2 1]\n" ] } ], "source": [ "import numpy as np\n", "\n", "#a = np.array([1, 2, 3, 4]) # \n", "#b = np.array([1, 2, 3, 4])\n", "a = np.array([1, 1, 1])\n", "print(np.convolve(a,a))\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Plotting a set of complex numbers\n", "\n", "%matplotlib qt\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "t = np.linspace(-5,5,100)\n", "s = np.exp(t + 1j*t)\n", "\n", "plt.figure(1)\n", "plt.scatter(s.real, s.imag, color='blue')\n", "plt.axis([-20,5,-5,10])\n", "plt.grid(True)\n", "plt.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" } }, "nbformat": 4, "nbformat_minor": 2 }