solving state variable equation in matlab

37 visualizaciones (últimos 30 días)
tomer polsky
tomer polsky el 22 de Oct. de 2017
Respondida: Star Strider el 25 de Oct. de 2017
hello i am trying this eqution :
dx/dt=A*x+B*u
y=C*x
while A is matrix 4X4,B is matrix 4X1,C is matrix 1X4,and u is constant , how do i find X ? if X should be matrix of 4X1 , and how do i draw graph of x ?

Respuestas (4)

M
M el 22 de Oct. de 2017
WHat do you want to do exactly ?
If you want to simulate your system with a given input, you can use specific function, such as step, impulse etc...
You can also solve your ODE system with the matlab ode45 solver.

tomer polsky
tomer polsky el 22 de Oct. de 2017
ye i tried to use ode system but i cant understand how to write it.could you write me example for second order code ?

M
M el 24 de Oct. de 2017

Star Strider
Star Strider el 25 de Oct. de 2017
Your integrated differential equation is the matrix exponential, given by the expm function (in both base MATLAB and the Symbolic Math Toolbox).
The integration of your system is:
dx/dt = A*x + B*u % Time-Domain Differential Equation
y = C*x
sX = A*X + B*U % Laplace Transformed System
Y = C*X
sX - A*X = B*U % Rearrange
Y = C*X
(s*I -A)*X = B*U % Combine Terms, ‘I’ Is The Identity (‘eye’) Matrix
Y = C*X
X = inv(s*I - A)*B*U % Solve For ‘X’ (Do Not Use ‘inv’), Illustration Only Here
Y = C*X
Y = C*(inv(s*I - A)*B*U) % Substitute
y(t) = C*expm(A*t)*B*u(t) % Inverse Laplace Transform To Get Solved Differential Equation
This is straightforward to calculate in a loop.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by