Now please stop asking this question. I already suggested 3 ways you MIGHT solve it, the first time you asked. You could have added this additional information to your last question, or added a comment to my answer.
Since you give no data, I'll make some up.
And now the solution. I'll use an optimproblem, which makes it very clear what I am doing.
prob = optimproblem
prob =
OptimizationProblem with properties:
Description: ''
ObjectiveSense: 'minimize'
Variables: [0x0 struct] containing 0 OptimizationVariables
Objective: [0x0 OptimizationExpression]
Constraints: [0x0 struct] containing 0 OptimizationConstraints
No problem defined.
Note that the default is to minimize, which is perfect for our problem.
obj = sum((F - (H*V + B*A)).^2,'all');
prob.Constraints.H = H == H.';
prob.Constraints.B = B == B.';
res = solve(prob,X0,solver = 'lsqlin')
Solving problem using lsqlin.
The interior-point-convex algorithm does not accept an initial point.
Ignoring X0.
Minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
res =
B: [2x2 double]
H: [2x2 double]
res.H
ans =
0.2192 -0.0289
-0.0289 0.1215
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
res.B
ans =
0.1182 0.6452
0.6452 0.2982
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
As you can see, two nicely symmetric matrices. The beauty of this approach is it lets the optimproblem and solve do all the thinking for you, in terms of how to implement the constraints, and how to farm out the solution to lsqlin. You might argue the downside is it hides some of the intracacies inside solve and the optimproblem. But at the same time, you probably don't appreciate the intracacies of how lsqlin solves the problem in the first place. So this approach really costs you little, yet gains a lot.
I could have set it up to go into lsqlin directly, but that would have been a bit less clear what I was doing. The solution itself would have obfuscated what I was doing. It could be instructive for you to look at how lsqlin would be set up directly without recourse to an optimproblem. But I would suggest you do that yourself, in the event that you really wanted to solve it that way. The only way to learn is by doing.