errors with musyn -- Plant must have at least <> inputs and <> outputs
10 次查看(过去 30 天)
显示 更早的评论
Taking a very simple inverted pendulum found from these dynamics: https://towardsdatascience.com/comparing-optimal-control-and-reinforcement-learning-using-the-cart-pole-swing-up-openai-gym-772636bc48f4
4 states, 1 input, 4 outputs.
Attempting to find a robust controller using musyn, but coming across this error message
```
Error using uss/musyn (line 74)
P must have at least 2 inputs and 5 outputs.
```
Code below:
% PLANT MODEL
g = ureal('g', 9.8, 'percentage', 80);
mcart = ureal('mcart', 1.0, 'percentage', 80);
mpole = ureal('mpole', 0.1, 'percentage', 80);
l = ureal('l', 2*0.5, 'percentage', 80);
M = mcart + mpole;
a = g /(l*(4.0/3 - mpole/(mpole+mcart)));
A = [0 1 0 0; 0 0 a 0; 0 0 0 1; 0 0 a 0];
b = -1/(l*(4.0/3 - mpole/(mpole+mcart)));
B = [0;1/mcart; 0; b];
C = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1];
D = [0; 0; 0; 0];
% MAKE SS
P = ss(A, B, C, D);
P.StateName = {'cart pos (m)';'car vel (m/s)';...
'pole angle (\theta)';'pole angular vel (\theta/s)'};
P.InputName = {'force'};
P.OutputName = {'x'; 'xdot'; 'theta'; 'thetadot'};
% ROBUST ANALYSIS
nY = 4;
nU = 1;
[Krob, ~, gamma_inf] = musyn(P, nY, nU)
0 个评论
回答(1 个)
Paul
2021-11-29
The plant model has 4 outputs and 1 input. If you look at
doc musyn
you'll see that the second (nY) and third inputs (nU) are the number of measurements (y) from and control inputs (u) to the plant. But the plant has additional inputs (w) and outputs (z) that define the the closed loop transfer function for optimization. So the plant has to have at least 2 inputs and 5 outputs altogether, which is what the error message is saying.
Having said all that, are you sure musyn is the correct function to use? I'm asking because
a) the comment says "Robust Analysis" and musyn is used for robust design, and
b) the outputs from the call to musyn don't seem to match any of the signatures on doc page.
4 个评论
Paul
2021-11-30
I don't think you can get a state feedback solution, but it's been a long time since I did any mu synthesis stuff and so could very well be wrong.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Robust Control Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!