Hey, everyone. I'm trying to solve an optimization problem without the Optimization toolbox. I already have the roots from the equation (by "solve"), it gives to me an struct array, with fields x1, x2… xn, my problem is I already have an x1, x2… xn. I've been trying by so many ways but simply I couldn't solve it, I'm looking to asign the value of the fields to the syms variables and then apply "subs". Code below.

Thanks in advance for help. ðŸ™‚

`clear; close all; clc;var= input ('Dimention of domain');syms x [1 var];func= input ('Enter the function, i.e [x1+x2+...+xn]: \n');y=[];for s=x(1:end) dp= diff (func, [s]); y=[y, dp];endpc=solve (y);pucr= fieldnames (pc);for i= 1:numel(pucr) vals(i, 1)= getfield(pc,pucr{i});endHf=hessian (func);Hff= subs (Hf);`

## Best Answer