Hello,
I am getting the error "
Sparse assignment is limited to 2 dimensions" stemming from line 27 below. Could the tildeX assignment on line 20 be causing issues from double/sdpvar confusion as discussed
here? If so, how do you build a sum of sdpvars?
Also, what is the correct way to initialize variables that will have sdpvars in their structure (e.g., XBlock)? If I initialize
XBlock = zeros(nx+nw,nx+nw,N), I run into troubles with the double/sdpvar confusion. Should I instead initialize
XBlock = sdpvar(nx+nw,nx+nw,N)? In the code below, I do not initialize XBlock, tildeX, or brl at all.
- global A
- global B
- global C
- global D
- global N
- loadSystemMats();
- P = [ 0.3 0.7 ; 0.3 0.7 ];
- [nx,dum]=size(A(:,:,1));
- [nz,dum]=size(C(:,:,1));
- [dum,nw]=size(D(:,:,1));
- X = sdpvar(nx,nx,N,'symmetric','real');
- F = [];
- for i = 1:N
- M(:,:,i) = [ A(:,:,i), B(:,:,i) ; C(:,:,i), D(:,:,i) ];
- tildeX(:,:,i) = zeros(nx,nx);
- for j = 1:N
- tildeX(:,:,i) = tildeX(:,:,i) + P(i,j).*X(:,:,j);
- end
- tildeBlock(:,:,i) = [ tildeX(:,:,i), zeros(nx,nz) ; zeros(nz,nx), eye(nz) ];
- XBlock(:,:,i) = [ X(:,:,i), zeros(nx,nw) ; zeros(nw,nx), eye(nw) ];
- brl(:,:,i) = M(:,:,i)' * tildeBlock(:,:,i) * M(:,:,i) - XBlock(:,:,i);
- F = [ F, X(:,:,i) >= 0, brl(:,:,i) <= 0 ];
- end
- options = sdpsettings('solver','sedumi');
- diagnostics = solvesdp(F,[],options)
- checkset(F)
Thank you.
Collin