lsim closed controlled loop confusion

14 views (last 30 days)
Hey, I am a bit confused regarding lsim inputs. I wish to simulate a closed loop feedback full state controller
I am using 'space state' dynamic representation
and calculated K value to ensure Controllability
basically:
x'=Ax+Bu , y=Cx
u=-Kx
when defining the ss model:
sys_cl = ss(A-B*K,B,C,0);
but for the lsim function I need to define an already known input vector u to satisfy:
lsim(sys_cl,u,t,x0);
So on one hand I wish "u" to be defined as -Kx (adjust itself depending on the output).
on the other hand - I define a pre-known u value for the simulation
what am I missing...?

Accepted Answer

Robert U
Robert U on 9 Jul 2018
Hi Daniel Grebler,
In order to simulate the time response of your controlled system you need to define the system ( sys_cl), a time grid ( t ), and a target value ( u ). You define an initial state of your system by supplying ( x0 ).
See first example in Matlab documentation:
Kind regards,
Robert
  2 Comments
Daniel Grebler
Daniel Grebler on 9 Jul 2018
Thank you Robert I see in the documentation that (u) is defined as the input signal and not the target value- meaning the response of the system to input u.
and not as the desired value (x) will be controlled into
Robert U
Robert U on 10 Jul 2018
Edited: Robert U on 10 Jul 2018
Hi Daniel Grebler,
Documentation is stating that ( u ) is an input of function lsim() and input of your system. Depending on the system you simulate it might be an input of dimension n >= 1 . Depending on the system model it can be any sort of input of your system.
You wrote you would like to simulate the closed-loop system response of your control system. Without having any details of the scope of your simulation I assumed, that you would like to see how system response is estimated on certain target values. Thus, your system should be described in a way that target value becomes the input of your system.
For other scopes it might be the system response on noise in your sensor path.
Kind regards,
Robert

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!