State space controllers - find equations from differentials

In summary: So, without further ado, here is the state space equation for the nonlinear system:$$Z_s=\frac{CX_s+DU_s}{s}$$
  • #1
Maniac_XOX
86
5
Homework Statement
Non-linear DE to state space
Relevant Equations
$$$$
Summary:: This is similar to the examples of electrical circuit state space analysis, I have been trying to find the state space equations from the following non linear first order differentials but I keep getting stuck. Any help?

A) Started off from non linear equations:
$$y' = \frac{\frac{40}{11}x - \frac{4}{11} xy + \frac{250}{2299}}{z}$$
$$z′=\frac{4}{11}u−\frac{3}{110}\sqrt{z}$$

B) Taylor series (although I've read that state space can be applied to non-linear systems, an advantage to PID, so do I really need to?)

\begin{align}y′\approx −\frac{80}{11}y+0.10874z+9.33884 \\
z′\approx −0.061z+0.3636u+0.0549 \end{align}

C) How to represent this system in state space form?
where:
\begin{align}
x' = Ax + Bu \\
y = Cx + Du
\end{align}
I have tried reversing the process in example 2, page 7 of http://web.mit.edu/2.14/www/Handouts/StateSpace.pdf where the author finds the differentials from the state equations.

Laplace transform of the linear differential z'
##z′=−az+bx−c## turns into $$Z_s=\frac{sbX_s−c}{s(s+a)}$$
Solved that for Zs, giving the output equation for state space.

Now i have: $$
Z_s=\frac{CX_s+DU_s}{s}=\frac{sbU_s−c}{s(s+a)}$$

To avoid confusion i have changed the input x from previous steps to U to keep the state space equation on the LHS conventional.
Is this a reasonable approach?
 
Last edited:
Physics news on Phys.org
  • #2
Maniac_XOX said:
although I've read that state space can be applied to non-linear systems, an advantage to PID, so do I really need to?
We can't really know what you need or want to do with this analysis. Non-linear dynamic systems are extremely complex with several different tools available, none of which always work. If you really need to solve the non-linear systems, I would suggest sticking with the DEs, since they are sort of separate, as we discussed previously. However, the one lesson I came away with in my year long graduate non-linear controls class (like, 30 years ago!) is that I don't really know how to do these in any general sense. Yes there are tools, like stability analysis, but real solutions are often difficult.

The reason people choose to linearize the system is to take advantage of the much easier and more powerful analysis tools that are enabled by the properties of linearity. OTOH, it's just a local approximation, so then you are left dealing with the question of "how local?", i.e. is the approximation any good (over what range?), and what does "good" mean?
 
Last edited:
  • Like
Likes Maniac_XOX and berkeman
  • #3
Maniac_XOX said:
Homework Statement:: Non-linear DE to state space
Relevant Equations:: $$$$

Summary:: This is similar to the examples of electrical circuit state space analysis, I have been trying to find the state space equations from the following non linear first order differentials but I keep getting stuck. Any help?

A) Started off from non linear equations:
$$y' = \frac{\frac{40}{11}x - \frac{4}{11} xy + \frac{250}{2299}}{z}$$
$$z′=\frac{4}{11}u−\frac{3}{110}\sqrt{z}$$

B) Taylor series (although I've read that state space can be applied to non-linear systems, an advantage to PID, so do I really need to?)

\begin{align}y′\approx −\frac{80}{11}y+0.10874z+9.33884 \\
z′\approx −0.061z+0.3636u+0.0549 \end{align}

C) How to represent this system in state space form?
where:
\begin{align}
x' = Ax + Bu \\
y = Cx + Du
\end{align}
I have tried reversing the process in example 2, page 7 of http://web.mit.edu/2.14/www/Handouts/StateSpace.pdf where the author finds the differentials from the state equations.

Laplace transform of the linear differential z'
##z′=−az+bx−c## turns into $$Z_s=\frac{sbX_s−c}{s(s+a)}$$
Solved that for Zs, giving the output equation for state space.

