Azzera filtri
Azzera filtri

solving state variable equation in matlab

14 visualizzazioni (ultimi 30 giorni)
tomer polsky
tomer polsky il 22 Ott 2017
Risposto: Star Strider il 25 Ott 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 ?

Risposte (4)

M
M il 22 Ott 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 il 22 Ott 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 il 24 Ott 2017

Star Strider
Star Strider il 25 Ott 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.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by