Multiply constraint set by matrix (K*X)

64 views
Skip to first unread message

Marc Wijnand

unread,
May 11, 2015, 9:36:02 AM5/11/15
to yal...@googlegroups.com
I have a constraint set X. Now I want to determine the set Z of elements that is defined as {Z=K*x l x element of X} with K a given matrix [LQR].
I don't understand why the command
plot(Z,z)
gives no result - this should be a line in 1D - while you can verify that Z is not empty by plotting
plot(Z)
.

Minimal working example:
%% K*X in Yalmip
x = sdpvar(2,1);
X = [-1<=x<=1];
K=[1 1];
z = sdpvar;
Z = [z==K*x, ismember(x,X)];
plot(X,[],'g')
plot(Z,z) %no result
plot(Z)


Johan Löfberg

unread,
May 11, 2015, 9:51:36 AM5/11/15
to yal...@googlegroups.com
No, the plotting functionality does not plot simple lines with no interior

Johan Löfberg

unread,
May 11, 2015, 9:57:21 AM5/11/15
to yal...@googlegroups.com
You can edit lmi/plot though. Change the plotSet function to 

if size(x_opt,1)==1
    p = line(x_opt,[0 0],'color',color);
    set(p,'LineStyle',options.plot.wirestyle);   
    set(p,'LineStyle',options.plot.wirestyle);   
    set(p,'LineWidth',options.plot.linewidth);
    set(p,'EdgeColor',options.plot.edgecolor);
    set(p,'Facealpha',options.plot.shade);    
elseif size(x_opt,1)==2

and in the same file in generateBoundary, you change the creation of c to

 if length(x)==2
        c = [cos(angles);sin(angles)];
    elseif length(x) == 1
        c = [-1 1];n = 2;
    else
        c = randn(3,n);
    end


Marc Wijnand

unread,
May 11, 2015, 11:46:31 AM5/11/15
to yal...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages