I have a system of equations...
dF(a,b,c)/da = 0;
dF(a,b,c)/db = 0;
dF(a,b,c)/dc = 0;
where a
,b
,c
are unknown variable constants and dF/d*
are anonymous functions of the variables. I have to solve for a
,b
and c
in an optimization problem. When the system reduces to just one equation, I use Matlab's fzero
to solve for the variable and it works. For example
var_a = fzero(@(a) dF(a)/da,0);
After noticing that fzero
and fsolve
give dramatically different answers for some cases I did some searching. From what I gather, fzero
only works for a single equation of a single variable? So moving to a system of equations, I'd like to choose the most appropriate method. I've used Matlab's solve
in the past, but I believe that is for symbolic expressions only? What is the best method for solving a linear system of anonymous functions, which all equal zero?
I tried the following, and got back results
vars = fsolve(@(V)[dF(V)/da;dF(V)/db;dF(V)/dc],zeros(1,3));
where vars
contains all 3 variables, but after reading the examples in the previous link, Fsolve
couldn't exactly find the zeros for x^2 and x^3. The solution vector in the system I presented above is all zeros and the functions are polynomials. Putting this all together, I'm wondering if fsolve
isn't the best choice?
Can I build a system of calls to fzero
? Something along the lines of
vars = [fzero(@(a) dF(a,b,c)/da,0);
fzero(@(b) dF(a,b,c)/db,0);
fzero(@(c) dF(a,b,c)/dc,0)];
which I don't think would work (how would each dF/d*
get the other 2 variable inputs?) or would it?
Any thoughts?