Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

state variables

Status
Not open for further replies.

PG1995

Active Member

Attachments

  • lcs_state_space_example.jpg
    lcs_state_space_example.jpg
    549.8 KB · Views: 495
  • lcs_state_space_example2.jpg
    lcs_state_space_example2.jpg
    234.8 KB · Views: 375
Last edited:
With multi-input multi-output systems, you will have all combinations of inputs and outputs. So, two inputs and two outputs implies four transfer functions.
 
Thank you, Steve.

Q1:
But in the end result which one is which. As you say that 2x2 matrix gives us four transfer functions but which one, say, is for Vo/Vi. Kindly help me with it. Thanks.

Q2:
In this method at the bottom, it says that "D" is feedforward matrix and in most cases D=0. In the example being discussed "D" is not zero, so what does it mean in the context of present example?

Q3:
Could you please also help me with this query?

Regards
PG
 

Attachments

  • lcs_state_variable_example3.jpg
    lcs_state_variable_example3.jpg
    560.6 KB · Views: 346
Last edited:
Q1: This is another example that can be studied with Matlab to explore the answer in a specific situation. When you make a system with the "ss" command, and then use the Bode command to plot the response, you will find that multi-input multi-output systems give all possible combinations. You can simply compare to see which ones match up. However, what you will find is that the matrix element (1,1) is the first output relative to the first input, the (1,2) element is the first output relative to the second input, the (2,1) element is the second output relative to the first input, etc.

Q2: The D matrix simply describe direct paths of the inputs to the outputs. A simple example is a perfect amplifier or attenuator. Such systems have no state variables, and the gain or loss shows up in the D matrix directly. In that case, A, B and C are null matrices.

Q3: There is a bit of art to the process of choosing state variables. Sometimes the choice is obvious and the derivation of the equations very easy. Other times, the choice is not so easy and the derivations not so easy. One problem is determining the order of the system which reveals the number of state variables. If you look at some text books on control theory (e.g. Ogata), you will see several methods of deriving equations, and other methods for reformulating equations into different forms by redefining the states, which leads to the diagonal-cononical-form, the controllable-cononical-form and observable-cononical-form for state-space representations. There is no one choice for state variable representations, but there are often preferred choices. The only way to fully appreciate this in detail is by doing actual examples.
 
Last edited:
Thank you, Steve.

Q1:
But in the end result which one is which. As you say that 2x2 matrix gives us four transfer functions but which one, say, is for Vo/Vi. Kindly help me with it. Thanks.

Q2:
In this method at the bottom, it says that "D" is feedforward matrix and in most cases D=0. In the example being discussed "D" is not zero, so what does it mean in the context of present example?

Q3:
Could you please also help me with this query?

Regards
PG


Hi,

The short answer is that there are only two output equations really, because there are only two outputs being solved for. It doesnt matter how many inputs you have, you'll only have two outputs when solving for two outputs. This should be quite simple :)

Now usually these two equations will be BOTH outputs being dependent on BOTH inputs in most cases. But if you really want to know the output with only one input, then set the other input to zero.

So once you have your H matrix you can do the matrix multiplication:
Y(s)=H(s)*u(s)

and here we get two equations Y1(s) and Y2(s). This follows logically from the fact that H(s)=Y(s)/u(s)

and u(s) is the column inputs [vs/s,vi/s] .
 
Last edited:
Hi

The following was reply to this query.

Q3: There is a bit of art to the process of choosing state variables. Sometimes the choice is obvious and the derivation of the equations very easy. Other times, the choice is not so easy and the derivations not so easy. One problem is determining the order of the system which reveals the number of state variables.

Q1: So, the order of system tells us how many state variables we need. For instance, if a system is 2nd order, such as RLC circuit, then there should be two state variables. Please let me know if I have it correct.

Q2: Does there also exist some kind of relationship between the number of inputs and outputs? Suppose if we have two inputs to a system then are the outputs also going to two? Or, the outputs could be one, three, four, etc? Perhaps, that just depends on a system.

Kindly help me with the queries. Thank you.

Regards
PG
 
Q1, Yes.

Q2, The number of inputs and the number of outputs are completely independent of each other. There are no restrictions. Also, the number of states is completely independent. These numbers can be any non-negative finite integer.
 
Hi

