I would like to minimize this function –

( 0.5 * square( y-yf_dot * (theta1/theta3)-yf * (theta2/theta3)-uf * (1/theta3)

– where I supply values for y, yf_dot, yf and uf and would like to solve for variables theta1, theta2, and theta3.

My understanding is that the function is convex for theta3>0 (which is my constraint), and the problem should be well-posed. However, I get the error “Cannot perform the operation: {real affine} ./ {real affine}”. What is wrong with my code?

uf =5; yf=3; yf_dot=0.1; y=3;

cvx_begin

variable theta1

variable theta2

variable theta3

minimize( 0.5 * square( y-yf_dot * (theta1/theta3)-yf * (theta2/theta3)-uf * (1/theta3) ))

subject to

theta3>=0

cvx_end

error:

Error in ==> cvx.rdivide at 19

z = times( x, y, ‘./’ );

Error in ==> cvx.mtimes at 36

z = feval( oper, x, y );Error in ==> cvx.mrdivide at 15

z = mtimes( x, y, ‘rdivide’ );

I found a way to calculate the Hessian for my function in Matlab and confirm what Mark said:

1). I found function Hessian (here: http://www.mathworks.com/matlabcentral/fileexchange/17847-symbolic-hessian-evaluator/content/hessian.m)

2). Then I ran this code

syms uf yf yf_dot y theta1 theta2 theta3

f = 0.5*(y-yf_dot*(theta1/theta3)-yf*(theta2/theta3)-uf*(1/theta3))^2;

H=hessian(f,[theta1 theta2 theta3]);

H1=subs ( H, {uf, yf, yf_dot, y, theta1, theta2, theta3}, …

{5, 3, -4, 2, 1, 1, 1})eig(H1)

I indeed made an error when I derived the Hessian by hand. The eig. values found in Matlab were -1.703476621077913, 0 and 58.703476621077911. This function is not convex due to the eig. value of -1.7, as Mark said earlier. Thank you, Mark.

Thanks,

Sonja