# Full State Feedback question

1. Oct 22, 2014

### zoom1

Below wikipedia page summarizes the full state feedback. Everything is clear but to be able to implement this controller I need to know my states. But What I know is just the A, B and C matrices. So, to be able to simulate this technique on simulink I need to observe the state, I think. Is this the only way, or there is a way around ?

2. Oct 22, 2014

### milesyoung

If we're just talking simulation, you only need to know the initial state of the system. In practice, you'd need transducers for the full state or an observer (if your system is observable).

In Simulink, put down an integrator and take its output to be $x$. Then use that output along with $u$ to form $\dot{x}$, which is the input for the integrator you just put down. Enter the initial state into the IC-field of the integrator, choose solver etc. and simulate.

3. Oct 23, 2014

### zoom1

Output of the state-space block of simulink is only one of the state variables.

C*x = [0 1]*[y';y]

So I can't reach the state x.
Also simulink doesnt allow me to choose the C and Identity to get the x itself directly as output.

4. Oct 23, 2014

### milesyoung

If so, when you place it in your diagram, just set C = 1, D = 0, so the output is equal to the state $x$.

Edit: If you have an older version of Simulink with a different implementation of the block, upload a screenshot of the configuration window for the block (the one that pops up when you double-click it), so I can see what you're on about.

Last edited: Oct 23, 2014
5. Oct 26, 2014

### zoom1

I am using the exacty block you showed but don't know why it does not work. I found a way around it by implementing the state space diagram with my own blocks.

However, I am not getting the response I am looking for.
My plant is = 1/s(s+1)

desired poles location's characteristic equation is s^2 + 3.28s + 12.96

So, I found the K1 and K2 values for the state feedback as 12.96 and 2.28 respectively.

When I apply the step input, at steady state system response's amplitude is 0.077 , but it should be 1, right ?

But design criteria I used to model the characteristic equation are met (20% overshoot and less than 0.5 sec. rise time)

Why there is such a steady state error ?

6. Oct 26, 2014

### milesyoung

7. Oct 26, 2014

### zoom1

There it is;
http://dfiles.eu/files/24m30ce99

8. Oct 26, 2014

### donpacino

if your closed loop transfer function is 1/(s^2 + 3.28s + 12.96), then your steady state gain will be 1/12.96, which is ~0.077. So your response is expected. You need to adjust the DC gain going in!

EDIT:
Also IMO you should almost always implement the state space diagram with your own blocks, as it can give you more insight into state values in simulation should you need them. Note there are exceptions

9. Oct 26, 2014

### zoom1

But if I am controlling the system, it should track the reference with the desired criteria. So, what else can I change in the system to get it track the reference ?

10. Oct 26, 2014

### milesyoung

Full-state feedback allows you to set conditions for the eigenvalues of the closed-loop system matrix $\mathbf{A} - \mathbf{BK}$, but you have no guarantee of any constraint on the steady-state errors between input and output channels. You'll need a slightly different control structure to handle that.

Try prescaling your input by 12.96 and see if that doesn't give you approximately zero steady-state error to a step input. I can post the design procedure a bit later.

Edit: The prescaler is trivial here since your system is so simple (SISO) - you just have to bring the DC gain up like donpacino mentioned.

11. Oct 26, 2014

### zoom1

Oh I see, then this is the trade-off between steady state error and being able to put the poles anywhere you wish as long as the plant is controllable

12. Oct 26, 2014

### milesyoung

No, the Wikipedia page is just very light on details. It doesn't show you the control structure or design procedure to introduce a reference input without major shortfalls.

13. Oct 26, 2014

### milesyoung

14. Oct 26, 2014

### zoom1

Ok, I got it.

I designed an observer over my model which is simply;

and used the x_head from the observer's output to multiply with K gain and feed back to the system with negative sign.

It worked perfectly, but now I want to inspect the poles and zeros of the overall system, so I need to find a TF between my refence and output. That was easy with classical methods but with state space matrices I have no idea how to get the TF. Couldn't find any piece of information on the web as well.

Any idea how to do that ?

15. Oct 27, 2014

### milesyoung

Is the addition of the observer something you actually want?

If your goal was to ensure zero steady-state error to a step input, you could just have used the method shown in 'Case 1' in those slides - that was for full-state feedback, i.e. the control structure you already had in place.

16. Oct 27, 2014

### zoom1

Yes I built the observer intentionally. It's clear that the pre-scaling works as I wished. But I just want to inspect the dynamics of the observer as well. So, that's why I am looking for close loop transformation.

17. Oct 27, 2014

### donpacino

You can dump data to the matlab workspace and do a bode plot to find the poles & zeros. That's how I've always done it. There may be a better way....

18. Oct 27, 2014

### donpacino

The sad news is there is no super easy way to do it (in comparison to a TF system in matlab where you simply type in poles(sys) ).
If you find a very easy tool to do it with let me know.

19. Oct 27, 2014

### zoom1

How do you do exactly ? You only have the input and output. So, how can you plot the bode ?
And then how do you deduce the poles and zeros from bode plot ?

20. Oct 27, 2014

### zoki85

If you are asking for methodology how to aproximate TF from Bode, then: