# State Observer Matlab plots

For a standard SISO state observer, once can plot the state response (x) using the system (A-B*K, B, C, 0); how do you do the same for the observer
states (x-hat)? I mean, what would be the analogous system for the observer? I tried (A-L*C, B, C, 0), but that doesn't seem right.
Thanks, Ishaan
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
You are confusing the idealized control system with the observer-plant system. The system (A-B*K, B, C, 0) is the hypothetical system that you wish you were designing, because it has full access to all of the plant states. The actual control system that you work with has more states due to the observer. Call it (A.f, B.f, C.f, 0), where A.f contains the plant system matrix, the observer matrix, and the appropriate cross-coupling (view with a fixed-type font):
[ A -B*k ] Af = [ ] [ l*C A.o - l*C.o - B.o*k ]
Similarly, B.f is the stack of B (the system input vector) and B.o (your observer's input vector).
I'm complicating the explination by seperating A, the actual system matrix from A.o, the observer's design system matrix, because in the real world you don't know what A (or B, or C) really is -- you only have guesses that may or may not be accurate enough to help.
In any case, to see the observer states you need to simulate the full system. Once you do this you can see the extra states, you can set the observer states to different initial values than the system states and see them settle to the correct values and all that fun stuff.
For extra credit I'd advise you to play around with designing your system with A = A.o, B = B.o, etc., tune it to within an inch of it's life, then (a) change some parameter the "real" system's description and/or (b) add one or two states to the "real" system with eigenvalues 5-10 times higher than the highest modelled eigenvalue and run your simulation again.

observer?
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Tim,
Thanks very much for the insight. I now have it, and am using lsim to provide me with the six states, plotting them and the difference between them as the error. I sincerely believe my boneheade relic of a professor has no idea about MATLAB or actually plotting any of this; his notes have the same expression for Af, Bf, Cf you gave, but when we asked him, he asked us to somehow manually split the matrices and plot the two systems differently, around which we went nuts.
Last question; lots of other references (net, Ogata, etc.) seem to give an expression for Af as for the composite system [x e], instead of the [x x.o] we used; I presume simple arithmetic is all that's needed to get x, x.o and e(=x-x.o) from either?
Thanks, Ishaan
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
I don't have that formulation in my book (Kailath), and it's been a long time since I studied this in depth. I _do_ remember that the observer modes are themselves controllable but not observable (assuming that the system model is correct), and I vaguely remember having this presented in a very mathematically tidy way that was a thing of beauty when it was done. In fact if you do the rearrangement of the system to separate the observer modes from the system modes you should be able to plot them seperately.
In defence of your professor, being able to do the math symbolically is usually going to give you much more insight into the way systems behave in general than doing one specific simulation. Keep in mind that with some systems you'll never be able to model them at all: you'll see it often in this group that when you're doing process control there often just isn't enough information to build a plant model thats worth the time.
When I'm doing design I do all the inital work symbolically if I can; I only do simulations later to verify that the design will work with the real-world nonlinearities of the plant and that I haven't made some stupid mistake in setting sampling time and ADC/DAC word lengths. There are some plants that I don't do much simulation or symbolic work, because there just isn't a good way to model it (like, a motor/gear with much backlash and friction -- it's nearly unsimulatable, and a linearized model isn't really valid either). In that case you just need to work with the physical mechanism and tune by the seat of your pants.

has
us
differently,
x.o]
and