# Designing an Observer - Control System

14 views (last 30 days)
Yasmine Sellwood on 27 May 2022
Answered: Paul on 27 May 2022
Hi,
I am trying to design an observer for my feedback control system. I am getting the below error message, although my system is controllable:
Error using place (line 171)
The "place" command could not place the poles at the
specified locations. Probable causes include:
* (A,B) is nearly uncontrollable
* The specified locations are too close to each other.
Error in n9989480_Assignment_2 (line 95)
L = place(Aa', Ca', Obs_pa)';
Warning: Achieved pole locations differ by more than 10
percent from specified locations.
For reference, here is my code:
%% Define State Space Matrices
% Linearised model about equilibrium A
Aa = [-0.00643 0.0263 0 -32.2 0;
-0.0941 -0.624 830 0 0;
-0.000222 -0.00153 -0.668 0 0;
0 0 1 0 0;
0 -1 0 830 0];
Ba = [0;
-32.7;
-2.08;
0;
0];
Ca = [0 0 0 0 1]; % Position of the aircraft
Da = 0;
sys = ss(Aa,Ba,Ca,Da); % State Space Model
equilibrium_A = [0 0 0 0 0]'; % Equilibrium Point A
init_cont = [0.2 20*pi/180 0 0 0]'; %Initial condition
%% Check controllability of the linearised system
Control = ctrb(Aa,Ba);
rank_control = rank(Control)
uncont = length(Aa) - rank(Control);
if rank_control ~= length(Ba)
error('System is not controllable.')
else
fprintf('System is controllable\n')
end
%% Check observability of the linearised system
Observable = obsv(Aa,Ca);
rank_observe = rank(Observable)
unobs = length(Aa)-rank(Observable);
if rank_observe ~= length(Ca)
error('System is not observable.')
else
fprintf('System is observable\n')
end
%% Controller Design from Linear Quadratic Regulation
% Assume the reference is zero
pa = 50; %weighting factor
Qa = pa*Ca'*Ca; %state-cost matrix
Ra = 1; %control weighted matrix
[Ka] = lqr(Aa,Ba,Qa,Ra)
closed_loop = ss(Aa-Ba*Ka, Ba, Ca, Da);
step(0.2*closed_loop)
title('Closed-Loop Step Response');
%% Oberserver Design
% Desired Closed-Loop Poles
Obs_pa = [-100 -120 -140 -160 -180];
L = place(Aa', Ca', Obs_pa)';
Can someone please explain to me where I am going wrong in my code?
Thank you

Sam Chak on 27 May 2022
It's a 5th-order system and by choosing relatively large poles (almost 10,000 times), the computation becomes numerically sensitive and resulting in very very very large observer gains.
No issue with these poles:
Obs_pa = [-1 -1.2 -1.4 -1.6 -1.8];
L = place(Aa', Ca', Obs_pa)'
eig(Aa - L*Ca)

Paul on 27 May 2022
I don't think you're going wrong anywhere (though you might want use size(Aa,1) instead of length(Ca) in a few places). I think the issue is just that the desired observer pole locations are so far out in the LHP they are very difficult for place() to achieve. If those observer pole lociations are absolutely required, they might be very difficult to achieve in double precision.

R2020a

### Community Treasure Hunt

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

Start Hunting!