My code are showing below:

“x = [2,3,2,4,5,2]

a = 1

cvx_begin

variable r

minimize( prod(a + (x - r).^2) )

cvx_end”

My purpose is to get the optimal r. It is kinda like doing a regression of x, and get the coefficient r. But it is not simple least square. The mathematical expression is as below:

min┬r∏_(i from 1 to N)〖(a+(Xi - r)^2)〗

I got the error:

“Error using cvx/prod (line 84)

Disciplined convex programming error:

Invalid computation: prod( {convex} )

Error in Untitled (line 5)

minimize( prod(a + (x - r).^2) )”

I do not know how to solve this problem, please help me!!!