MATLAB Answers

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

13 views (last 30 days)
Harleen Kaur
Harleen Kaur on 9 May 2019
Answered: Walter Roberson on 9 May 2019
% 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];
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];
% muj < zeta_maxj
for ii=1:nz C4=[C4, mu(ii) <= zeta_max(ii)]; end
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
LLfeas=Z1feas/Z0feas, eig(Ad-Bd*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;
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');
display('Hmm, something went wrong!');; pause
Harleen Kaur
Harleen Kaur on 9 May 2019
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.

Sign in to comment.

Answers (2)

Stephane Dauvillier
Stephane Dauvillier on 9 May 2019
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
There is a missing times sign (*) before the inv function
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
And not this
for ii=1:nz mu(ii)=sdpvar(1); end

Walter Roberson
Walter Roberson on 9 May 2019
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


Community Treasure Hunt

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

Start Hunting!