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

non-linear equations

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

Best Answer

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));