How to solve 4 nonlinear equations (in 4 unknowns) ITERATIVELY

Hi,
Please help me in solving 4 nonlinear equations ITERATIVELY...
a1, b1, c1 d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4, k1, k2, k3 all are known
(a1-x(1))^2+(a2-x(2))^2+(a3-x(3))^2-x(4)^2=0
(b1-x(1))^2+(b2-x(2))^2+(b3-x(3))^2-k1*(x(4))^2=0
(c1-x(1))^2+(c2-x(2))^2+(c3-x(3))^2-k2*(x(4))^2=0
(d1-x(1))^2+(d2-x(2))^2+(d3-x(3))^2-k3*(x(4))^2=0
*I know how to solve them using solve command to get just a single solution*
Help!
Thanks

 Réponse acceptée

variant
a = rand(4);
a(1,end) = 1;
f1 = @(x)sum(bsxfun(@minus,a(:,1:end-1),reshape(x(1:end-1),1,[])).^2,2) - a(:,end)*(x(end)^2);
x = fsolve(f1,randi(12,4,1));

3 commentaires

Hi Andrei,
Can you please elaborate it.
I am a beginner.
Thanks for your answer.
in our case:
a = [a1 a2 a3 1
b1 b2 b3 k1
c1 c2 c3 k2
d1 d2 d3 k3]
x = [x(1);x(2);x(3);x(4)]
Thanks,
BTW I got the desired results by using Newton Raphson method for solving a sysytem of non linear equations.
Bye

Connectez-vous pour commenter.

Plus de réponses (1)

Nuno
Nuno le 7 Mai 2015
Modifié(e) : Nuno le 7 Mai 2015
this can be applied to this I have x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4
(x0-x1)^2+(y0-y1)^2+(z0-z1)^2=r^2
(x0-x2)^2+(y0-y2)^2+(z0-z2)^2=r^2
(x0-x3)^2+(y0-y3)^2+(z0-z3)^2=r^2
(x0-x4)^2+(y0-y3)^2+(z0-z4)^2=r^2
I need to get x0,y0,z0 and r.
I applied that code and the results are very weird

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by