Matrix dimensions must agree

how to solve it I can run outside of cvx

global N_0
global sum_gr
global h_k_e
global b_kn
global a_kn
global h_u_b
global K
global N
global D_k
global K
global N
global B
global eve_position_chushi_1
global k_position_chushi_1
global bf
global UAV_position_chushi_1
for k = 1:K
for n = 1:N
A_n(k,n) = Db2Dec(-60).*0.5/(b_kn(k,n)N_0B);
B_n(k,n) = Db2Dec(-60).*0.5;
C_n(k,n) = Db2Dec(-60).0.5(abs(bf(1,4,n)))^2;
D_n(k,n) = (abs(h_k_e(k,n))^2).*0.5;
E_n(k,n) = B.*b_kn(k,n)*N_0+sum_gr(1,1,n);
end
end

q_0 = UAV_position_chushi_1(1,:,1);
u_0 = ones(1,1);
t_0 = ones(1,1);
for j = 1:3

cvx_begin

    variable   q(2,1);
    variable T(1,1);
    variable U(1,1);
    variable Z(1,1);
    expression q_0(1,2,1);
    expression r(1,1);
    expression constraints1(1,1);
    expression constraints2(1,1,1);
    expression constraints3(1,1);
    expression Taylor1(1,1);
    expression Taylor2(1,1);
    expression r_1(1,1);

              constraints2(1,1)=100*100+(q(:,1)-k_position_chushi_1(1,:,1))'.*(q(:,1)-k_position_chushi_1(1,:,1));
            Taylor1(1,1)=log(1+A_n(1,1)./u_0(1,1))/log(2) - (A_n(1,1).*(U(1,1)-u_0(1,1)))./(log(2).*u_0(1,1).*(u_0(1,1)+A_n(1,1)));
              r_1(1,1)= Taylor1(1,1)-1;

maximize(r_1)

        subject to
        U>constraints2;

    cvx_end

    u_0 = U;

end

错误使用 + (第 45 行)
Matrix dimensions must agree.

出错 - (第 21 行)
z = plus( x, y, true, cheat );

出错 trajectory123 (第 53 行)
constraints2(1,1)=100100+(q(:,1)-k_position_chushi_1(1,:,1))'.(q(:,1)-k_position_chushi_1(1,:,1));

Are you using implicit expansion MATLAB arithmetic expands in R2016b » Loren on the Art of MATLAB - MATLAB & Simulink ? That is not supported for CVX variables and expressions. if you are using it, you will have to rewrite the code to not use it, for instance, by using repmat.