Dimensions of matrices being concatenated are not consistent ????

848 views
Skip to first unread message

fati-a

unread,
Apr 5, 2018, 5:06:17 AM4/5/18
to YALMIP
Hello Johan 



I have a problem about  Dimensions of matrices, this problem is very strange for me because dimensions of parameter and controller are the same but still, there is this error :

Error using vertcat
Dimensions of matrices being concatenated are not consistent.

Error in eliminatevariables (line 249)
        involved = [involved;find(m ~= fix(m) | m < 0)];

Error in optimizer/subsref (line 122)
            [self.model,keptvariables,infeasible] =
            eliminatevariables(self.model,self.parameters,thisData(:));

Error in cc_mpc2 (line 275)
    [sol,err] = controller{{P.x_k,alpha_tot(24*20+k:24*20+k+P.Hp-1,:),...



could you please help me for solving this problem?




Thanks 




cc_mpc2.m
forcastdemand.mat
Data3tanks.mat
eqcon_elimination.m
Dmodel.mat

Johan Löfberg

unread,
Apr 5, 2018, 5:46:32 AM4/5/18
to YALMIP
The optimizer  does not like models which have signomial parameterizations in models that are intended to be solved with a simple QP solver. Hence, your A matrix should not be parameterized in x, but you should define new variables beta  and let these be parameters, and compute these this from x before you call the controller object. That will also lead to much less overhead in every controller call, since a lot of symbolic processing can be removed


fati-a

unread,
Apr 5, 2018, 6:28:13 AM4/5/18
to YALMIP
Dear Johan 


Thank you for quick answer.


I change the matrix A of my model and now the model is not signomial but still, there is the same problem .


Error using vertcat
Dimensions of matrices being concatenated are not consistent.

Error in cc_mpc2 (line 282)
    [sol,err] = controller{{P.x_k,...



Thanks 
 
cc_mpc2.m

Johan Löfberg

unread,
Apr 5, 2018, 6:45:35 AM4/5/18
to YALMIP
That's because the following code fails due to your commenting

>> {P.x_k,
%                                    alpha_tot(24*20+k:24*20+k+P.Hp-1,:),...
                                     alpha_tot(k:k+P.Hp-1,:),...
                                     D{mod(P.Hp+k-1,P.Hp)+1},...
                                     Dd{mod(P.Hp+k-1,P.Hp)+1},...
                                     bs{mod(P.Hp+k-1,P.Hp)+1},...
                                     devX{mod(P.Hp+k-1,P.Hp)+1}
                                     }
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
 


...and once you've fixed that it will still fail as the dimensions in the parameter list is not consistent with the data that you send

Reply all
Reply to author
Forward
0 new messages