Different ways of writing variables


#1

I came across a code where the author is defining variable as
“variable tau(2, N+2)”, which is fine. But he also declares another parameter “etahat = cvx(zeros(2, N))”, where in the code etahat is a function of declared variables. Is etahat an expression or variable here? I thought expression is defined as “expression etahat=…”.

Am I missing something?

Regards,
Divya


(Mark L. Stone) #2

>> cvx_begin; etahat = cvx(zeros(2, N))

etahat =

cvx zero expression (2x10 matrix)

cvx expressions don’t necessarily have to be explicitly declared as such

cvx_begin
variable x
y = x^2

y =

cvx convex expression (scalar)