|
Hi,
I am working on a control design problem and for some reason
with the combination of using symbols and manipulating a
matrix , a problem arises as I show below in my code. I
discuss my problem further at the bottom. It might be
easier to copy and paste this code into notepad or wordpad
so it is more viewable.
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
% Part A
%
% Given a transfer function of the forward path of a
dynamic system, %
% apply the pole placement procedure to design a
state-variable %
% controller to satisfy the following specifications:
%
% Tset = 4sec, Overshoot = 15%, Ess caused by a unit step
disturbance <=%
% 0.01
%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%First we will specify the numerator and denominator of the
foward T.F.
syms s
num = sym2poly((s + 1)*(s + 2)*(s + 3));
den = [1 2 12 4 10];
%Put the TF in state space form for later use
A= [0 1 0 0; 0 0 1 0; 0 0 0 1; -10 -4 -12 -2];
B = [0;0;0;1];
C = [6 11 6 1];
D = [0];
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%Since the controlled plant does not have any right-hand
side zeros, other
%complexities are not introduced.
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%Having an overshoot of 15% means that zeta should be equal
to about 0.53
zeta = 0.53;
% We also need to satisfy Tset, so we will find our 'a',
%by using the following equation: a = 4/Tset = 4/4 = 1.
a1 = 1;
%Now we use the following formula to find our first two beta
values:
b1 = sqrtm(1-zeta^2)/zeta
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%Since we have a fourth order plant, we will need 2 more non
zero, non
%dominate poles. We will choose poles 2 and 3 as -4 +/- 1j
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%So our four roots are:
r1 = -a1 + j*b1;
r2 = -a1 - j*b1;
r3 = -4 + 10j;
r4 = -4 - 10j;
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
% Now with these roots, we can define the characteristic
polynomial of the
% closed-loop system, Acl = A-BF, as follows:
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
q = sym2poly((s+(-r1))*(s+(-r2))*(s+(-r3))*(s+(-r4)))
%Again using Acl = A-BF, we can now solve for the matrix F
which is the
%only unknown the equation
Acl = [0 1 0 0; 0 0 1 0; 0 0 0 1; -q(5) -q(4) -q(3) -q(2)];
F = transpose(B)*(A - Acl)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
% This allows us to obtain the transfer function of the
closed-loop system
% using the formula: Gcl = C(sI-A+BF)^-1(B)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
G_cl_temp = C*inv(s*eye(4) - A + B*F)*B
where....
>> (s*eye(4) - A + B*F)
ans =
[ s,
-1,
0, 0]
[ 0,
s,
-1, 0]
[ 0,
0,
s, -1]
[ 7264840089541673/17592186044416,
2291205308377831/8796093022208,
4769592979338611/35184372088832,
s+10]
>>
My problem is being formed before I even do the inversion in
G_cl_temp as:
G_cl_temp =
211106232532992/(35184372088832*s^4+351843720888320*s^3+4769592979338611*s^2+9164821233511324*s+14529680179083346)+387028092977152*s/(35184372088832*s^4+351843720888320*s^3+4769592979338611*s^2+9164821233511324*s+14529680179083346)+211106232532992*s^2/(35184372088832*s^4+351843720888320*s^3+4769592979338611*s^2+9164821233511324*s+14529680179083346)+35184372088832*s^3/(35184372088832*s^4+351843720888320*s^3+4769592979338611*s^2+9164821233511324*s+14529680179083346)
>>
I have tried changing the format to short, rat, compact and
some of
the others but it wont compute those fractions. If I
manually compute
the fraction, round them to a whole number and rebuild the
matrix
before inversion...my answer comes out nicer and nothing in the
numerator is above 11.
Also, I can't find a way to convert this G_cl_temp into an
actual
ratio of two polynomials without inspection since each
numerator is
separated with the same polynomial denominator. The
sym2poly command
will not work on G_cl_temp since it is in a summation format.
The reason for this is that I need to keep changing my
non-dominate
roots so that the steady sate response of a step disturbance
is below
a certain threshold.
Any suggestions on how to stop getting those huge fractions
in my matrix?
I appreciate any help. Thank you.
|