Error using matlab.gra​phics.axis​.Axes/set Value

2 ビュー (過去 30 日間)
Harleen Kaur
Harleen Kaur 2019 年 5 月 9 日
回答済み: Walter Roberson 2019 年 5 月 9 日
% Clear Old Variables
yalmip('clear'); C1=[]; C2=[]; C3=[]; C4=[];
Z0=sdpvar(nx); Z1=sdpvar(nu,nx); for ii=1:nz mu(ii)=sdpvar(1); end
C1=[Z0 >= 0, mu>=0];
C2=[[Z0-Gd*Sigw*Gd' (Ad*Z0-Bd*Z1); (Ad*Z0-Bd*Z1)' Z0] >= 0];
Izz=eye(nz);
for ii=1:nz rho_i=Izz(ii,:);
C3=[C3,[mu(ii) rho_i*(Dx*Z0-Du*Z1);(Dx*Z0-Du*Z1)'*rho_i' Z0]>=0];
end
% muj < zeta_maxj
for ii=1:nz C4=[C4, mu(ii) <= zeta_max(ii)]; end
Constraints=[C1,C2,C3,C4];
options = sdpsettings('verbose',0,'solver','mosek');
sol = optimize(Constraints,[],options);
if sol.problem == 0 % problem is feasible
Z0feas=value(Z0), Z1feas=value(Z1),
for ii=1:nz mufeas(ii)=value(mu(ii)); end
ZZfeas=(Dx*Z0feas-Du*Z1feas)inv(Z0feas)(Dx*Z0feas-Du*Z1feas)'
LLfeas=Z1feas/Z0feas, eig(Ad-Bd*LLfeas)
Sigx=dlyap(Ad-Bd*LLfeas,Gd*Sigw*Gd')
Sigz=(Dx-Du*LLfeas)Sigx(Dx-Du*LLfeas)'
qlabels=char('Mass Position (m)','Manipulated Variable (N)');
q_ossop=zeros(1,nz);qstar=zeros(1,nz); sigzmax=sqrt(zeta_max);
qmin=-sigzmax;qmax=sigzmax; SigmaZ=Sigz; alpha=1;
qqmin=1.0e+07 * [-3.8788 0 -0.0043]';qqmax=-qqmin;
xnum=2; ynum=1;
EDORplot(xnum,ynum,1,'y',q_ossop,qstar,qmin,qmax,SigmaZ,alpha^2,qlabels)
axis([qqmin(xnum) qqmax(xnum) qqmin(ynum) qqmax(ynum)]); box on;
set(gca, 'XTick', [-0.4:0.1:0.4]); set(gca, 'YTick', [-0.6 :0.1:0.6]);
set(gca,'FontName','Times New Roman','Fontsize',18)
elseif sol.problem == 1 % problem is infeasible
display('Infeasible Problem');
else
display('Hmm, something went wrong!'); sol.info; pause
end
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 5 月 9 日
Which line is the error occurring on? What are class() and size() of all the variables in that line?
Harleen Kaur
Harleen Kaur 2019 年 5 月 9 日
Hello,
It's right below EDOR plot :axis([qqmin(xnum) qqmax(xnum) qqmin(ynum) qqmax(ynum)]); box on;
A:6*6; B,G=1*6; Dx=2*6; Du=1*2; Sigx, sigz are calculated.

サインインしてコメントする。

回答 (2 件)

Stephane Dauvillier
Stephane Dauvillier 2019 年 5 月 9 日
Hi, please provide the line and the error message, it's really hard otherwise to provide a suitable answer.
On the following line for instance
ZZfeas=(Dx*Z0feas-Du*Z1feas)inv(Z0feas)(Dx*Z0feas-Du*Z1feas)'
There is a missing times sign (*) before the inv function
ZZfeas=(Dx*Z0feas-Du*Z1feas)*inv(Z0feas)*(Dx*Z0feas-Du*Z1feas)'
By the way, the function yalmip doesn't exist (at least on the newest release).
If I may, I strongly encourage you to avoid more than one statement per line: it's unreadable.
For instance write
for ii=1:nz
mu(ii)=sdpvar(1);
end
And not this
for ii=1:nz mu(ii)=sdpvar(1); end

Walter Roberson
Walter Roberson 2019 年 5 月 9 日
Your qqmin sets the second component to 0. qqmax is the negative of that which is also 0. You then try to use that min and max as the x axes limits, but MATLAB complains because they are both 0. The upper bound for x must be different than the lower bound and neither can be nan. The upper can be inf but the lower cannot be -inf

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by