Version 1.0, © 2003 Vasantha Crabb
This archive contains three functions that may be of use to electrical engineers: the sinc function,
a Laplace transform function, an inverse Laplace function and a collection of functions for control
problems. The sinc function is defined as . This function is useful in telecommunications, being the Fourier transform of a
flat-top pulse. It is written in User RPL.
The Laplace transform and inverse Laplace transform use the built-in function, but use the convention of using t-domain and s-domain, rather than using the same independent variable in both domains. These programs are written in System RPL. The source code is provided as HP 49 strings that can be compiled with MASD on the calculator. These functions are written for ROM version 1.19-1 or later. They will not work with ROM version 1.18 (the location of some mode variables has changed in the newer ROM version).
The control functions deal with a unity-feedback control system of the form . They can be used to find the closed
loop transfer function, and find the steady state error for a few standard inputs. There is also a
function to convert a state space model to an s-domain transfer function.
File Name | Description |
---|---|
aErr | Steady state error when tracking acceleration input |
CLTF | Get closed loop transfer function |
ERR | Get error function |
iLap2 | Inverse Laplace transform |
iLap2.RPL | Source code for inverse Laplace transform |
images | Contains images used in this document |
Lap2 | Laplace transform |
Lap2.RPL | Source code for Laplace transform |
pErr | Steady state error when tracking position (step) input |
README.html | This document |
SINC | sinc function |
SS2TF | Convert state space model to transfer function |
vErr | Steady state error when tracking velocity (ramp) input |
First decide which functions you want, and then transfer them to your calculator. You can place them in any directory, and you will be able to use them in any subdirectory of that location. If you place them in your HOME directory, they will be accessible anywhere on the calculator. You can access the functions from the VAR menu if you’re in the directory where you stored them, or by typing their names if you’re in a subdirectory. You can add them to a custom menu, or assign them user keys to make them more accessible.
Called SINC, the purpose and use of this function should be quite obvious. It takes a single argument, which may be a number, variable or equation (basically, anything that you can find the sine of) and returns the sinc of it. It honours the current modes (numerical results, approximate mode, etc.), and attempts to simplify the result.
These Laplace transform function is called Lap2 and the inverse Laplace transform function is called iLap2. The Laplace transform function takes a time-domain function in terms of t as an argument, and returns an s-domain function in terms of s. It saves the state of the complex and approximate mode flags, and restores these after it completes. If the argument is a real number, or a complex number of the form (re, im), approximate and/or complex mode will automatically be switched on while performing the Laplace transform. If you cancel a mode switch, the independent variable will be changed to t.
The inverse Laplace transform function, called iLap2 works in a similar fashion. It takes an s-domain function in terms of s as an argument, and returns a time-domain function in terms of t. If you cancel a mode switch, the independent variable will be changed to s.
The state of the complex flag can have a radical effect on the results produced by the inverse
laplace transform function. Take, for example, the s-domain function . If we were to convert this to time
domain by hand, we would first complete the square in the denominator, giving us
. We can now split the numerator and
make it into two fractions which we know the inverse Laplace transform of:
. The inverse laplace transform of
this function is
.
If we pass the same expression to iLap2 with the calculator in real mode, we will get the
result , which confirms the result
we just got by ourselves. The calculator just prefers to place sine before cosine, and to keep powers
positive. However, if the calculator was in complex mode, we would get the result
.
“How does that work?” I hear you ask. Let’s go through it step by step. First we
split the thing up into two parts, and cancel like terms in the numerators and denominators: . Now we’ll take out a common
factor:
, bring those es
up to the top and expand it:
.
It’s still a monster, but it should be starting to look vaguely familiar (you would have seen
something like this in second-year maths). This is the last time we re-arrange it:
. You should recognise this as the
the exponential form of a cosine and a sine, which we can express as
. And that’s exactly what we got doing it by hand.
Now we’ve gone and proved that this is, in fact, exactly the same function that we had before, but is it really worth the effort? The moral of this is, don’t use complex mode unless you really need it! You can get answers that, while technically correct, are practically useless.
As noted in the introduction, most of the control functions are intended to be used with control
problems involving a unity feedback, linear, time-invariant, SISO control system of the form . The with the exception of
SS2TF, all the functions take the open-loop transfer function (in terms of s) as an
argument, and return various characteristics. None of these functions are useful if you have numeric
result mode active, as they return functions in terms of s.
To find the closed loop transfer function, use the function CLTF. This is the overall
transfer function of the system, that is, . CLTF produces an expanded result. You can use the built-in command
FACTOR to factorise the result, or the built-in command PARTFRAC to express it in
partial fraction form. To find the error function (the output from the summer), use the function
ERR. The same notes apply about the output from this function.
The functions pErr, vErr and aErr are for finding the steady state error
for standard position, velocity and acceleration inputs, respectively. The function pErr gives
the steady state error (SSE) when tracking a unit step input of amplitude A. In the s
domain, this will look like . The
function vErr returns the steady state error when tracking a linear ramp input with slope
A. In the s domain, this looks like
. aErr returns the steady state error when tracking a linear acceleration input
with amplitude A. In the s domain, this looks like
. If you forget what any of these signals look like in time domain,
don’t forget iLap2.
Note that, depending on the type number of the system (number of integrators in the loop), the steady state error may be equal to zero or infinity. The functions will handle these situations correctly.
The function SS2TF converts a state space model of the form , where x is a column matrix containing the state
variables, r is a column matrix containing the input variables and y is a column matrix
containing the output variables. The matrices A, B, C and D describe the
system. A is a square matrix with the number of rows and columns equal to the number of state
variables. B will have the number of state variables as its number of rows, and the number of
input variables as its number of columns. C has the number of output variables as its number of
rows and the number of state variables as its number of columns. D has the number of output
variables as its number of rows, and the number of input variables as its number of columns. In a SISO
system (like they give you in control exams at university), B will be a column matrix, C
will be a row matrix, and D will be a one-by-one square matrix.
SS2T takes the matrices A, B, C and D as arguments and returns a matrix containing transfer functions for the output variables. Note that the arguments must be matrices. Vectors will not work. Each row of the output matrix corresponds to one output variable. Each column of the output matrix corresponds to one input variable. For a SISO system, the output will be a one-by-one square matrix relating the output variable to the input variable.
This software is provided free of charge in the hope that it may be useful. No representations are made about its quality, reliability or fitness for any purpose. The author will not be responsible for any damage it may cause, either directly or indirectly, to you, your possessions or your data. This software is Copyright © 2003 Vasantha Crabb. You may freely re-distribute the complete archive between computers, or the functions between calculators. Please do not omit the documentation when sharing this software between computers. You may distribute modified copies, as long as they are marked as such.
This software may be used to allow students to complete examinations much faster than they could otherwise. However, I do not believe it can be used to cheat on examinations. The software performs particular mathematical manipulations. These may be done by hand, although it may take longer. The software cannot tell a student when to perform these manipulations. In essence, the software takes a lot of the mathematical work out of doing a problem. It does not in any way reduce the understanding a student requires to approach a problem.
I hope someone finds these functions useful. I know I have. I would love to hear feedback from anyone using this software. I can be contacted by e-mail at vastheman@users.sourceforge.net. You should be able to get the latest version of this software from my web site at http://vastheman.paservices.com/.