Undefined function 'dksyn' for input arguments of type 'ss'. Error in Report8 (line 41) [k, cl, bnd] = dksyn ( G, 1, 1)
3 views (last 30 days)
Show older comments
R1=2;R2=1;L1=2;L2=1;
C1= ureal('C1',1,'percent',20)
A=[-R1/L1 0 -1/L1 ; 0 -R2/L2 1/L2 ;1/C1 -1/C1 0]
B=[1/L1;0;0]
C=[0 R2 0 ]
D=[0]
P=ss(A,B,C,D)
s = tf('s');
Wt=(s)/((s)+2)
w1 = logspace(-10,3,100)
P_g = ufrd(P,w1)
Dm_g = (P_g - P_g.nominal)/P_g.nominal;
%% Gain plot
MS=2 ; WS=0.38
Ws=(((s)/MS)+WS)/(s+(WS*.007))
Weps = 5e-4;
figure(1);
w=logspace(-2,3,20);
bodemag(Ws,Wt,'--',w);grid on
legend('Ws','Wt');
figure(2);
w2=logspace(-10,3,100);
bodemag(Dm_g,'--',Wt,'r-',w2);grid on;
legend('\Deltam','Wt');
%% Building of generalized plant
Pn = P.nominal;
systemnames = 'Pn Ws Wt ';
inputvar = '[w1; w2; u]';
outputvar = '[Ws; Wt; Pn]';
input_to_Pn = '[w1 - u]';
input_to_Ws = '[w1 - u]';
input_to_Wt = '[ u ]';
G = sysic;
whos G
[k, cl, bnd] = dksyn ( G, 1, 1)
bnd
2 Comments
Walter Roberson
on 2 Jan 2024
I note that dksyn expects a uss (uncertain space state), but you are passing it a ss (space state)
Accepted Answer
Paul
on 2 Jan 2024
According to the doc page dksyn, the first input to the dksyn has to be a uss model, not an ss model. Mabye G should be built using P, not P.Nominal? That's just a guess.
Also, I don't know what release your're using, but, as of 2021b. sysic and dksyn are both not recommended.
R1=2;R2=1;L1=2;L2=1;
C1= ureal('C1',1,'percent',20);
A=[-R1/L1 0 -1/L1 ; 0 -R2/L2 1/L2 ;1/C1 -1/C1 0];
B=[1/L1;0;0];
C=[0 R2 0 ];
D=[0];
D = 0;
P=ss(A,B,C,D);
s = tf('s');
Wt=(s)/((s)+2);
w1 = logspace(-10,3,100);
P_g = ufrd(P,w1);
Dm_g = (P_g - P_g.nominal)/P_g.nominal;
%% Gain plot
MS=2 ; WS=0.38;
WS = 0.3800;
Ws=(((s)/MS)+WS)/(s+(WS*.007));
Weps = 5e-4;
figure(1);
w=logspace(-2,3,20);
bodemag(Ws,Wt,'--',w);grid on
legend('Ws','Wt');
figure(2);
w2=logspace(-10,3,100);
bodemag(Dm_g,'--',Wt,'r-',w2);grid on;
legend('\Deltam','Wt');
%% Building of generalized plant
Pn = P.nominal;
systemnames = 'Pn Ws Wt ';
inputvar = '[w1; w2; u]';
outputvar = '[Ws; Wt; Pn]';
input_to_Pn = '[w1 - u]';
input_to_Ws = '[w1 - u]';
input_to_Wt = '[ u ]';
G = sysic;
whos G P Pn
2 Comments
More Answers (1)
Sam Chak
on 3 Jan 2024
I'm unfamiliar with the MU controller. Perhaps you are referring to the μ synthesis technique used to determine the parameters in tunable components, such as PID controllers, state-space models, or even static gains that minimize a parameter called μ (mu) to ensure robust stability.
The code below uses a basic PID controller to improve tracking but does not minimize the μ parameter. If you have designed a robust controller according to μ synthesis, you can later compare its robust performance with the PID controller.
%% Parameters
R1 = 2;
R2 = 1;
L1 = 2;
L2 = 1;
C1 = ureal('C1', 1, 'percent', 20); % uncertain parameter
%% Uncompensated system
A = [-R1/L1 0 -1/L1; 0 -R2/L2 1/L2; 1/C1 -1/C1 0];
B = [1/L1; 0; 0];
C = [0 R2 0];
D = 0*C*B;
sys = ss(A, B, C, D); % Plant that contains parametric uncertainty
step(sys), grid on
title('Step Response of Uncompensated Plant')
%% PID controller (preliminary design)
kp = 1;
ki = 1.5;
kd = 1;
Gc = pid(kp, ki, kd)
%% Uncertain closed-loop system
figure
subplot(211)
uGcl = feedback(Gc*sys, 1);
step(uGcl, 20), grid on
title('Step Plot: Reference tracking')
subplot(212)
uGcd = feedback(sys, Gc);
step(uGcd, 20), grid on
title('Step Plot: Disturbance Rejection')
%% Evaluate robust performance
figure
S = feedback(1, Gc*sys); % closed-loop sensitivity function
bodemag(S, S.NominalValue), grid on
opts = robOptions('Sensitivity', 'On');
[perfmarg, wcu, info] = robgain(S, 1.5, opts)
info.Sensitivity
Smax = usubs(S, wcu);
getPeakGain(Smax, 1e-6)
step(S.NominalValue, Smax), grid on
legend('Nominal', 'Peak Gain = 1.5')
0 Comments
See Also
Categories
Find more on Robust Control Toolbox 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!