Ann,
I haven't looked at the graph yet. I just got back from a piano recital
by Lang Lang that has me still bemused.
You don't sound stupid at all, just more ignorant than you know and
therefore confused. A little reading up on the tools you will use will
go a long way toward dispelling that confusion. bed calls too urgently
for me to give a course on getting the time response to a stimulus when
the frequency response is known, or even what those terms mean. Suffice
it to say for now that linear circuits' time behavior can be described
by differential equations, and that difference equations are the
discretetime analogs of differential equations. (Summation stands in
for integration.)
Jerry

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Ann:
Read the z transforms article* on my website, if you haven't already.
It is written to be understandable for folks from a computer science
background who haven't forgotten their first few weeks of calculus.
While brief, it does outline the similarities and differences between a
signal and a system, and their respective representations in the z
domain. All of these distinctions apply to the Laplace transform should
you wish to derive it from the z transform (or from first principals).
If you find it helpful, I have a brand new book** out there which is
aimed at you, the software engineer who suddenly needs to understand
control theory. It explains the z transform in more detail, it goes
into more detail about signals, their transforms, systems, transfer
functions, and why transfer functions look like transforms of signals.
It also covers the Laplace transform as well as a couple of methods for
finding the zdomain transfer function of a continuoustime system
that's bracketed by an ADC and a DAC.
I strongly recommend that you don't limit yourself to asking questions
about control issues and trusting the answers you get. Like it or not,
you are working on a control problem. You have a huge pile of prior art
that you are ignoring  you should at least seriously scratch the
surface of it, rather than turning a blind eye.
Think of it this way: what will you do if you go to defend your thesis
and there's someone on your committee who understands control theory,
sees the closed loop controller, and starts raking you over the coals
for it? Would you rather be able to show that you understand the
basics, including traditional controllers for inverted pendula, or would
you rather be reduced to a stammering demonstration of ignorance?
* http://www.wescottdesign.com/articles/zTransform/ztransforms.html
** http://www.powells.com/partner/30696/s?kw=Wescott+Tim ,
http://www.elsevier.com/wps/find/bookdescription.cws_home/707797/description#description
Yes, you are right Tim. Looks like I am going to have to invest a good
bit of time in Control Theory.
I have five other processes I need to replicate, so I will need to
understand exactly what I am doing.
Thank you for the link and the reference. They are making things a lot
clearer.
Ann
Ann,
Peter and Tim have pointed you in a good direction. Whatever I could add
would be superfluous and distracting, so I'll bug out. I wish you joy.
Jerry

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Tim, does your book have a complete set of Laplace to z transforms
conversion. Your z transform page doesn't have the one that I used to
calculate the difference equation above. I looked on the internet and
could not find a good set z transform tables either. Fortunately I
have my own tables or can calculate them by other means.
A warning to Anne. The difference equation above only works at .5
second updates. However, .5 seconds isn't really fast enough to do a
good simulation. The update time isn't quite fast enough for the
response of your system. At .1 second the closed loop response looks
smooth and critically damped. The .gif you posted doesn't look that
good. Try the .5 seconds just to see if you can match the results in
the .gif but I would switch to .1 sec intervals for really testing the
fuzzy controller.
A question for anybody. Does Octave use ordinary text that can be cut
and pasted into these newsgroup threads? It would make doing examples
easier.
It describes how to do the conversion. The method I present takes the
zeroorder hold action of the DAC into account  the 'impulse
invariance' method is cool theory, but unless you have a DAC that
outputs impulses it's not too useful in real life.
The method is simple, and the results are exact, not an approximation:
Find the Laplace domain step response, break it down into the time
response elements, take it back up to the z domain using the appropriate
sampling rate, then multiply by (z1)/z.
Easier yet is to use MathCad, but you have to do the final multiply by
cut and paste. I know that SciLab will do this in a snap; I believe
Octave will but I don't know the commands.
The rule of thumb is to choose a sampling rate that is 10 times the
highest frequency of interest in the system. For an unstable system
like an inverted pendulum you'd probably want to choose to have the
unstable pole be at no more than z = 1.1, which means to choose a sample
interval that's 1/10 the coefficient of your unstable pole in the
Laplace domain.
Yes. But I suggest you consider SciLab. It seems to be under more
current development, I had a much easier time getting it working on my
PC, and the scripting language is more object oriented. It's very
control system oriented  in fact, both statespace representations and
polynomial transfer functions are native types.
 The rule of thumb is to choose a sampling rate that is 10 times the
 highest frequency of interest in the system.