Now i have: $$
Z_s=\frac{CX_s+DU_s}{s}=\frac{sbU_s−c}{s(s+a)}$$

To avoid confusion i have changed the input x from previous steps to U to keep the state space equation on the LHS conventional.
Is this a reasonable approach?
OK, so what are your inputs outputs and state variables? You'll need to identify each and match them up in a vector notation with the SS canonical form, here the state vector is x, the input vector is u, and the output vector is y. Note that scalars are just 1-dimensional vectors in this notation. The dimensions of each matrix (A, B, C, D) will be determined by how many of each of the x, y, and u's you have (this is necessary to make the multiplications work). Then you just match up the coefficients in your DEs with the matrix elements. Hint: look at equations (3), (4), (7), & (8) in that MIT pdf.

Also, a note about the constant terms in your DE's. These are usually ignored in modern controls texts because it's an input that never changes, or the response to an initial transient, if you prefer. Much of modern controls is interested in system stability and the response to changing conditions (inputs). So they are usually left out. It's not that it doesn't matter, it might depending on what problem you are solving. But they will cause a transient response that will die out (hopefully), or at least will always be the same. The linearity (superposition) means that these responses can be separated and adding in later if you care to. If you do want to include them, you'll make another input variable = 1 with those coefficients.
 
Last edited:
  • #4
DaveE said:
OK, so what are your inputs outputs and state variables? You'll need to identify each and match them up in a vector notation with the SS canonical form, here the state vector is x, the input vector is u, and the output vector is y. Note that scalars are just 1-dimensional vectors in this notation. The dimensions of each matrix (A, B, C, D) will be determined by how many of each of the x, y, and u's you have (this is necessary to make the multiplications work). Then you just match up the coefficients in your DEs with the matrix elements. Hint: look at equations (3), (4), (7), & (8) in that MIT pdf.

Also, a note about the constant terms in your DE's. These are usually ignored in modern controls texts because it's an input that never changes, or the response to an initial transient, if you prefer. Much of modern controls is interested in system stability and the response to changing conditions (inputs). So they are usually left out. It's not that it doesn't matter, it might depending on what problem you are solving. But they will cause a transient response that will die out (hopefully), or at least will always be the same. The linearity (superposition) means that these responses can be separated and adding in later if you care to. If you do want to include them, you'll make another input variable = 1 with those coefficients.
So i am aware that the outputs must be H' and T' therefore I believe the output equation in SS form to be
$$ output, y = \begin{bmatrix} Z' \\Y' \end{bmatrix} = \begin{bmatrix}
-0.061 & 0\\
0.10874 & -\frac{80}{11} \end{bmatrix}\begin{bmatrix} Z \\ Y\end{bmatrix}
+
\begin{bmatrix}
0.3636\\
0
\end{bmatrix} U $$
$$ x' = ?x + ?u $$
The state variable in the SS equation is x, i am unsure how I get this or if I am supposed to continue where i left off in the question?
 
Last edited:
  • #5
Please don't change your variable names yet again. Let's just do the math part. You can figure out whether H is the same as z or not yourself, I don't want to have to do that. Just pick a set, tell us what role they play, and stick with it.
 
  • #6
DaveE said:
Please don't change your variable names yet again. Let's just do the math part. You can figure out whether H is the same as z or not yourself, I don't want to have to do that. Just pick a set, tell us what role they play, and stick with it.
sorry Lol everytime i work on the notebook i keep converting them to the variables in my problem, I'll change them now, problem is i have set T as y so there can be confusion. I will set y in SS equation as output from now
 
  • #7
x is the state vector. Each element of the state vector is one of your state variables.
 
  • #8
DaveE said:
x is the state vector. Each element of the state vector is one of your state variables.
Yes i am trying to find the state vector equation. How do I get the A and B matrices? does the output vector look okay?
 
  • #9
WHAT ARE YOUR STATE VARIABLES?

