design error of closed loop linear quadratic gaussian(LQG) regulator
Show older comments
%% defining LSSM
A=[ 0.6348 0.2593 0.4600
0.5413 0.4619 -2.1551
0.3717 -0.2875 -0.2284];
B=[-0.000373884261537862
-0.000282628577356680
6.75556005562987e-06];
C=[0.775419018631805 -0.351536834549575 -2.22055248727544
-1.06763937573713 1.60044239999917 2.15337710223348
-0.0104624868533414 -0.872193358462870 1.95243821622811
0.169459415037054 -2.05534089971536 3.53024245136833];
D=[0
0
0
0];
[k n]=size(C); %dimension index
Qw=C*C';
r_w=[1];
Rw=diag(r_w);
w=wgn(n,1,0);
v=wgn(k,1,0);
Q=w'*w; %
R=v'*v; %
% N=w*v';
% E|[ w [w.' v.']|=|Q N|
% | v] | |N.' R|
SYS=ss(A,B,C,D);
[K,~]=lqry(SYS,Qw,Rw); % u = -Kx minimizes J(u) % [A,B] controllable
%lqry is the Create a linear-second-order (LQ)
%state-feedback regulator with output weighting using [A,B,C,D]
%Design of Kalman estimator
[Kest,L,~]=kalman(SYS,Q,R); % [A,C] observable
% Form LQG regulator = LQ gain + Kalman filter.
F=lqgreg(Kest,K);
%Closed loop
cl_sys=feedback(SYS,F); %error point
With a given LSSM condition [A,B,C,D]
I want to implement a closed loop with feedback by designing an LQG regulator.
LSSM is a data driven IO model that satisfies both controllability and observability.
An error occurs because the dimensions of SYS and F in the last code do not match.
Could you please explain what problem in control theory is causing this issue and how to fix the code?
1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on State-Space Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!