# Objective Formulation

Here x is a column vector,
lambda is a diagonal matrix,
A is a weight matrix to be generated randomly;
C is a column constant vector,
E is a unit column vector,

I have uploaded the main update equation image and the required formula expansions for the same.
The issue comes when I write the objective as it shows error of the type : Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
My code is as follows:

function [x,f_opt] = follower_update(lambda,rho,E,A,C)
rho = 2;
E  = eye(6,1);
Z = [1 2 1 4 2 1];
lambda = diag(Z,0);
A =  rand(6,1);
C = rand(1,1);
cvx_begin
variable x(6,1) nonnegative;
minimize x'*x - [lambda*E]'*A'*x + exp(x) + (rho/2) * power(2,(norm(sum A'*x + A'*x + sum A'*x - C),2));
cvx_end
f_opt = cvx_optval;

In my solution function fi(xi) = xi^2 and hi(xi)= exp(xi) and I have not included theta for now. Please help me with this error .
Thanks!

Put the rest of the line after minimize in () .
Why are you using []/
Isolate to the portion of the expression causing an error.

If instead of declaring x a variable, you assign a numerical vector value, then the epresssion needs to evaluate without error; that is a matter of MATLAB syntax and being conformal; get that to evaluate correctly, then go back to declaring x a variable.

Thanks @Mark_L_Stone your suggestions worked. Also those square brackets was a mistake on my part. Have a good day!

Sorry to bother you again @Mark_L_Stone , now when I put in exp(x)*x in my expression it shows the following error:

Disciplined convex programming error:
Cannot perform the operation: {log-affine} .* {real affine}

Error in * (line 36)
z = feval( oper, x, y );

Error in follower_update (line 12)
minimize (x’*x + (E’lambda’ A’*x)+ exp(x)+ exp(x)*x +(rho/2) * power(2,(norm(sum (A’*x) + A’*x + sum (A’*x) - C,2))));

Could you help me figure out why this is happening?

You got the error because you didn’t follow CVX’s rules.

See the post by @Michal_Adamaszek in Interpolation error for how to handle exp(x)*x .