Time to reread the first section of that MIT pdf, the notation is all clearly defined there, I don't think I can do it any better. Note that the matrix representation is just a difference in notation, a more general formulation. It contains your DE's, nothing more. You get the matrix elements by matching up the canonical form with the terms in your DE's, that is all.
 
  • #10
DaveE said:
WHAT ARE YOUR STATE VARIABLES?

Time to reread the first section of that MIT pdf, the notation is all clearly defined there, I don't think I can do it any better. Note that the matrix representation is just a difference in notation, a more general formulation. It contains your DE's, nothing more. You get the matrix elements by matching up the canonical form with the terms in your DE's, that is all.
I believe my state variables to be H and T?
I have also read this
1650230075690.png

so does that mean i could make a pair of output equations and state vectors for each differential individually and model it in parallel on simulink?
 
  • #11
Maniac_XOX said:
so does that mean i could make a pair of output equations and state vectors for each differential individually and model it in parallel on simulink?
Probably, IDK. If that is a good physical description of your system, and if you can enter that in the simulator, then yes. I haven't used simulink (in any recent incarnation), but a simulator that can't do that would be unusual.

However, that wasn't really your question in this thread was it? Please don't keep switching methods, questions, and descriptions. That will not only confuse me, it will also confuse you. I'm not very willing to solve your problems for you, but if you ask a question that isn't too hard for me to follow and that I think I can help with, I might answer.

Again, the state space description of LTI systems is really just a set of differential equations. It is only a different, more generalized, nomenclature which is well described in the pdf I showed you. That is all.
 
  • #12
DaveE said:
Probably, IDK. If that is a good physical description of your system, and if you can enter that in the simulator, then yes. I haven't used simulink (in any recent incarnation), but a simulator that can't do that would be unusual.

However, that wasn't really your question in this thread was it? Please don't keep switching methods, questions, and descriptions. That will not only confuse me, it will also confuse you. I'm not very willing to solve your problems for you, but if you ask a question that isn't too hard for me to follow and that I think I can help with, I might answer.

Again, the state space description of LTI systems is really just a set of differential equations. It is only a different, more generalized, nomenclature which is well described in the pdf I showed you. That is all.
I never asked to solve problems for me in fact i have been happy to do all the tedious mathematical work, even with the 'general' information you give me, which I still appreciate.
I have viewed the pdf multiple times and have even gone through the example on there before attempting it on my assignment, but you haven't confirmed whether I answered your question right on the state variables. Nor commented on the method i was using from the same PDF you sent to let me know if I was on the right track, so what help is it to keep defining a state space system all over again and to simply refer back to the pdf? The pdf isn't interactive and won't help me if I get stuck, that's why i came here

I wanted to consult you on the source that I took from Mathworks because i felt it could make the method simpler for me, i appreciate your attempt in answering that

I decided to give that method a shot before the deadline and it seems like it's working as both SS models appear to be stable on Matlab, which is a good sign. Thank you for the help you provided so far, although I wish more people had participated to give more advice, best regards
 
  • #13
Maniac_XOX said:
you haven't confirmed whether I answered your question right on the state variables.
No, I didn't. That's because I'm too lazy to go back through several different posts in different threads to find your DEs with those variables. If you show me the DEs that your using now and identify the state variables, I'll let you know. However, once you have the DEs in form you started this thread with, it's pretty obvious. The state variables are the ones defined by their derivatives.

Maniac_XOX said:
I wanted to consult you on the source that I took from Mathworks because i felt it could make the method simpler for me, i appreciate your attempt in answering that
I don't know what to say about that example. It looks good to me. It does not look like a different method though, just a different example.

I keep referring you back to the textbook because it seems your problem is in not understanding the nomenclature of the matrix representation. Which strikes me as really well described there. I was reluctant to write all that out myself and have it come out looking the same. But I guess you'll need to see it for your specific example:

Given
## y' \approx -7.2727y + 0.1087z + 0.93388 ##
## z' \approx -0.061z + 0.3636u + 0.0549 ##

Then the state variables must be ##y## and ##z##, the input is ##u##, and we'll assume the output is ##y## (you never defined that explicitly).

