# Inverse Laplace Transform Calculator

## Written by Jim Mills

Input Panel Text/Control Panel
Closed Loop Panel Time Plot Panel

# Instructions

### Introduction

This program computes the time domain impulse response of a system represented by its poles and zeroes on the complex s plane, using the inverse Laplace transform. It also optionally computes the poles and zeroes of the system with feedback applied, and shows the impulse response of that. The closed loop poles and zeroes display and the time plot display are updated instantly as system roots are dragged around the s-plane.

### The Display area

The display area is divided into 4 quadrants. The upper left hand quadrant is the input panel. This is used to enter and move the system poles and zeroes. Poles are represented by 'X's, zeroes by 'O's. The upper right quadrant is the text/control panel. The left hand side of the text/control panel consists of the feedback gain slider. Feedback gain can be adjusted from -40 to +40 dB. The remainder of the text/control panel consists of the buttons used to control the program, and a text area which can optionally be used to show the values of the roots and other system parameters. The lower left hand quadrant is the closed loop panel. This shows the locations of the poles and zeroes of the system when feedback is added to the open loop system, with proportional gain as set by the gain slider. The lower right hand quadrant is the time plot panel. This shows the impulse response of the system, either open loop or closed loop, as selected by the 'closed loop' checkbox.

### Panel scale and auto ranging

The input panel has a fixed dimension of +/- 5 by 5 reciprocal time units. The closed loop panel scale expands as required to show all roots. When this occurs, the yellow rectangle border shrinks to show the equivalent scale of the input panel. The time plot display range is calculated automatically whenever roots are created, and, in analysis mode, when a mouse click occurs in the input panel with nothing selected.

### The Text/Control Panel

Most of these commands are self-explanatory. The numerical value of the feedback gain is shown. If the closed loop checkbox is unchecked, the time plot panel shows the impulse response of the open loop system (the closed loop roots are calculated nonetheless). In the add pole and add zero modes, mouse clicks in the input panel create poles and zeroes. Each click creates one complex conjugate pair of roots, or, if close to the horizontal axis, one real root. In analysis mode, individual roots can be selected and dragged around the s-plane, in the usual manor. The closed loop and time plot panels are updated instantly as roots are moved, creating the most interesting visual affect of this program. Check the auto update text box to show values of system parameters at the bottom of the text/control panel. Restart program erases all the system roots.

### Test and Diagnostic section

These functions were included to verify the mathematics classes. The complex arithmetic labels are always active, taking as input arguments the most recent mouse click and the current mouse location in the input panel. If polynomial test mode is selected, input panel mouse clicks create roots of the test polynomial. The time plot panel shows the polynomial representation as a summation of non-negative powers of s, multiplied by real coefficients, shown in bar graph form. The closed loop panel shows the polynomial converted back from coefficient form to root form (demonstrating the complex polynomial root solver). Root selection and dragging is unavailable in polynomial test mode.

### Theory of operation (summarized)

The open loop transfer function is represented as a ratio of polynomials in s, N(s) / D(s). The system zeroes are the roots of N(s), and the poles are the roots of D(s). When the output is multiplied by a gain k, and subtracted from the input (applying feedback), the transfer function becomes N(s) / (D(s) + kN(s)). To perform this calculation the polynomials are converted into coefficient format, added appropriately, and then put to the root solver, to solve for the poles of the system with feedback. (Note that the zeroes are unchanged.) This is done by Laguerr's method, as shown in 'Numerical Recipes in C'. Partial fraction expansion is used to convert the transfer function into a summation of individual coefficients divided by individual root terms. At this time systems with repeated roots or with more or same number of zeroes than poles are not supported. The inverse Laplace transform is used to convert these terms into the corresponding time domain functions, the summation of which is shown in the time plot display, the impulse response of the transfer function. The time plot time axis range is set as a multiple of the smallest time constant of the system. The time plot magnitude range is set as the biggest amplitude seen in the first half of the plot.

## For the non-technically inclined

This program uses a GUI to create an interactive engineering simulation. You might find the generated graphics interesting even if you don't have an understanding of what is represented. To create some interesting functions with minimal effort, do the following:

1. Click the mouse twice in the upper left quadrant. Little X's should appear where you click. These are the system 'poles'.
2. In the upper right quadrant, check the 'set mode: analysis' checkbox.
3. Back in the upper left quadrant, select and drag the poles. Observe how the contents of the lower quadrants shift as you do so.

### More things to try

1. Check the Mode: add zeroes box. Zeroes are represented by 'O's. Although the limit of the number of zeroes or poles you can add is very high (about 50), the most interesting results are obtained with no more than a few of each.
2. Adjust the feedback gain slider. This is the vertical slider in between the upper left and right quadrants.
3. Click on the Restart program button to eliminate all the poles and zeroes and start over.
4. If the line on the lower right quadrant (the 'time plot panel') becomes nothing more than a horizontal line, make sure that 'select mode: analysis' is checked and click twice in the input panel, away from any poles and zeroes.