Using double incorrectly. Cannot convert from cvx to double

This is usually the result of assigning a CVX variable or expression to an element(s) of an array without having declared the array as an expression. You don’t need to (but can) declare the array if you assign the whole array all at once. E.g. A = B*C, where B is a CVX variable and C is a double precision matrix creates the expression A all at once; so A does not need to be declared as an expression. But if you assign elements of A (index into A) without having declared it as an expression of the appropriate dimensions, you might get this error. For example, A(3,:) = x.

I see you declared some expressions. But I think you also need to declare f3 as an expression before you use it. That’s why you got the error. I will let you determine whatever other similar fixes are needed to your programs.

CVX Users’ Guide section on Assignment and expression holders