Use of state space equations to model a dynamic system

In summary, the conversation is about creating a correct state space model for a circuit using MATLAB. The first model successfully simulates the circuit, while the second model, which attempts to model the circuit from its state space equation, does not. The conversation includes discussions about using state space equations, integrators, and initial conditions. After some trial and error, the speaker is able to create a state space model that gives the same output as the integro-differential model. They thank the other person for their help and plan to continue working with state space models in the future.
  • #1
Cyclops
14
0
Hello,

I enclose a jpeg of the circuit and two simulink jpeg files. The first mdl file - First Test circuit sucessfully models the circuit. The second one where I attempt to model the circuit from its state space equation does not. Can anyone help me to create a correct state space model.

I can only upload jpegs so the mdl file diagrams have been saved as jpegs.

I am aware that MATLAB has a block for state space equations.

Kind regards,

Cyclops
 

Attachments

  • Circuit.JPG
    Circuit.JPG
    6.4 KB · Views: 389
  • First Test Circuit.JPG
    First Test Circuit.JPG
    9.2 KB · Views: 470
  • First Test Circuit State Space.JPG
    First Test Circuit State Space.JPG
    12.8 KB · Views: 465
Physics news on Phys.org
  • #2
The second one is already in a state space form. What do you mean by remodeling from State space again?
 
  • #3
Dear Trambolin,

I am trying to obtain the circuit circuit by both methods. The two outcomes should be the same in MATLAB and they are not. The state variable for circuit current is x1 in my working out shown in PDF.
I enclose a zip file with two simulink files and a pdf which shows my working out.

Kind regards,

Kieran A. Murray
 

Attachments

  • QuestiontoPhysicsForum.pdf
    341.8 KB · Views: 228
  • Simulink files.zip
    11.1 KB · Views: 153
  • #4
cyclops,

I tried to understand what you try to ask but it doesn't makes sense to me. I would start from your integro-differential equation and define my states as [tex]\int{i(t)dt} = x_1(t), i(t) = x_2(t)[/tex]

Then the rest is basically the same, I have to say that state space representation is nothing but a first order ODE version of the very same equations. I mean,

[itex]
\begin{align*}
\dot x_1(t) & = x_2(t)\\
\dot x_2(t) & = \frac{1}{L}\left( \frac{-1}{C}x_1(t) - Rx_2(t) + V_s\right)
\end{align*}
[/itex]

If you convert them to matrix notation,

[itex]
\begin{pmatrix}\dot x_1\\\dot x_2\end{pmatrix} =
\begin{bmatrix}0 &1\\-\frac{1}{LC} &-\frac{R}{L}\end{bmatrix}
\begin{pmatrix}x_1\\x_2\end{pmatrix}+
\begin{bmatrix}0 \\\frac{1}{L}\end{bmatrix}V_s
[/itex]

Then if you want to observe the current which is our second state you define your output matrix as

[itex]y = \begin{bmatrix}0 &1\end{bmatrix}\begin{pmatrix}x_1\\x_2\end{pmatrix}[/itex]
 
  • #5
Dear trambolin,

How do you implement the observation of the current in Matlab using integrators for the state space equation. The result should be the same as for the first circuit First circuit.mdl which observes the current by solving directly from the integro-differential equation. When I tried to implement this in my state space solver the solution was NOT the same. Running both simulations should give the same result as viewed in the Scope. It does not.
 
  • #6
Yes but I wish I could understand what you did in the second case. I don't understand what you mean as a state space method. What I did is also state space method. Why don't you like it?

Can you type it at least to reduce the handwriting confusion? Also the initial conditions of the integrators was not the same...
 
  • #7
Dear trambolin,

Using your equations, the state variable x2 is the inductor current in the circuit. I am trying to use integrators to solve the first order differential equation represented by the bottom line of your state space equation. This does not seem to work as it gives a different result to the second order differential equation that is obtained for the inductor current if we start from an integro-differential equation. The equations are correct. My implementation in MATLAB using integrators to solve the equation for the inductor current using the state space method must be wrong as it gives a different answer to the integrator solution based on the integro-differential equations which I got from a book. I will send workings later on a pdf.

Kind regards,

Kieran A. Murray
 
  • #8
Dear Trambolin,

I have shown all my workings for the equations on a document herein inclosed. Your state space equations create two first order equations from a second order equation. Using the state variables as inductor current and capacitor voltage should also be correct because as far as I understand the basis of this technique is to describe the energy of a system and you will need capacitor voltage and inductor current to do this. I have shown the outputs from MATLAB and they are different for the same thing - circuit current.

Kind regards,

Cyclops
 

Attachments

  • Workings for solving current in a circuit.doc
    96.5 KB · Views: 228
  • #9
Dear Trambolin,

After a couple of hours work this weekend and another go at it this morning I have come up with some sort of MATLAB state space model which will give the same output as the MATLAB integro-differential model. Thanks for your help as it always helps to have someone to work off and you confirmed that I was not completely on the wrong track. Having said that, there was a basic error in my equations as in the integro-differential part I divided across by the differentiator operation and for the step function I came out with 1 which of course is wrong. I include the two diagrams of the MATLAB files and I will update my workings later if anyone is interested. I intend to give this state-space thing a bit of a bash and so I might have more queries in future. Thanks for your help

The output from both models is the capacitor voltage. The zip file contains both models.

Kind regards,

Cyclops
 

Attachments

  • State-space model_Updated.zip
    17.8 KB · Views: 186

1. How do state space equations help in modeling dynamic systems?

State space equations are a mathematical tool that allows us to represent a dynamic system in terms of its state variables, input variables, and output variables. By using these equations, we can analyze the behavior of the system over time and make predictions about its future state.

2. What are state variables in a state space equation?

State variables are the minimum set of variables that are required to describe the current state of a dynamic system. They include physical quantities such as position, velocity, and acceleration, as well as other system-specific variables. These variables are typically represented by x1, x2, x3, etc. in the state space equation.

3. How are state space equations different from other mathematical models?

State space equations differ from other mathematical models, such as differential equations, in that they allow us to represent a system in terms of its state variables, rather than just its input and output variables. This makes them particularly useful for modeling complex systems with multiple inputs and outputs.

4. Can state space equations be used for both linear and nonlinear systems?

Yes, state space equations can be used to model both linear and nonlinear systems. However, the equations may be more complex for nonlinear systems, and special techniques such as linearization may be required to analyze their behavior.

5. Are there any limitations to using state space equations for modeling dynamic systems?

While state space equations are a powerful tool for modeling dynamic systems, they do have some limitations. They may not accurately capture all the complexities of a real-world system, and their accuracy may decrease over time due to errors in measurement or changes in the system. Additionally, they may not be suitable for systems with highly variable inputs or outputs.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • New Member Introductions
Replies
2
Views
68
  • Engineering and Comp Sci Homework Help
Replies
1
Views
832
  • Engineering and Comp Sci Homework Help
Replies
11
Views
1K
  • Advanced Physics Homework Help
Replies
12
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
3K
Replies
4
Views
948
  • Engineering and Comp Sci Homework Help
Replies
7
Views
935
Replies
4
Views
479
  • High Energy, Nuclear, Particle Physics
Replies
3
Views
1K
Back
Top