0% found this document useful (0 votes)
34 views6 pages

Exp 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

Exp 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

SYSTEM THEORY

Experiment 3
State feedback controller for the regulator problem

AIM : Using MATLAB, to design a state feedback controller for a regulator system
THEORY :

The linearised state equation of the dynamics of the pendulum on cart is given by

PROCEDURE :

i. In the ‘main’ script file, check for controllability as the first step. If the system is
controllable, proceed with the controller design. Use the acker () command of
MATLAB for the design of the controller, and initial() command to simulate the
response of the system without and with control, for comparison and study.
ii. Plot the graphs of the states vs. time (a) for the uncontrolled, (b) controlled system,
iii. graph of control input u = − Kx vs. time.

MATLAB CODE :

%%EXPERIMENT 3:
%%REGULATOR PROBLEM - INVERTED PENDULUM PROBLEM

clear all, clc, clf;

M = 2;
m = 0.1;
G = 10;
l = 0.5;

A = [0 1 0 0 ; ((M+m)/(m*l))*G 0 0 0; 0 0 0 1; -(m/M)*G 0 0 0];


B = [0; -1/(M*l); 0; 1/M];
C = [1 0 0 0];
D = 0;

t = 0:0.1:10;
x_0 = [0.1; 0; 0; 0];

%Step 1 : checking fo controllablilty

M_c = ctrb(A,B); %% ctrb() function for obtaining controllability matrix

if rank(M_c)<size(A,1)

disp('system is not controllable');


return;

elseif rank (M_c)==size(A,1)

disp('system is controllable');
end

system is controllable

%%Stability Check

%%Open loop pole locations (i.e. the eigen values of A)


eig_A = eig(A);

for k=1:length(eig_A)

if eig_A(k) > 0
check=1;
end
end

if check==1
disp('system is unstable')
end

system is unstable

%%Controller design - feedback gain value

%%closed loop pole location that have been chosen


P = [-5 -5 -1-sqrt(3)*i -1+sqrt(3)*i];
%obtaining the gain values usign the Ackermann method

K = acker(A,B,P);

A_cl = A-B*K; %%Closed loop A matrix


B_cl = [0;0;0;0];

sys = ss(A,B,C,D); %% Open loop state space model

sys_cl = ss(A_cl,B_cl,C,D); %%Closed loop state space model

[y t x] = initial(sys,x_0,t); %%Open loop response


[y_cl t x_cl] = initial(sys_cl,x_0,t); %%Closed loop response

%%Open loop plots


figure(1)
plot(t,x(:,1),t,x(:,2),t,x(:,3),t,x(:,4))
legend('\theta','\omega','displ.','speed');xlabel('t');
title('open loop system characteristics');grid on;

%%Closed loop plots


figure(2)
plot(t,x_cl(:,1),t,x_cl(:,2),t,x_cl(:,3),t,x_cl(:,4))
legend('\theta','\omega','displ.','speed');xlabel('t');
title('closed loop system characteristics');grid on;

%%Controller output plot


figure(3)
plot(t,-K*x_cl')
legend('u');xlabel('t');
title('feedback controller output');grid on;

disp('EOC');

EOC
CONSLUSION :

From the Open loop response graph we can infer that the system is highly unstable as it keeps on
increasing/decreasing unboundedly.

The Closed loop response shows the regulatory operation of the system which controls the system
to bring it to zero.

The feedback controller output shows how state feedback control takes place to bring the state to
zero.

You might also like