According to the method given here the dimensions of matrix A, n x n, are determined by number of state variables, where 'n' is number of state variables, and the number of state variables is determined by order of system. For instance, if system is of second order then there are two state variables (here order refers to order of system's differential equation). The dimensions of matrix B, n x m, are determined by number of state variables and number of inputs. The dimensions of matrix C, p x n, are determined by number of outputs and number of state variables. For matrix D the dimensions are pxm where 'p' is number of outputs and 'm' is number of inputs. My query is here. Kindly help me. Thank you.

Regards
PG
 

Attachments

  • lcs_transfer_to_state_space1.jpg
    lcs_transfer_to_state_space1.jpg
    599.6 KB · Views: 392
You are free to define as many outputs as you like. This is one of the powerful aspects of state-space representations. The idea is that everything you need to know about the system is determinable from the state variables. Hence, any linear function of inputs and state variables can be defined to be an output. If you like, you can take an input and pipe it directly to an output, without modification.

Generally, from the differential equations itself, you can see the inputs that are relevant for the system, and you can argue that every state is an output itself. However, when you define the y-vector and C and D matrices, you can chose to not include all states as outputs. Very often I will use an identity matrix for C and a zero matrix for D so that all states are available as outputs directly.
 
Thank you.

The reason for asking that question was that the dimensions of A, B, C, and D depend upon number of state variables, number of inputs and number of outputs. And here we are transforming a differential equation (or, if you take Laplace transform of the equation then you have transfer function) into state space model and we can easily find number of state variables from the equation's order but how do I get any information about number of inputs and outputs in order to determine dimensions of B, C and D matrices (dimensions of A are easily determined by number of state variables)? Please help me with this. Thanks.

Regards
PG
 
Well, the minimum dimensions of the B matrix are also easily determined by the differential equations. You are forced to include all inputs you see in the differential equation. However, you could choose to define additional inputs that don't affect the state equation, but are only needed to define additional outputs.

The dimensions (EDIT: actually one of the dimensions of each) of the C and D matrix are your choice. That is the point I was trying to make above. You can define any outputs you like as a linear combination of states plus a linear combination of inputs. And, your output definitions are not restricted only to inputs needed in the state equations. You can define additional inputs.

Basically, the differential equation is not the entire story to the system definition. A clear example is a system with zero states. In this case there is no differential equation at all. Still, we can define a system with zero states and any number of inputs and outputs. In this case, the outputs we define is a linear combination of the inputs we define. How do we define them? We choose input variables and put them in a vector (call that vector u) and then define the D matrix. This gives an output vector y=Du. If we can do this for a zero state system, then we are free to do it for any system, no matter how many states. But, now the output equation is y=Cx+Du.

You'll note that I said "you choose". But, sometimes somebody else chooses for you, but when they choose, they need to define it for you, in which case you'll know the answer based on the additional information they provide you.
 
Last edited:
Hi

Could you please help me with this query?

Regard
PG
 

Attachments

  • lcs_transfer_to_state_space1_new.jpg
    lcs_transfer_to_state_space1_new.jpg
    1.3 MB · Views: 374
Last edited:
I'm not sure I follow your question, but I can say something and hope it helps. Please clarify if this doesn't help.

When they say only the B matrix is changed from one case to the other, this is referring to matrices. So, the A matrix is the same and the B matrix changes. However, the state equation depends on both A and B, so the dynamic changes in the state variables is different in both cases.
 
Thank you very much, Steve.

Could you please help me with this query too? Thanks.

Best regards
PG
 

Attachments

  • lcs_example_3-5(ogata).jpg
    lcs_example_3-5(ogata).jpg
    333.9 KB · Views: 320
I think you have it correct. This is a bit of a confusing issue. I think you have to rely on their diagram as a definition of the direction of the forces. Then you have to correctly write Newton's law based on that definition. Personally, I like to define forces in one direction, but the only requirement is to define clearly and adhere to the definitions religiously. We encounter the same issue in circuit theory when we are sometimes free to define current directions or voltage polarities as we like.
 
Thanks a lot, Steve.

I think you have it correct. This is a bit of a confusing issue. I think you have to rely on their diagram as a definition of the direction of the forces. Then you have to correctly write Newton's law based on that definition. Personally, I like to define forces in one direction, but the only requirement is to define clearly and adhere to the definitions religiously. We encounter the same issue in circuit theory when we are sometimes free to define current directions or voltage polarities as we like.

Perhaps I had it right that day but now I don't think I understand it correctly. I have to tried my best to sum up my confusion. Now kindly help me. Thank you very much.

Regards
PG
 

Attachments

  • lcs_example_3-5(ogata)_new.jpg
    lcs_example_3-5(ogata)_new.jpg
    641.9 KB · Views: 344
First, let's deal with Q1.

I don't think the statement is vague and eq.1 is not just valid at t=0. Eq. 1 is Newton's force law applied to this problem, so it should be valid for any time. I think you accurately described the input function u(t) in terms of it's derivative (which is velocity) being a constant at t>0. You basically described the velocity as being the classic step function (multiplied by a constant). Essentially, the acceleration (second derivative of u) is a scaled impulse function, speed (first derivative of u) is a scaled step function and the position (u) is a scaled ramp function. There is nothing wrong with this accept that it is an approximation to what happens in reality. In reality, we apply a large force for a very short duration. If the time duration is short enough, we can consider this to be an impulse function without any significant error.

This impulse force allows the initial act of getting the cart up to constant speed du/dt. However, if we are going to impose the constraint that du/dt is exactly constant, we may have to allow for the fact that additional small forces are needed to keep this valid. But, really we don't need to worry about forces because force is not the input. Speed and position is the input. So acceleration input d^2u/dt^2 is a true impulse in this problem, but force is an impulse plus additional control forces needed to ensure that acceleration is zero for t>0+

For Q2.

First, I would assume the wheels on both carts are frictionless, unless told otherwise. You can argue that the viscous friction on the wheels is included in the dashpot model. Still, it's obvious that static friction and nonlinear friction effects are not being considered here.

I'm not sure how to guide you on understanding why eq. 1 is correct within the given approximations and assumptions. You just need to get experience with this, just as you do when analyzing circuits. I will say that that arrangement is a little difficult from the visualization point of view. I have reasonable experience doing these problems, and I also find it a bit confusing. However, my approach is always to sit and stare at a problem until I can visualize what is happening. As you get more experience, this process takes less and less time.

In this case the dashpot seems to be giving you trouble. Remember that a damper of this type always creates a force that opposes the motion. This is what makes it an energy absorber. This is directly analogous to a resistor that always drops voltage in the direction that current is flowing. Typically the damper force is Fd=-bv where v is the velocity. Notice the negative sign in front describes the force opposing motion. The force direction is always opposite the velocity direction.

Now, this example shows that the v for the damper is the result of dy/dt-du/dt. Hence, if dy/dt is greater than du/dt, the dashpot speed is positive and we want the force to be negative. So, Fd=-b(dy/dt-du/dt) would seem to be the correct force equation. The mass m will accelerate at d^2y/dt^2, and the contribution from the damper is a negative force which makes the mass accelerate in the negative y direction.

I hope this helps.
 
Last edited:
Thanks a lot, Steve.

I'm sorry but I need to jump to a previous post in order to clarify something.

It's about your replies in post #7 to my queries in post #6. Additionally, your post #9 also contains related material. Could you please help me with this new related query. And in post #9 you said that there could be as many outputs as you like. Is this also applicable to number of inputs? Or, the number of inputs are dependent upon the system. Kindly help me with this. Thank you.

Regards
PG
 

Attachments

  • lcs_ogata_3_9.jpg
    lcs_ogata_3_9.jpg
    540.6 KB · Views: 325
Last edited:
In post #9 you said that there could be as many outputs as you like. Is this also applicable to number of inputs? Or, the number of inputs are dependent upon the system. Kindly help me with this. Thank you.

Typically, the number of inputs is determined by the system, but not always. You are always free to define more inputs as needed to create any output you like. A good example would be piping an input signal directly to an output even though that input signal is not needed in the state equations. This might seem a strange thing to do at first, but sometimes it is convenient to do this.

Basically, we have total freedom to be creative here. The B, C and D matrices allow any number of input signals and any number of output signals. It's just a matter of defining those inputs and outputs and putting some numbers in for the matrix elements.

Let's give a simple example.

d x1/dt=x1+x2 +u
d x2/dt=x2+2u

Here, A=[1 1; 0 1], B=[1; 2]

Now, lets decide to use the states directly as outputs. This means that C=[1 0; 0 1] and D=[0;0].

This is a very typical situation.

However, nothing in the state space equations prevent me from doing the following.

Here, A=[1 1; 0 1], B=[1 0; 2 0], C=[1 0; 0 1; 0 0] and D=[0 0; 0 0; 0 1]

All I've done here is defined a new input signal and then directed it to be an output signal.

Also, nothing in the state space equations prevent me from doing the following.

Here, A=[1 1; 0 1], B=[1 0 0; 2 0 0], C=[1 0; 0 1; 0 0] and D=[0 0 0; 0 0 0; 0 1 1]

All I've done here is define two new inputs and created one output which is the sum of these two new inputs.

Note that in defining these matrices, I'm using Matlab syntax where the semicolon (; ) is used to separate the rows in the matrix.
 
Thank you.

I hope I'm not missing the answer somewhere in the last post but what do you say about this query? Kindly let me know. Thanks.

Regards
PG
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top