What is the frequency of interest? That is vague. Is the frequency of
interest the highest open loop pole or the highest closed loop poles or the
higher of the two. I use the higher of the two and 10 times is a bare
minimum. Anne has a pole at .25 radians per second in her open loop
system. The closed loop poles, in the solution I posted in the .pdf file,
has a frequency of .5 radians/sec. .5 radians per second has a time
constant of 2 seconds. Ann's sample time of .5 second is not 10 times
higher than 2 seconds.
Peter Nachtwey
That's why it's a rule of thumb, and not a hardandfast rule. For
folks who have the wherewithal to do the math I suggest investigating
performance at different sampling rates to see which one seems best.
That's what I use, also. I shade it down if it's a _very_ well behaved
plant, and don't hesitate to go up if the plant has nasty nonlinearities
(which indicates that any apparent open loop 'pole' is going to be
moving around) or if the precision requirements are great.
Yes, I agree with you there  I was giving her the rule of thumb so
she'd know to set the sample rate higher. With an unstable pole in the
system I'd go higher yet, to 20 or even 50x, assuming I had the
processor resources to do it.
Ann, You are spinning your wheels. You can't do a simulation with
function in the time domain is you don't know what the input is going
to be ahead of time and you don't because the input comes from a fuzzy
controller. All these posts about time domain are NA for simulating
how your plant will respond to your fuzzy logic controller.
See my previous post about the difference equations. You need to
convert from the s domain to the z domain and then to a difference
equation. A difference equation is an equation that computes the
output based on a history of outputs and inputs. Each time period you
calculate x(n) using the difference equation and you also calculate a
u(n) using your fuzzy controller. Computers do their calculations
using discrete time periods. I could tell you what the coefficients for
the difference equation should be right now but that would take the fun
of discovery out of it.
Each half second you are going to update the output of the fuzzy
controller and feed it into the plant and then you can monitor to
response. The new u(n) and x(n) will then be use to calculate the next
u(n+1) and x(n+1). If your controller works x(n) will reach the set
point at .65.
Your next should be how do you calculate the difference equation
coefficients. Do you already have the fuzzy controller done?
You have lost 4 days now.
Peter Nachtwey
Guinness isn't the same over here. :(
Hi Peter,
Your kind words and your knowledge are much appreciated. I feel like I
have lost 6 weeks and 4 days!
I haven't even looked at ztransforms, hence my reluctance to go down
that road.
However what you are saying makes sense.
I have used differential equations in my previous experiments with the
inverted pendulum so that should make it easier for me.
Yes, I have the controller done. I can email it to you to prove, it if
you like : )
Thank you for been nice!
Ann
Try this
x(n) = 1.81*x(n1).819*x(n2)+.0004387*u(n1)+.0004104*x(n2)
I haven't had time to test it but try setting u to be fixed at 650.
x(n) should rise to 65 and stay there is the steady state gain for your
system is .1
If it does then try your fuzzy controller.
Peter Nachtwey
Guinness is still good.
I agree with you that the digital method is neccessary in this case
Not sure how you arrived at the above difference equation Peter (What
sampling period did you use??)
Anyway the kind of digitising process I use is as follows for your system
X(s)= (0.00375/((s+0.15)*(s+0.25)))*U(s) Expands to
X(s)[s^2+0.4s+0.0375] = 0.00375 U(s) Which is the Laplace
transform of the DE
x''(t)+0.4x'(t)+0.00375x(t) = 0.00375u(t) Which is a Linear DE of
second order
Which is the best place to start talking about a dynamic system
Digital Domain
The variable z strictly arises from a discretetime summation expression,
related to the integral definition of the LT.
z is usually *approximated* by various substitutions for s in the LTF
The simple method is to replace 's' (A differentiator in the complex
frequency domain) with
s=(1z^1)/Ts
Consider x' = [x(n)x(n1)]/Ts Ts = the sampling
(1)
interval
If z^1 is taken as the Shift Operator then the equivalent to (1) is:
x' = x(n)[1z^1]/Ts Which proves to be an extremely useful
notation
For YOUR equation
X(s)[s^2+0.4s+0.0375] = 0.00375 U(s)
You have a choice of substitutions for s (other than the above) namely
1. Assume a zero order hold on the input (output from the controller is
constant between samples)
This sounds like the logical course to take at least initially
2. The Tustin or Bilinear Transform
3. Prewarping
for 1. The z transform of your LT at a sampling frequency of a=0.1,
b=0.01, c=0.001 is:
Transfer function:
1.85e005 z + 1.826e005

