How to solve 2n+2 nonlinear equations in MATLAB?
Afficher commentaires plus anciens
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!
Réponses (1)
Titus Edelhofer
le 21 Avr 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
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!