Clear Filters
Clear Filters

How to create a state space model with constant term and do feedback.

63 views (last 30 days)
I have the discrete time system -
x(k+1) = [A]*x(k) + [B]*u(k) + c
y(k) = [C]*x(k)
I have read online that I can merge the constant term into B by doing [B 1] * [u1(k) ; u2(k)] with u2(k) = c ( I have no control over this input). ie the system becomes
x(k+1) = [A]*x(k) + [B 1]*[u1(k) ; c]
y(k) = [C]*x(k).
However, when I do state feed back, how can I ensure that u2(k) = c?
  3 Comments
Marcus
Marcus on 15 Oct 2024 at 19:44
See my recent response to Aquatris. Just represent closed loop dyanamics with ss(A-B*K,B*G,C,D,Ts) due to the control law u_k = G*r_k - K*x_k.
Sam Chak
Sam Chak on 16 Oct 2024 at 5:05
You appear to have used the continuous-time linear system to place the discrete-time closed-loop pole inside the unit circle (stable region of discrete-time linear system), which is considered incorrect.

Sign in to comment.

Accepted Answer

Marcus
Marcus on 18 Oct 2024 at 21:28
The solution that I found to work for my system is by representing
as the follwing uncontrollable system
with initial conditions .
State feedback and steady state tracking involve placing the poles of A and B of the origianl system and not the poles of the uncontrollable system.
ie the close loop system is -
Acl = [A-B*K eye(size(A));
0 eye(size(A))]
Bcl = [B;0]
C = [C,eye(size(A))]
Dcl = 0
sys_cl = ss(Acl,Bcl,Ccl,Dcl)

More Answers (1)

Aquatris
Aquatris on 15 Oct 2024 at 7:50
You can define which inputs and outputs are connected to your controller. Checkout the feedback function page and look at the 'Specify Input and Output Connections in a Feedback Loop' section.
First try it yourself to figure it out, cause it is a nice exercise to understand documentation and how to search for things. If you get stuck while doing it, provide what you have done and we can guide you.
  3 Comments
Aquatris
Aquatris on 15 Oct 2024 at 9:43
Edited: Aquatris on 15 Oct 2024 at 9:56
It is a general representation. State feedback essentially means your observation matrix C is identity matrix with a size of nxn where n is the number of states.
So in addition to your actual output, you can create another output for your feedback controller that would have the state information, something like:
Then you need to connect the y_states as an input to your feedback controller and connect u1 to the output of your feedback controller
Marcus
Marcus on 15 Oct 2024 at 19:42
Edited: Marcus on 15 Oct 2024 at 21:57
I seem to still be having trouble. This is what I've done so far.
A = [0.999979515574799];
B = [0.00001070633417008353561593759356585 1];
C = [1; 1];
D = [0];
c = 0.0046089956808409359920175596414538;
Ts = 1;
sys1 = ss(A,B,C,D,Ts)
sys1 has 2 inputs / 2 outputs / 1 state
I want to use the following control law where for steady state tracking and K is my gains matrix.
K = place(A,B,0.5);
G = inv(C*inv(1-(A-B*K))*B);
I am not sure how to represent this controller in state space form. I want to connect y_states to u1 with feedback(sys1, sys2, [1], [2], -1]), but I am not sure how to formulate sys2. How should I do this?
Typically, if c=0, I would use ss(A-B*K,B*G,C,D) to represend my closed loop dynamics, but this already incoroprates feedback.
Also, nowhere have I specified that u2 = c, is this done by setting my reference input to c (ie r2_k = c)?
Edit: Seems that G does not exist since a left inverse doenst exist. Anyway how would this be done with u = r - Kx?
Thanks

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!