z^2  1.96 z + 0.9608
Sampling time: 0.1
Transfer function:
1.873e007 z + 1.87e007

z^2  1.996 z + 0.996
Sampling time: 0.01
Transfer function:
1.875e009 z + 1.875e009

z^2  2 z + 0.9996
Sampling time: 0.001
There are several reasons for the other methods which are embedded in the
transfer between domains and the frequencies of interest in your system
Other practical considerations are the time it takes the controller to do
the control calculation which is an inherent delay that must be dealt with.
I have plotted the above and they all have the same response to a step
input  (which is the same as the analogue system) which indicates that the
model is at least accurate for this input  The frequency response of the
system should also be considered.
The above can be converted directly to the difference equation by simple
algebraic means and all of these have the same form as Peters system:
x(n) = a*x(n1)  b*x(n2)+ c*u(n1)+.d*x(n2)
I'm sure i've missed loads but I think if you can get your head around this
in a short time you are doing well 
Some one said earlier that you were getting bad advice here  I dont think
that is true.....You did ask how to solve the LT and that is a good place to
start before taking the process to z transform  difference equation 
algorithm
Setanta
The Bold
The controller setpoint  which infers a regulator NOT a servomechanism
which tracks a varying input
But F(s) is the Transfer function ....i.e. the Laplace transform of the
output divided by the input (X/U) so in order to find x(t) you need to
multiply the Transfer function by the LT of U and *then* take the inverse
If the input is a constant value with time  it can be modelled as a step
input (LT of 1 = 1/s ....which is an integration in the time domain!)
Leaving you with the problem of finding the inverse transform of:
for U(t) =1 for t >0 .....otherwise zero
X(s)= U(s)*F(s) = (1/s)*F(s)
Which in Partial fractions issss
A/s + B/s+0.15 + C/s+0.25 = 1/s*F(s)
Work it out!
Then find the inverse transform  which should look like
x(t) = 1  K1e^at +K2e^bt
EEEK
The controller value U is 'multiplied' by the Transfer function F(s)  as
above
It was nasty, all right, but there's a bit of truth in it. I once had a
senior from MIT as a summer intern on a circuit design assignment who
told me that she didn't really understand what inductance was about.
Jerry

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 Hello,

 I am writing up my PhD at the moment, and I was hoping someone would be
 able to confirm some Laplace transform techniques that I have been
 working with.

 My thesis is on selforganising fuzzy logic control and for the past
 month and a half I have been trying to replicate experiments published
 by the original creator of the selforganising fuzzy logic controller
 [1], so as to compare the original work with my own.

 The original author's experiments use a transfer function

 X(s)= (0.00375/((s+0.15)*(s+0.25)))*U

 where U is the controller input to the system and X is the system
 output.

 >From my reading I believe that to graph this in a time domain I have to
 multiply it by 1/s and then get the inverse Laplace transform, am I on
 the right track?

 I have used Maple to calculate this and the resulting equation I am
 using to graph my system is
 x(t)=U[0.10.25*exp(0.15t)+0.15*exp(0.25t)], any idea if this is
 correct ?

 Any help with this would be greatly appreciated, as I have been going
 round in circles for the past few weeks trying to figure it out, I just
 need someone to confirm I'm going in the right direction.

 Thank you for your time,
 Ann
Ann, you are getting lots of bad advice and I don't think you are able to
sort the good from the bad.. You DO NOT need to convert your transfer
function in the s domain to the time domain. This non sense has set you
back days and confused you. You need a difference equation. I do the same
thing you are trying to do to test my control algorithms. I have a link to
a pdf file that shows how I would simulate the control of your systems using
a PID ( IPD).
ftp://ftp.deltacompsys.com/public/PDF/Mathcad%20%20t0p2%20simple%20z%20NG.pdf
This was done using Mathcad. You only need to replace my IPD algorithm
with your fuzzy logic algorithm and you are home free.
Notice the wavy control output ( the green line ). This line is much
smoother if you reduce the sample time T from .5 second to .1 seconds.
Also notice that the IPD control is much better than the fuzzy logic
example. This may be due to the slow update rates.
Peter Nachtwey
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.