How to solve 2n+2 nonlinear equations in MATLAB?
3 views (last 30 days)
Show older comments
Here I want to solve these nonlinear equations. n is known and it is defined by function variable.
function[I]=solveequations[n]

where I0 I1 ... In are known, and A0 A1 ... An and x0 x1 ... xn are variables.
So how to calculate these 2n+2 nonlinear equations in MATLAB?
Thanks!
0 Comments
Answers (1)
Titus Edelhofer
on 21 Apr 2015
Hi Simon,
you might try to use fminsearch. For simplicity I assume A and x to count from 1 instead of 0. First write the objective function
function y = goal(X, I)
n = length(x) / 2;
A = X(1:n);
x = X(n+1:end);
f = zeros(n,1);
for i=1:n
f(i) = sum(A .* x.^(i-1) - I(i));
end
y = sum(abs(y));
and then call fminsearch with
x = fminsearch(@(x) goal(x, I), x0);
where I is the vector of given I's and x0 some start vector like [A1, A2, ... An, x1, ..., xn]. As I said, probably you should rewrite first for A1...An instead of A0...An etc. to make life easier.
Titus
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!