So, we can rewrite this in the matrix form:
$$
\frac{d}{dt} \begin{pmatrix} y \\ z \end{pmatrix} =
\begin{pmatrix} -7.2727 & 0.1087 \\ 0 & -0.061 \end{pmatrix}
\begin{pmatrix} y \\ z \end{pmatrix} +
\begin{pmatrix} 0 \\ 0.3636 \end{pmatrix} u +
\begin{pmatrix} 0.93388 \\ 0.0549 \end{pmatrix}
$$
$$
y = \begin{pmatrix} 1 & 0 \\ \end{pmatrix}
\begin{pmatrix} y \\ z \end{pmatrix}
$$
Or, we can define an input vector ## \mathbf v = \begin{pmatrix} u \\ 1 \end{pmatrix}## and get:
$$
\frac{d}{dt} \begin{pmatrix} y \\ z \end{pmatrix} =
\begin{pmatrix} -7.2727 & 0.1087 \\ 0 & -0.061 \end{pmatrix}
\begin{pmatrix} y \\ z \end{pmatrix} +
\begin{pmatrix} 0 & 0.93388 \\ 0.3636 & 0.0549 \end{pmatrix} \begin{pmatrix} u \\ 1 \end{pmatrix}
$$
Then we can identify
## \mathbf x = \begin{pmatrix} y \\ z \end{pmatrix}## the state vector.

## \mathbf A \equiv \begin{pmatrix} a_{1,1} & a_{1,2} \\ a_{2,1} & a_{2,2} \end{pmatrix} = \begin{pmatrix} -7.2727 & 0.1087 \\ 0 & -0.061 \end{pmatrix} ##

## \mathbf b = \begin{pmatrix} 0 \\ 0.3636 \end{pmatrix}## and ## \mathbf v = u ## or

## \mathbf B = \begin{pmatrix} 0 & 0.93388 \\ 0.3636 & 0.0549 \end{pmatrix}## and ## \mathbf v = \begin{pmatrix} u \\ 1 \end{pmatrix} ##depending on how you want to deal with the transient response.

## \mathbf C = \begin{pmatrix} 1 & 0 \\ \end{pmatrix}## and ##\mathbf D = 0##

We then get the canonical SS form:
$$ \mathbf x' = \mathbf A \mathbf x +\mathbf B \mathbf v $$
$$ \mathbf y = \mathbf C \mathbf x + \mathbf D \mathbf v $$

note the change of input vector from ## \mathbf u ## (the common definition) to ## \mathbf v ## to distinguish it from the scalar ##u## in your equations.

So, there it is, the same equations you determined written in a different manner. That is what the first section of that text described.
 
Last edited:
  • Like
Likes Maniac_XOX and berkeman

FAQ: State space controllers - find equations from differentials

What is a state space controller?

A state space controller is a mathematical model used in control engineering to represent the behavior of a dynamic system. It is a set of differential equations that describe the state variables of the system and their relationships over time.

How do you find equations from differentials in a state space controller?

To find equations from differentials in a state space controller, you need to use the state space representation method. This involves transforming the differential equations into a set of first-order differential equations, which can then be represented in matrix form.

What are the advantages of using a state space controller?

One advantage of using a state space controller is that it allows for the analysis and design of complex control systems. It also provides a more intuitive understanding of the system's behavior and allows for easy implementation of control algorithms.

Can a state space controller handle nonlinear systems?

Yes, a state space controller can handle nonlinear systems. The state space representation method can be used to represent nonlinear systems by using a nonlinear state equation and a nonlinear output equation.

How are state space controllers used in real-world applications?

State space controllers are used in a wide range of real-world applications, including aerospace, robotics, and industrial control systems. They are also commonly used in the design of feedback control systems for automobiles, aircraft, and other complex systems.

Similar threads

Replies
11
Views
2K
Replies
2
Views
2K
Replies
48
Views
4K
Replies
5
Views
2K
Replies
1
Views
1K
Replies
5
Views
2K
Back
Top