hinfsyn() function in MATLAB keeps throwing a 0 for the controller
Show older comments
As an exercise, I've designed a simple spring mass damper system and implemented the hinfsyn () function on it. For instance, this is what I'm using:
m = 1; % 1 kg
b = 12; % 12 N-s/m
k = 20; % 20 N/m
s = tf('s');
G = 1/(m*s^2 + b*s + k) % system transfer function
W1 = 1/(s+1); % LPF weighting function
Gnom = [0 1; -W1 -G]; % plant transfer function
P = ss(Gnom); % plant state space model
nmeas = 1; % no. of output measurements
ncont = 1; % no. of controls
[K,CL,gamma] = hinfsyn(P,nmeas,ncont); % applying the hinfsyn function
[numK, denK] = ss2tf(K.A, K.B, K.C, K.D); %retrieving the transfer function of the controller
Ktf = tf(numK, denK);
While this is one way of doing it, I came across this and this which say that the state space models returned using these functions are slightly different for a MIMO system. Accordingly, I have also tried independently calculating the state space model of every element of Gnom using the tf2ss() function, then forming the Plant state space model from that. I then pass that Plant model to the hinfsyn() function.
After reading up a bit, I have used another method described here for a MIMO system as well to retrieve the transfer function of my controller K. Here is the code for that:
% retrieving tranfer function of controller
for i = 1:ncont
for j = 1:nmeas
[numk, denk] = ss2tf(K(i, j).A, K(i,j).B, K(i,j).C, K(i,j).D);
Ktf(i, j) = tf(numk, denk);
end
end
% displaying the controller transfer function
disp('size of Ktf is');
disp(size(Ktf));
numK = get(Ktf,'Numerator');
denK = get(Ktf, 'Denominator');
disp('num of Ktf is');
disp(numK{1}); % display the numerator of controller transfer function
disp('den of Ktf is');
disp(denK{1}); % display the denominator of controller transfer function
However, using both these methods still return me a controller whose numerator is 0 as follows:
size of Ktf is
2 2
num of Ktf is
0 0 0 0
den of Ktf is
1.0000 13.0000 32.0000 20.0000
I'm sure there is an error somewhere as this can't be right. Could someone point out any mistakes I'm making. Also do help me out in making the code efficient in any way you think. Thank you.
Here is the control loop diagram of the system I'm trying to implement for your reference as well. Here the Delta block denotes the uncertainties which should be accounted for by the hinfsyn function.

Answers (0)
Categories
Find more on H-Infinity Synthesis 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!