Solve state space equation and initial conditions

Hello everybody.
I am trying to implement an adaptive filter identification system. The mass is variable so I have to calculate with Matlab (no Simulink) each transfer function for each mass. The problem is the continuity: I have all the state spaces but I can not solve de last "position" in order to introduce it as initial condition in the next state space.
I have state space equation like:
xdot=A.x+B.u(t) where u=sen(t)
y= C.x where C is [0 C2] so I can solve x2 because I know the value of the amplitude y(t).
The problem is that I can not solve x1, I dont know how to use ode45 for this.
The purpose is to use lsim(sys,u,t,x0) where x0=[x1 x2]
How could I resolve the value of x1 in the last position of my last state space?
A =
x1 x2
x1 -4 -12.5
x2 8 0
B =
u1
x1 4
x2 0
C =
x1 x2
y1 0 3.125
D =
u1
y1 0
As aspicted in the attached figure, the next state space starts in the correct position (last state space position) because I solved x2 but not with the proper velocity and acceleration because I didnt solve x1. The mass changes in each vertical line, the mass change point is marked with a circle

11 comentarios

Aquatris
Aquatris el 23 de Ag. de 2018
Is it not possible for you to change the C such that it gives you both x1 and x2?
No, I have already tried. It doesnt work. Changing the C changes the responses.I think that only works for first order.
Aquatris
Aquatris el 23 de Ag. de 2018
Editada: Aquatris el 23 de Ag. de 2018
Wrong. It works for any order. If changing the C matrix (adding another row) changes the response of your system (assuming you compare the same output channel), then you are doing something wrong.
Also are you combining 2 different simulation results together instead of running a single simulation?
What do you mean with "adding another row"?
M
M el 24 de Ag. de 2018
Editada: M el 24 de Ag. de 2018
Adding another row in the matrix C such that you get both x1 and x2, something like:
C=[0 3.125;
1 0];
This should not change the first output, but it will add a second one, corresponding to the evolution of x1.
And how could I solve this equation? y= [0 1;3.125 0][x1 x2]
Aquatris
Aquatris el 27 de Ag. de 2018
You use the same method as the one you use when C only had 1 row. Why are you confused?
And how could I solve this equation? y= [0 1;3.125 0][x1 x2]
Because in the firt example I only have to solve the equation and the result is a value. If i add a row to [C] the solution would be a differential equation.
Aquatris
Aquatris el 29 de Ag. de 2018
First, the thing you solve with ode is xd = Ax+Bu, which is the differential equation part of state space. The part y = Cx is not a differential equation. It is a simple linear equation. The only purpose of y = Cx is to extract the output value using the states. I recommend you review state space again.
But the initial condiction x0, x1 express the velocity and the position. That is why i am confusse about to extrat from y=Cx. What parameter should I uso in y to extract x1?
Aquatris
Aquatris el 29 de Ag. de 2018
That depends on your system. How did you find the "3.125" number in your C matrix to get the position? You will use the same method to get C value for velocity.

Iniciar sesión para comentar.

Respuestas (1)

Akshay Khadse
Akshay Khadse el 29 de Ag. de 2018
For using “ode45”, you will need to create a MATLAB function independent of “u” by substituting “sin(t)” in its place. Then, the “ode45” could be used as
[t,x] = ode45(@functionName,tspan,y0);
where “tspan = [t0 tf]” is the vector with start and end time of the solution and “y0” is the initial condition vector
Examples regarding these can be viewed in documentation of ode45 .

Preguntada:

el 20 de Ag. de 2018

Comentada:

el 29 de Ag. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by