solving state variable equation in matlab

조회 수: 36 (최근 30일)
tomer polsky
tomer polsky 2017년 10월 22일
답변: Star Strider 2017년 10월 25일
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 ?

답변 (4개)

M
M 2017년 10월 22일
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 2017년 10월 22일
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 2017년 10월 24일

Star Strider
Star Strider 2017년 10월 25일
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.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by