Solving simultaneous equations numerically
Show older comments
I have two equations that need to be solved numerically, I can't write out the equations explicitly but they are both of the form:
x = \sum_{i=1}^N (a-(b_i)x)/((a-(b_i)x)^2+q^2y^2)
All the parameters other than x and y are fixed in this equation. Both my equations are of similar forms but I'm not sure what is the best way to solve this numerically in MATLAB as these equations involve the summation and I have never dealt with this kind of equation in MATLAB before.
p.s. sorry for the mess but I hope the form of the equation is clear enough. Thanks.
Accepted Answer
More Answers (1)
Roger Stafford
on 16 Oct 2014
Edited: Roger Stafford
on 16 Oct 2014
It doesn't matter that your two equations involve an extended summation. You can still create a function that generates these sums which you can use with the Optimization Toolbox function, 'fsolve'. You will, however, need to also furnish a guess or estimate to start the search for a solution. See:
http://www.mathworks.com/help/optim/ug/fsolve.html
5 Comments
John Smith
on 16 Oct 2014
Edited: John Smith
on 16 Oct 2014
John D'Errico
on 17 Oct 2014
Edited: John D'Errico
on 17 Oct 2014
Then it is not a numerical solution if those other variables are unknown! You are looking for a symbolic solution. Numerical solvers are not capable of solving symbolic problems.
John Smith
on 17 Oct 2014
John D'Errico
on 20 Oct 2014
Edited: John D'Errico
on 20 Oct 2014
No. I understood exactly what you were asking. It did not come out wrong.
This means they are unknowns, symbolic variables. You are asking for a symbolic solution. Just because something is an unknown does not mean that you need to solve for it, or that you can solve for it!
A numerical solver (fsolve, lsqnonlin, fmincon, or fzero for a few examples) CANNOT have unknown symbolic variables in the problem. It is no longer a numerical problem, but a symbolic one, not in their domain.
If you really want to see how the solution varies as a function of these variables, the best you can do with a numerical solver is to substitute in some values for those parameters, THEN you can solve the problem using a numerical solver, and I suppose plot the result as a function of those parameters you have substituted.
If however, you insist on seeing an analytical solution in terms of those unknowns, then you need to use a tool that can handle symbolic computations.
There is no mistake here. I do understand what you are asking.
John Smith
on 20 Oct 2014
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!